/* ===== Design Tokens ===== */
:root {
  --ink: #0f172a;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --paper: #f1f5f9;
  --white: #ffffff;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --accent: #059669;
  --accent-dark: #047857;
  --accent-light: #10b981;
  --accent-soft: #d1fae5;
  --accent-xsoft: #ecfdf5;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --shadow-xs: 0 1px 2px rgba(15,23,42,.05);
  --shadow-sm: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
  --shadow: 0 4px 16px rgba(15,23,42,.06), 0 2px 6px rgba(15,23,42,.04);
  --shadow-lg: 0 20px 60px rgba(15,23,42,.10), 0 8px 24px rgba(15,23,42,.06);
  --shadow-accent: 0 4px 14px rgba(5,150,105,.25);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --sans: Inter, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --serif: "Noto Serif SC", "Songti SC", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace;

  /* Motion — springs, not fixed durations.
     --ease: critically damped, no overshoot — the default for anything that just appears.
     --spring: physical settle for momentum-carrying interactions (a lift, a grab).
     Reserve overshoot for gestures that carried momentum; a fade never bounces. */
  --t-fast: 0.12s;
  --t: 0.24s;
  --t-slow: 0.42s;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --transition: var(--t) var(--ease);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-optical-sizing: auto;
  line-height: 1.6;
  font-size: 14px;
  /* Body copy sits near zero tracking (§15 — small text wants no tightening) */
  letter-spacing: 0;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
button, input, select, textarea { font: inherit; }
button:disabled { cursor: not-allowed; opacity: .45; }
code { font-family: var(--mono); }

/* All headings share optical sizing; size-specific tracking is set per role below */
h1, h2, h3 { font-optical-sizing: auto; }

/* ===== Layout Containers ===== */
.site-header, .site-footer, main {
  width: min(1200px, calc(100% - 48px));
  margin: auto;
}

/* Content materializes in — critically damped, opacity + a small rise, no bounce (§3, §4) */
main { animation: rise var(--t-slow) var(--ease) both; }
@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 10px, 0); }
  to   { opacity: 1; transform: none; }
}

/* ===== Site Header ===== */
/* Translucent floating chrome: content scrolls *under* it, not beside it (§12).
   The bottom hairline reads as a soft scroll edge rather than a hard divider. */
.site-header {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  max-width: none;
  padding-inline: max(24px, calc(50vw - 600px));
  background: rgba(241, 245, 249, .72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(226, 232, 240, .6);
}

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent-light));
  color: #fff;
  display: grid;
  place-items: center;
  font: 700 16px var(--serif);
  box-shadow: 0 2px 8px rgba(5,150,105,.35);
  transition: transform var(--t) var(--spring);
}
.brand:hover .brand-mark { transform: scale(1.06) rotate(-3deg); }
.brand:active .brand-mark { transform: scale(0.94); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: 11px; }

/* Nav */
.site-header nav {
  display: flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 500;
  width: auto; margin: 0;
}
.site-header nav a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  transition: color var(--transition), background var(--transition), transform var(--t-fast) var(--ease);
}
.site-header nav a:hover { color: var(--ink); background: rgba(255,255,255,.6); }
.site-header nav a:active { transform: scale(0.96); }
.inline-form { display: inline; }
.link-button, .text-button {
  border: 0; background: none; color: var(--muted); padding: 6px 12px;
  cursor: pointer; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500;
  transition: color var(--transition), background var(--transition), transform var(--t-fast) var(--ease);
}
.link-button:hover, .text-button:hover { color: var(--ink); background: rgba(255,255,255,.6); }
.link-button:active, .text-button:active { transform: scale(0.96); }

/* ===== Site Footer ===== */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 24px 0 40px;
  display: flex;
  justify-content: space-between;
  color: var(--muted-light);
  font-size: 12px;
  margin-top: 40px;
}

/* ===== Eyebrow label ===== */
.eyebrow {
  display: inline-block;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* ===== Card ===== */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  transition: box-shadow var(--t) var(--ease), transform var(--t) var(--spring);
}

/* ===== Form Elements ===== */
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%;
  background: #f8fafc;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  color: var(--ink);
  margin-top: 6px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
  font-size: 14px;
}
input:not([type="checkbox"]):not([type="radio"]):hover, select:hover, textarea:hover { border-color: #cbd5e1; background: var(--white); }
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(5,150,105,.12);
  background: var(--white);
}
input:not([type="checkbox"]):not([type="radio"]):disabled { background: var(--line-soft); color: var(--muted); cursor: not-allowed; }
textarea { resize: vertical; }

/* Checkbox & Radio — 不干预浏览器原生样式，只修正布局 */
input[type="checkbox"], input[type="radio"] {
  width: auto;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  transition: none;
  flex-shrink: 0;
  accent-color: var(--accent);
}

/* ===== Buttons ===== */
/* Feedback lives on the press and it's instant (§1); the lift on hover uses a spring,
   the press scales down 1:1 so the control feels physically depressed (§2). */
.primary, .secondary, .copy-button, .danger-button {
  border: 0;
  border-radius: var(--radius-sm);
  min-height: 42px;
  padding: 0 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.005em;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--t) var(--ease), transform var(--t-fast) var(--ease);
  gap: 6px;
}
.primary {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff;
  box-shadow: var(--shadow-accent);
}
.primary:hover {
  background: linear-gradient(135deg, #065f46, var(--accent-dark));
  box-shadow: 0 6px 18px rgba(5,150,105,.35);
  transform: translateY(-1px);
}
.primary:active { transform: scale(0.97); }
.secondary {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border: 1.5px solid rgba(5,150,105,.2);
}
.secondary:hover { background: #a7f3d0; border-color: var(--accent); transform: translateY(-1px); }
.secondary:active { transform: scale(0.97); }
.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
  min-height: 34px;
  border: 1.5px solid rgba(220,38,38,.15);
  font-size: 13px;
}
.danger-button:hover { background: #fee2e2; border-color: var(--danger); }
.danger-button:active { transform: scale(0.97); }
.copy-button {
  background: var(--white);
  color: var(--accent);
  min-height: 34px;
  border: 1.5px solid var(--line);
  font-size: 12px;
}
.copy-button:hover { background: var(--accent-xsoft); border-color: var(--accent); }
.copy-button:active { transform: scale(0.97); }
.full { width: 100%; }

/* ===== Alerts / Messages ===== */
.alert, .success, .notice {
  padding: 12px 15px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1.5px solid transparent;
  animation: alert-in var(--t) var(--ease) both;
}
@keyframes alert-in {
  from { opacity: 0; transform: translate3d(0, -4px, 0); }
  to   { opacity: 1; transform: none; }
}
.alert { background: var(--danger-soft); color: #b91c1c; border-color: #fecaca; }
.success { background: var(--accent-xsoft); color: var(--accent-dark); border-color: #a7f3d0; }
.notice { background: var(--warning-soft); color: #92400e; border-color: #fde68a; }

/* ===== Form Cards & Auth Cards ===== */
.form-card { padding: 32px; }
.form-card.compact { padding: 26px; }
.auth-card { padding: 36px; }

.form-card label, .auth-card label, .horizontal-form label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 16px;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.form-card small, .auth-card small {
  font-weight: 400;
  color: var(--muted-light);
  text-transform: none;
  letter-spacing: 0;
}
.form-card h2, .form-card h3, .auth-card h2 {
  font-family: var(--serif);
  color: var(--ink);
  margin: 0 0 24px;
}
/* Large serif headings: tighten leading and pull tracking negative as they grow (§15) */
.form-card h2, .auth-card h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.form-card h3 { font-size: 18px; font-weight: 600; letter-spacing: -.015em; }

.form-links {
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
  color: var(--muted);
  font-size: 13px;
}
.form-links a { color: var(--accent); font-weight: 500; transition: color var(--transition); }
.form-links a:hover { color: var(--accent-dark); text-decoration: underline; }

/* ===== Auth Shell (Login Page) ===== */
.auth-shell {
  min-height: calc(100vh - 64px - 88px);
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 80px;
  align-items: center;
  padding: 60px 0;
}
.auth-copy h1 {
  font: 700 52px/1.1 var(--serif);
  letter-spacing: -.04em;
  max-width: 560px;
  margin: 14px 0 16px;
  background: linear-gradient(135deg, var(--ink) 40%, var(--accent-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-copy > p { color: var(--muted); font-size: 16px; max-width: 480px; line-height: 1.7; }
.protocol-note {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 32px;
  color: var(--muted);
  font-size: 12px;
  flex-wrap: wrap;
}
.protocol-note span { color: var(--accent); font-weight: 700; }
.protocol-note i { font-style: normal; color: var(--muted-light); }
/* A bigger surface reads as thicker material — the auth card gets the deepest shadow (§12) */
.auth-card { box-shadow: var(--shadow-lg); border-color: rgba(226,232,240,.8); }

/* ===== Narrow Page (Register / Recover) ===== */
.narrow-page { max-width: 700px; padding: 60px 0 100px; }
.page-heading { margin-bottom: 30px; }
.page-heading h1 { font: 700 40px/1.15 var(--serif); margin: 10px 0; letter-spacing: -.03em; }
.page-heading p { color: var(--muted); font-size: 15px; }

/* ===== Field Grid ===== */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field-grid .wide { grid-column: 1 / -1; }

/* Checkbox field */
.form-card .check, .horizontal-form .check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 13px;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
}
.check input { width: auto; margin: 0; min-height: unset; }

/* ===== Message Page (Error) ===== */
.message-page {
  text-align: center;
  padding: 120px 0 160px;
  min-height: 550px;
}
.message-page h1 { font: 700 44px var(--serif); margin: 14px; letter-spacing: -.03em; line-height: 1.1; }
.message-page p { color: var(--muted); margin-bottom: 28px; font-size: 16px; }

/* ===== Account Page ===== */
.account-page { padding: 60px 0 100px; }
.account-hero { margin-bottom: 36px; }
.account-hero h1 { font: 700 42px/1.15 var(--serif); margin: 10px 0 6px; letter-spacing: -.03em; }
.account-hero .mono { font: 12px var(--mono); color: var(--muted-light); }
.account-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Access list */
.access-list { margin-top: 52px; }
.section-title {
  border-bottom: 2px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 20px;
  display: flex;
  align-items: end;
  justify-content: space-between;
}
.section-title > div { display: flex; align-items: center; gap: 12px; }
.section-title h2 { font: 600 20px var(--serif); margin: 0; letter-spacing: -.015em; }
.section-title > span { font-size: 12px; color: var(--muted); }

.access-list article {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  padding: 18px 4px;
  transition: background var(--transition), padding var(--t) var(--ease), margin var(--t) var(--ease);
}
.access-list article:hover { background: var(--line-soft); border-radius: var(--radius-sm); margin: 0 -8px; padding: 18px 12px; }
.access-list strong, .access-list small { display: block; }
.access-list strong { font-size: 14px; margin-bottom: 3px; }
.access-list small { color: var(--muted); font-size: 12px; }

/* Status badge */
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent-dark);
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 20px;
}
.status::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.status.disabled { color: var(--danger); background: var(--danger-soft); }
.status.active { color: var(--accent-dark); background: var(--accent-soft); }

/* Empty state */
.empty {
  padding: 36px;
  color: var(--muted);
  text-align: center;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-lg);
  background: #fafbfc;
  font-size: 13px;
}

/* Access actions */
.access-actions { display: flex; align-items: center; gap: 10px; }
.quick-access { min-height: 32px; padding: 0 12px; font-size: 12px; }

/* Renewal Card */
.renewal-card {
  margin-top: 24px;
  padding: 30px;
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(280px,400px);
  gap: 32px;
  align-items: end;
}
.renewal-card h2 { font: 600 22px var(--serif); margin: 8px 0 10px; letter-spacing: -.02em; }
.renewal-card p { color: var(--muted); margin: 0; font-size: 14px; line-height: 1.65; }
.renewal-card form label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.renewal-card form button { margin-top: 12px; }

/* ===== Admin Page ===== */
.admin-page { padding: 56px 0 120px; }
.admin-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 32px;
}
.admin-hero h1 { font: 700 40px/1.15 var(--serif); margin: 10px 0 4px; letter-spacing: -.03em; }
.admin-hero p { color: var(--muted); margin: 0; }

/* Stats */
.stats { display: flex; gap: 10px; }
.stats div {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  min-width: 90px;
  box-shadow: var(--shadow-xs);
  transition: box-shadow var(--t) var(--ease), transform var(--t) var(--spring);
}
.stats div:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stats strong, .stats span { display: block; }
.stats strong { font: 700 26px var(--serif); color: var(--ink); letter-spacing: -.02em; }
.stats span { font-size: 11px; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: .06em; }

/* Flash notification */
.flash {
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 72px;
  z-index: 10;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}
.flash code {
  background: rgba(255,255,255,.8);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* Admin nav — translucent floating strip, sits just under the glass header (§12) */
.admin-nav {
  position: sticky;
  top: 64px;
  z-index: 5;
  background: rgba(241,245,249,.82);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid rgba(226,232,240,.6);
  display: flex;
  gap: 4px;
  padding: 10px 0;
  margin-bottom: 40px;
  font-size: 13px;
  font-weight: 500;
}
.admin-nav a {
  padding: 6px 14px;
  border-radius: 20px;
  color: var(--muted);
  transition: color var(--transition), background var(--transition), box-shadow var(--transition), transform var(--t-fast) var(--ease);
}
.admin-nav a:hover { color: var(--ink); background: var(--white); box-shadow: var(--shadow-xs); }
.admin-nav a:active { transform: scale(0.96); }

.admin-section { scroll-margin-top: 80px; margin: 0 0 72px; }

/* Split grid */
.split-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; }

/* Table */
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-xs);
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
th {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  background: #f8fafc;
  font-weight: 600;
  position: sticky;
  top: 0;
}
tr:last-child td { border-bottom: none; }
tr td { transition: background var(--t-fast) var(--ease); }
tr:hover td { background: #fafbff; }
td strong, td small { display: block; }
td small { color: var(--muted); margin-top: 2px; font-size: 12px; }
.sub-code { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }

/* Row form (inline table actions) */
.row-form { display: flex; align-items: center; gap: 6px; }
.row-form select { width: auto; margin: 0; padding: 6px 8px; font-size: 12px; }

/* Horizontal form (access assignment) */
.horizontal-form {
  display: grid;
  grid-template-columns: 1.3fr 1.3fr 1fr .8fr .6fr .8fr auto;
  align-items: end;
  gap: 12px;
  padding: 24px;
  margin-bottom: 16px;
}
.horizontal-form label { margin: 0; font-size: 11px; }

/* Client grid */
.client-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 20px; }
.client-card { padding: 22px; }
.client-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.client-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.client-type { color: var(--muted-light); font: 11px var(--mono); text-transform: uppercase; }
.client-card h3 { font-family: var(--serif); margin: 10px 0 8px; font-size: 16px; letter-spacing: -.015em; }
.client-card code, .client-card small { display: block; }
.client-card code { font-size: 12px; color: var(--accent-dark); background: var(--accent-xsoft); padding: 3px 7px; border-radius: 5px; display: inline-block; margin-bottom: 6px; }
.client-card small { color: var(--muted); margin-top: 6px; font-size: 12px; }
.client-card p { color: var(--muted); font-size: 11px; word-break: break-all; white-space: pre-line; margin: 8px 0 16px; line-height: 1.5; min-height: 34px; }
.client-quick-actions { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.client-quick-actions > form { flex: 0 0 auto; }
.client-action-button { min-height: 34px; padding: 0 13px; font-size: 12px; }
.client-editor { flex: 1; position: relative; }
.client-editor > summary {
  list-style: none; cursor: pointer; min-height: 34px; padding: 0 13px; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: var(--ink);
  background: var(--white); font-size: 12px; font-weight: 600; user-select: none;
}
.client-editor > summary::-webkit-details-marker { display: none; }
.client-editor > summary:hover { border-color: var(--accent); color: var(--accent-dark); background: var(--accent-xsoft); }
.client-editor[open] { flex-basis: 100%; }
.client-editor[open] > summary { margin-bottom: 14px; }
.client-quick-actions:has(.client-editor[open]) { flex-wrap: wrap; }
.client-edit-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; padding-top: 2px; }
.client-edit-form label { display: block; color: var(--muted); font-size: 11px; font-weight: 600; margin-bottom: 12px; }
.client-edit-form label:has(textarea), .client-edit-form .check, .client-edit-form .primary { grid-column: 1 / -1; }
.client-edit-form .check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 12px; }
.client-edit-form small { display: block; color: var(--muted-light); font-weight: 400; margin-top: 4px; }
.client-edit-form .primary { width: 100%; }
.client-delete-form { border-top: 1px solid var(--line-soft); margin-top: 14px; padding-top: 14px; }
.client-delete-form .danger-button { width: 100%; }

/* Fieldset */
.form-card fieldset {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  margin: 0 0 16px;
  padding: 14px;
}
.form-card legend { font-size: 11px; color: var(--muted); font-weight: 600; padding: 0 6px; }

/* Recovery grid */
.recovery-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 20px; }
.recovery-card {
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.recovery-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.recovery-card strong, .recovery-card small { display: block; }
.recovery-card strong { font-size: 14px; }
.recovery-card small { font-size: 11px; color: var(--muted); margin-top: 2px; }
.recovery-card form { display: flex; gap: 6px; align-items: center; }
.recovery-card input { width: 72px; margin: 0; padding: 8px 10px; font-size: 13px; }
.recovery-card .secondary { font-size: 12px; white-space: nowrap; min-height: 36px; padding: 0 12px; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; gap: 32px; padding: 48px 0; }
  .auth-copy h1 { font-size: 40px; }
  .split-grid, .account-grid { grid-template-columns: 1fr; }
  .client-grid, .recovery-grid { grid-template-columns: 1fr 1fr; }
  .horizontal-form { grid-template-columns: 1fr 1fr; }
  .admin-hero { align-items: flex-start; gap: 20px; flex-direction: column; }
  .admin-nav { overflow-x: auto; }
  .stats { flex-wrap: wrap; }
  .renewal-card { grid-template-columns: 1fr; gap: 16px; }
}

@media (max-width: 600px) {
  .site-header { height: 58px; padding-inline: 16px; }
  .site-footer, main { width: calc(100% - 28px); }
  .site-header nav { gap: 4px; }
  .site-header nav a:first-child { display: none; }
  .auth-copy h1, .page-heading h1, .account-hero h1, .admin-hero h1 { font-size: 32px; }
  .auth-card, .form-card { padding: 22px 16px; }
  .field-grid, .client-grid, .recovery-grid, .horizontal-form { grid-template-columns: 1fr; }
  .field-grid .wide { grid-column: auto; }
  .site-footer { flex-direction: column; gap: 6px; }
  .stats div { min-width: 80px; padding: 12px 14px; }
  .flash { align-items: stretch; flex-direction: column; }
  .protocol-note { align-items: flex-start; flex-wrap: wrap; }
  .row-form { align-items: stretch; flex-direction: column; }
  .client-edit-form { grid-template-columns: 1fr; }
  .client-edit-form label:has(textarea), .client-edit-form .check, .client-edit-form .primary { grid-column: auto; }
  .recovery-card { align-items: stretch; flex-direction: column; }
  .admin-page { padding-top: 32px; }
  .narrow-page { padding: 48px 0 80px; }
  .account-page { padding: 48px 0 80px; }
}

/* ===== Accessibility — three independent signals, baked in (§14) ===== */

/* Reduced motion: keep feedback, drop the travel. Cross-fades instead of slides/springs,
   no overshoot, no entrance rise. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  main, .alert, .success, .notice { animation: none; }
  .primary:hover, .secondary:hover, .stats div:hover,
  .client-card:hover, .recovery-card:hover { transform: none; }
}

/* Reduced transparency: make the glass frosty/solid — raise opacity, drop the blur (§14) */
@media (prefers-reduced-transparency: reduce) {
  .site-header, .admin-nav {
    background: var(--paper);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .site-header nav a:hover, .link-button:hover, .text-button:hover { background: var(--white); }
}

/* Higher contrast: near-solid surfaces with defined, contrasting borders (§14) */
@media (prefers-contrast: more) {
  :root { --line: #94a3b8; --muted: #475569; }
  .site-header, .admin-nav { background: var(--white); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .card { border-color: #94a3b8; }
  input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus {
    box-shadow: 0 0 0 3px rgba(5,150,105,.4);
  }
}
