/* SMS Quota: design tokens + shared components ("The Number Ticket", DESIGN.md). No inline styles (CSP default-src 'self'). */
:root {
  /* DESIGN.md colour tokens */
  --cobalt: #1E4FD8;
  --cobalt-hover: #1942B8;
  --cobalt-press: #163A9E;
  --cobalt-tint: #EBF0FD;
  --cobalt-ring: rgba(30, 79, 216, .32);
  --navy: #0E1A33;
  --navy-raised: #22325A;
  --navy-text: #B7C2D9;
  --navy-ring: #7FA2FF;
  --ink: #141A26;
  --ink-2: #475165;
  --ink-3: #5B6577;
  --ink-disabled: #7A8394;
  --paper: #FFFFFF;
  --ground: #F3F5F9;
  --muted-fill: #ECEFF4;
  --hairline: #DDE2EA;

  /* component aliases (pages and the console read these names) */
  --primary: var(--cobalt);
  --primary-hover: var(--cobalt-hover);
  --primary-active: var(--cobalt-press);
  --primary-bg: var(--cobalt-tint);
  --primary-ring: var(--cobalt-ring);
  --text: var(--ink);
  --text-2: var(--ink-2);
  --text-3: var(--ink-3);
  --text-placeholder: var(--ink-disabled); /* disabled labels only; placeholders use --text-3 */
  --border: var(--hairline);
  --border-strong: #C3CAD6;
  --border-input: #8A93A3; /* control boundaries, 3.10:1 on paper */
  --bg: var(--ground);
  --card: var(--paper);
  --neutral-bg: var(--muted-fill);
  --success: #1E8E4E;       /* icons only */
  --success-text: #12703A;
  --success-bg: #E6F4EA;
  --warning: #C77700;       /* icons only */
  --warning-text: #8A4B00;
  --warning-bg: #FFF3DD;
  --danger: #D2372F;        /* solid fills and icons */
  --danger-text: #BB2D26;
  --danger-bg: #FDECEA;

  /* type scale (size / line) */
  --fs-xs: 12px; --lh-xs: 20px;   /* label */
  --fs-sm: 14px; --lh-sm: 22px;   /* body small */
  --fs-body: 15px; --lh-body: 24px;
  --fs-md: 17px; --lh-md: 25px;   /* title */
  --fs-lg: 22px; --lh-lg: 30px;   /* headline */
  --fs-xl: 26px; --lh-xl: 34px;
  --fs-2xl: 28px; --lh-2xl: 36px;
  --fs-3xl: 32px; --lh-3xl: 40px; /* money large */
  --fs-code: 44px; --lh-code: 48px;
  /* spacing: 4px grid */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;
  /* radii: inner 6, controls 10, surfaces 14, tags and the switch pill */
  --radius-inner: 6px;
  --radius-btn: 10px;
  --radius-card: 14px;
  --radius-pill: 999px;
  /* elevation: a surface declares a hairline at rest or a shadow when it floats, never both */
  --shadow-xs: 0 1px 2px rgba(14, 26, 51, .08);
  --shadow: 0 1px 2px rgba(14, 26, 51, .06), 0 4px 12px rgba(14, 26, 51, .06);
  --shadow-pop: 0 8px 28px rgba(14, 26, 51, .18);
  /* focus */
  --focus: 2px solid var(--cobalt);
  --focus-offset: 2px;
  /* motion */
  --dur-fast: 120ms; --dur: 180ms; --dur-slow: 240ms;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", "Noto Sans SC", sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
  --nav-w: 216px;
  --notch: var(--card); /* what shows through the ticket notches: the surface the ticket sits on */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--border-strong) transparent; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fs-body)/var(--lh-body) var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  caret-color: var(--cobalt);
}
h1, h2, h3 { margin: 0; color: var(--text); font-weight: 600; text-wrap: balance; }
h1 { font-size: clamp(26px, 4.2vw, 36px); line-height: 1.25; font-weight: 650; letter-spacing: -0.02em; }
h2 { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 650; letter-spacing: -0.01em; }
h3 { font-size: var(--fs-md); line-height: var(--lh-md); }
p { margin: 0; }
b, strong { font-weight: 600; }
a { color: var(--cobalt); text-decoration: none; text-underline-offset: 3px; }
a:not(.btn):hover { color: var(--cobalt-press); text-decoration: underline; }
[hidden] { display: none !important; }
:focus-visible { outline: var(--focus); outline-offset: var(--focus-offset); }
:focus:not(:focus-visible) { outline: none; }
::selection { background: var(--cobalt-tint); color: var(--ink); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon-lg { width: 20px; height: 20px; }
.icon-xl { width: 40px; height: 40px; stroke-width: 1.5; }

.muted { color: var(--text-2); }
.hint { color: var(--text-3); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack > * + * { margin-top: 16px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Buttons: one cobalt fill per screen; everything else is secondary or text */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px;
  font: 500 var(--fs-body)/var(--lh-body) var(--font);
  border-radius: var(--radius-btn); border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; user-select: none; text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.btn .icon { width: 18px; height: 18px; }
.btn:active:not(:disabled):not([aria-disabled="true"]) { transform: translateY(1px); }
.btn-primary { background: var(--cobalt); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--cobalt-hover); }
.btn-primary:active { background: var(--cobalt-press); }
.btn-primary:hover, .btn-primary:active, .btn-danger-solid:hover { color: #fff; }
.btn-secondary { background: var(--card); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { border-color: var(--cobalt); color: var(--cobalt); }
.btn-text { background: transparent; color: var(--cobalt); padding: 0 8px; }
.btn-text:hover { background: var(--cobalt-tint); color: var(--cobalt-press); }
.btn-danger { background: var(--card); border-color: var(--border-strong); color: var(--danger-text); }
.btn-danger:hover { border-color: var(--danger-text); background: var(--danger-bg); }
.btn-danger-solid { background: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: var(--danger-text); }
.btn:disabled, .btn[aria-disabled="true"] {
  cursor: not-allowed; background: var(--neutral-bg); border-color: var(--border); color: var(--text-placeholder);
}
/* in flight: the variant colour stays, the label says what is happening */
.btn[aria-busy="true"], .btn[aria-busy="true"]:disabled { cursor: progress; opacity: .8; }
.btn-primary[aria-busy="true"]:disabled { background: var(--cobalt); border-color: transparent; color: #fff; }
.btn-secondary[aria-busy="true"]:disabled { background: var(--card); border-color: var(--border-strong); color: var(--text); }
.btn-text:disabled { background: transparent; border-color: transparent; }
.btn-lg { height: 48px; font-size: 16px; padding: 0 24px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: var(--fs-sm); gap: 6px; }
.btn-sm .icon { width: 16px; height: 16px; }
.btn-block { width: 100%; }

/* Forms */
.field { display: block; }
.field + .field { margin-top: 16px; }
.label { display: block; margin-bottom: 8px; color: var(--text); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 500; }
.label .req { color: var(--danger-text); margin-left: 2px; }
.input, .select {
  width: 100%; height: 44px; padding: 0 14px;
  font: 16px/24px var(--font); color: var(--text); caret-color: var(--cobalt);
  background: var(--card); border: 1px solid var(--border-input); border-radius: var(--radius-btn);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.select { padding-right: 10px; }
.input::placeholder { color: var(--text-3); opacity: 1; }
.input:hover, .select:hover { border-color: var(--cobalt); }
/* the cobalt border plus ring is the focus indicator for text fields */
.input:focus, .select:focus { border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-ring); }
.input:focus-visible, .select:focus-visible { outline: none; }
.input[aria-invalid="true"] { border-color: var(--danger-text); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(187, 45, 38, .25); }
.input:disabled, .input[readonly] { background: var(--bg); }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.input-lg { height: 48px; }
.input-code { letter-spacing: .5em; text-indent: .5em; text-align: center; font-family: var(--mono); font-size: 22px; font-variant-numeric: tabular-nums; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; min-width: 0; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.form-grid .field + .field { margin-top: 0; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (min-width: 768px) { .form-grid { grid-template-columns: 1fr 1fr; } }

/* Card: paper on the ground, one hairline, no shadow */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.card h2, .card-head h2 { font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 600; letter-spacing: 0; }
.card h2 .icon, .card h3 .icon { width: 20px; height: 20px; color: var(--text-2); }
@media (max-width: 399px) { .card { padding: 20px; } }

/* Tag */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: var(--radius-pill);
  font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 500; white-space: nowrap;
}
/* status dot is opt-in: only tags that report a live state carry it */
.tag-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-success { background: var(--success-bg); color: var(--success-text); }
.tag-warning { background: var(--warning-bg); color: var(--warning-text); }
.tag-danger { background: var(--danger-bg); color: var(--danger-text); }
.tag-neutral { background: var(--neutral-bg); color: var(--text-2); }
.tag-primary { background: var(--cobalt-tint); color: var(--cobalt-press); }

/* Progress */
.progress { height: 6px; background: var(--neutral-bg); border-radius: var(--radius-pill); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--cobalt); border-radius: var(--radius-pill); transition: width var(--dur-slow) linear; }
/* indeterminate: a slow sweep while waiting on an outside answer; static under reduced motion */
.progress.is-indeterminate > span { width: 40%; animation: sweep 1.6s var(--ease-out) infinite; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.progress.is-low > span { background: var(--warning); }
.progress.is-empty > span { background: var(--danger); }

/* Table */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius-btn); background: var(--card); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.table th, .table td { height: 48px; padding: 0 16px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { height: 40px; background: var(--bg); color: var(--text-2); font-weight: 500; font-size: var(--fs-xs); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #F8F9FB; }
.table td.trunc { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.table .empty-cell { height: 128px; text-align: center; color: var(--text-3); }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 16px; color: var(--text-2); font-size: var(--fs-sm); }

/* Toast: under the header, overlay shadow */
.toast-root { position: fixed; top: calc(var(--header-h, 60px) + 12px); right: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 220px; max-width: 380px; padding: 12px 16px;
  background: var(--card); border-radius: var(--radius-card); box-shadow: var(--shadow-pop);
  font-size: var(--fs-sm); line-height: var(--lh-sm);
  pointer-events: auto; animation: toast-in var(--dur) var(--ease-out);
}
.toast .icon { margin-top: 3px; }
.toast-success .icon { color: var(--success); }
.toast-error .icon { color: var(--danger); }
.toast-info .icon { color: var(--cobalt); }
.toast-warning .icon { color: var(--warning); }
.toast.is-leaving { opacity: 0; transform: translateY(-4px); transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out); }
/* below 960 the header wraps to two rows (~98px); api.js measures the real bottom, this is only the fallback */
@media (max-width: 959px) { .toast-root { top: calc(var(--header-h, 98px) + 12px); } }
@media (max-width: 480px) { .toast-root { left: 16px; right: 16px; align-items: stretch; } .toast { max-width: 100%; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* Modal */
.modal-mask { position: fixed; inset: 0; z-index: 900; background: rgba(14, 26, 51, .5); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade-in var(--dur-fast) var(--ease-out); }
.modal { width: 100%; max-width: 440px; background: var(--card); border-radius: var(--radius-card); box-shadow: var(--shadow-pop); }
.modal-wide { max-width: 560px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; }
.modal-body { padding: 16px 24px; color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 24px 20px; }
.modal-close { width: 36px; height: 36px; padding: 0; color: var(--text-2); }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.copy-field { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-btn); }
.copy-field + .copy-field { margin-top: 8px; }
.copy-field code { flex: 1; min-width: 0; font-family: var(--mono); font-size: var(--fs-sm); color: var(--text); word-break: break-all; }

/* Empty / result state: centred in its card, 40px line icon, one title, one line, one action */
.state { text-align: center; padding: 40px 24px; }
.state .icon-xl { color: var(--text-3); margin-bottom: 16px; }
.state.is-warning .icon-xl { color: var(--warning); }
.state.is-danger .icon-xl { color: var(--danger); }
.state.is-success .icon-xl { color: var(--success); }
.state h1, .state h2, .state h3 { margin-bottom: 8px; }
.state h1 { font-size: var(--fs-lg); line-height: var(--lh-lg); letter-spacing: -0.01em; }
.state.is-success h1 { font-size: clamp(26px, 4.2vw, 32px); line-height: 1.25; }
.state > p { max-width: 30em; margin-left: auto; margin-right: auto; }
.state .amount-lg { font-weight: 650; font-variant-numeric: tabular-nums; }

.alert { display: flex; gap: 8px; padding: 12px 14px; border-radius: var(--radius-btn); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.alert-info { background: var(--cobalt-tint); color: var(--cobalt-press); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); }
.alert .icon { margin-top: 3px; flex: none; }

.footer { padding: 32px 16px 40px; text-align: center; color: var(--text-3); font-size: var(--fs-xs); line-height: var(--lh-xs); }

/* ===== Number ticket: navy stub, perforation, paper body (/, /me, /c/<token>) ===== */
.ticket { position: relative; border-radius: var(--radius-card); background: var(--card); box-shadow: var(--shadow); animation: ticket-print var(--dur-slow) var(--ease-out); }
@keyframes ticket-print { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.ticket-stub { position: relative; padding: 16px 20px 20px; border-radius: var(--radius-card) var(--radius-card) 0 0; background: var(--navy); color: #fff; overflow: hidden; }
.ticket-stub :focus-visible { outline-color: var(--navy-ring); }
.ticket-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; }
.ticket-svc { display: inline-flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 600; color: #fff; }
.ticket-svc .icon { width: 20px; height: 20px; color: var(--navy-text); }
.ticket-got { display: none; align-items: center; gap: 6px; color: #fff; font-size: var(--fs-sm); font-weight: 500; }
.ticket-got .icon { color: #5CC487; }
.ticket:has(#o-done:not([hidden])) .ticket-got { display: inline-flex; }
.ticket-wait { margin-top: 8px; }
.ticket-wait-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ticket-wait-text { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: var(--navy-text); font-size: var(--fs-sm); line-height: var(--lh-sm); }
.ticket-wait .waiting-dot { background: var(--navy-ring); flex: none; }
.ticket .countdown { display: inline-flex; align-items: center; gap: 6px; margin: 0; flex: none; color: #fff; font-size: var(--fs-body); font-weight: 600; font-variant-numeric: tabular-nums; }
.ticket .countdown .icon { color: var(--navy-text); }
/* the hold window as a 4px line along the stub's bottom edge */
/* phones: the service name gets its own line; the received status and the countdown drop below instead of squeezing it */
@media (max-width: 519px) {
  .ticket-head { flex-wrap: wrap; row-gap: 4px; }
  .ticket-svc { flex: 1 1 100%; }
  .ticket-got { white-space: nowrap; }
  .ticket-wait-row { flex-wrap: wrap; row-gap: 4px; }
  .ticket-wait-text { flex: 1 0 auto; max-width: 100%; }
}
.ticket-bar.progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; border-radius: 0; background: var(--navy-raised); }
.ticket-bar.progress > span { border-radius: 0; }
.ticket-bar.progress.is-low > span { background: var(--warning); }
/* perforation: a dashed tear line with a notch cut at each end */
.ticket-body { position: relative; padding: 20px; }
.ticket-body::before { content: ""; position: absolute; top: 0; left: 16px; right: 16px; border-top: 1px dashed var(--border-input); }
.ticket-body::after { content: ""; position: absolute; top: -6px; left: -6px; right: -6px; height: 12px; pointer-events: none;
  background: radial-gradient(circle at 6px 6px, var(--notch) 5.5px, transparent 6px), radial-gradient(circle at calc(100% - 6px) 6px, var(--notch) 5.5px, transparent 6px); }
.ticket .k { color: var(--text-2); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 500; margin-bottom: 4px; }
.ticket-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ticket-field > .hint { margin-top: 8px; }
.ticket-code { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); animation: code-in var(--dur) var(--ease-out); }
@keyframes code-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
#o-active > .btn-block { margin-top: 16px; }
#o-active > .btn-block + .btn-block { margin-top: 8px; }
.phone-num { font-family: var(--mono); font-size: 22px; line-height: 30px; font-weight: 600; letter-spacing: .02em; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
@media (min-width: 400px) { .phone-num { font-size: 26px; line-height: 34px; } }
.sms-code { font-family: var(--mono); font-size: 36px; line-height: 44px; font-weight: 650; letter-spacing: .14em; font-variant-numeric: tabular-nums; color: var(--success-text); }
@media (min-width: 360px) { .sms-code { font-size: var(--fs-code); line-height: var(--lh-code); } }
.waiting-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--cobalt); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }
details.full-sms { margin-top: 12px; }
details.full-sms summary { cursor: pointer; color: var(--cobalt); font-size: var(--fs-sm); width: max-content; max-width: 100%; }
details.full-sms summary:hover { color: var(--cobalt-press); }
details.full-sms p { margin-top: 8px; padding: 12px 14px; background: var(--bg); border-radius: var(--radius-btn); font-size: var(--fs-sm); word-break: break-word; }

/* Number blocks on pages that are not on the ticket markup */
.big-block { padding: 16px; background: var(--bg); border-radius: var(--radius-btn); }
.big-block + .big-block { margin-top: 12px; }
.big-block .k { color: var(--text-2); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 500; margin-bottom: 4px; }
.big-block .hint { margin-top: 8px; }
.big-block .row-between { flex-wrap: wrap; }
.countdown { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--text-2); font-size: var(--fs-xs); }
.countdown .progress { flex: 1; }
#o-waiting .row { align-items: flex-start; }
#o-waiting .row .waiting-dot { margin-top: 8px; flex: none; }

.history-list { list-style: none; margin: 0; padding: 0; }
.history-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.history-list li:last-child { border-bottom: 0; }
.user-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; color: var(--text-2); font-size: var(--fs-sm); }

/* ===== Shared-link page shell (phone-first) ===== */
.claim-shell { max-width: 592px; margin: 0 auto; padding: 24px 16px 0; }
.brandbar { display: flex; align-items: center; gap: 10px; height: 60px; font-weight: 600; font-size: var(--fs-md); }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--cobalt); color: #fff; flex: none; }
.brand-mark .icon { width: 18px; height: 18px; }
/* one column with a 16px rhythm; a closed or used-up share states its reason right under the title */
#app { display: flex; flex-direction: column; gap: 16px; }
#app > .claim-head { margin: 0; order: -2; }
#app > #v-state { order: -1; }
.batch-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.batch-meta > div { padding: 12px 14px; background: var(--bg); border-radius: var(--radius-btn); }
.batch-meta .k { color: var(--text-2); font-size: var(--fs-xs); line-height: var(--lh-xs); font-weight: 500; }
.batch-meta .v { margin-top: 2px; font-size: var(--fs-xl); line-height: var(--lh-xl); font-weight: 650; font-variant-numeric: tabular-nums; }
.domains { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 16px; }
/* sign-in progress bars (email, then code) */
/* step indicator: three circles; done = filled cobalt with a check, current = ringed cobalt, next = grey ring */
.step-ind { display: flex; align-items: center; flex-wrap: nowrap; gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; font-size: var(--fs-xs); line-height: var(--lh-xs); color: var(--text-3); }
.step-ind li { display: inline-flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; }
.step-ind li + li::before { content: ""; width: 12px; height: 1px; background: var(--border-strong); margin-right: 2px; flex: none; }
.step-ind .n { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--border-input); color: var(--text-3); font-weight: 600; font-size: var(--fs-xs); flex: none; }
.step-ind .n .icon { width: 14px; height: 14px; stroke-width: 2.25; vertical-align: 0; }
.step-ind .is-done .n { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.step-ind .is-done { color: var(--text-2); }
.step-ind .is-now .n { border-color: var(--cobalt); color: var(--cobalt); }
.step-ind .is-now { color: var(--text); font-weight: 500; }
/* sign-in variant: step 1 until the code is sent (otp-login marks #step2-bar.on), then step 2 */
.step-ind .step-first, .step-ind #step2-bar.on { color: var(--text); font-weight: 500; }
.step-ind .step-first .n, .step-ind #step2-bar.on .n { border-color: var(--cobalt); color: var(--cobalt); }
.step-ind .step-first .n .icon { display: none; }
.step-ind:has(#step2-bar.on) .step-first { color: var(--text-2); font-weight: 400; }
.step-ind:has(#step2-bar.on) .step-first .n { background: var(--cobalt); color: #fff; }
.step-ind:has(#step2-bar.on) .step-first .n-num { display: none; }
.step-ind:has(#step2-bar.on) .step-first .n .icon { display: inline; }

/* ===== Console layout (org / admin) ===== */
.console { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; padding: 0 16px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 50; }
.topbar .user-chip, .topbar .muted, .topbar .hint { color: var(--navy-text); }
.topbar .btn-text { color: #fff; }
.topbar .btn-text:hover { background: var(--navy-raised); color: #fff; }
.topbar .btn-secondary { background: transparent; border-color: var(--navy-text); color: #fff; }
.topbar .btn-secondary:hover { border-color: #fff; color: #fff; }
.topbar :focus-visible { outline-color: var(--navy-ring); }
.console-body { flex: 1; display: flex; min-height: 0; }
.sidenav { display: none; }
.sidenav a { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; margin: 2px 8px; border-radius: var(--radius-btn); color: var(--text); }
.sidenav a:hover { background: var(--neutral-bg); color: var(--text); text-decoration: none; }
.sidenav a.active { background: var(--cobalt-tint); color: var(--cobalt-press); font-weight: 500; }
.tabnav { display: flex; gap: 4px; padding: 8px 16px 0; overflow-x: auto; background: var(--card); border-bottom: 1px solid var(--border); }
.tabnav a { padding: 8px 12px; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabnav a.active { color: var(--cobalt); border-bottom-color: var(--cobalt); }
.main { flex: 1; min-width: 0; padding: 16px; }
.main > section + section { margin-top: 24px; }
.section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.toolbar .select { width: auto; min-width: 160px; }
.stat-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.stat { padding: 20px 24px; }
.stat .k { color: var(--text-2); font-size: var(--fs-xs); display: flex; align-items: center; gap: 6px; }
.stat .v { margin-top: 4px; font-size: var(--fs-xl); line-height: var(--lh-xl); font-weight: 650; font-variant-numeric: tabular-nums; }
.batch-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.batch-card .progress { margin: 12px 0 8px; }
.batch-card .nums { display: flex; justify-content: space-between; color: var(--text-2); font-size: var(--fs-xs); }
.batch-card .actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); }

@media (min-width: 768px) {
  .topbar { padding: 0 24px; }
  .tabnav { display: none; }
  .sidenav { display: block; width: var(--nav-w); flex: none; padding-top: 12px; background: var(--card); border-right: 1px solid var(--border); }
  .main { padding: 24px 32px 32px; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .batch-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1200px) {
  .batch-grid { grid-template-columns: repeat(3, 1fr); }
  .main { max-width: 1280px; }
}

/* Admin gate */
.gate { max-width: 400px; margin: 12vh auto 0; padding: 0 16px; }
.gate .card { padding: 32px 24px; }
.gate h2 { margin: 16px 0 4px; }

.card form > h2 + .hint, .card form > h3 + .hint, .card form > h2 + .muted, .card form > h3 + .muted { margin: 4px 0 16px; }
.card form > .btn-block { margin-top: 16px; }
/* stacked rhythm: nothing touches */
.btn-block + .hint, .btn-lg + .hint, .btn-lg + .btn-text { margin-top: 8px; }
p + .btn-block, .muted + .btn-block { margin-top: 12px; }
.card form .row-between { margin-top: 8px; }
#v-order > div > .btn-block { margin-top: 16px; }
#o-idle > .muted { margin: 0 0 12px; }
#o-idle > .muted:empty { display: none; }
#o-idle > .order-hint + .muted { margin-top: 8px; }
#o-idle > .muted + .btn-block { margin-top: 0; }
#o-idle > .hint { margin-top: 8px; text-align: center; }
#o-idle > .order-hint { margin-top: 0; text-align: left; }
#o-active { margin-top: 16px; }
.section-sub { margin: 24px 0 12px; }
.form-actions { display: flex; justify-content: flex-end; margin-top: 20px; }
form.card + form.card { margin-top: 16px; }
.stack-sm > * + * { margin-top: 12px; }
.modal-body .alert { margin-bottom: 16px; }
.modal-body p + p { margin-top: 8px; }
.modal-body .alert + p { margin-top: 0; }
.modal-body p.label { margin: 0 0 6px; color: var(--text); }
.table .row { flex-wrap: nowrap; gap: 0; }
.gate .brand-mark { width: 40px; height: 40px; border-radius: 10px; }
.gate .brand-mark .icon { width: 22px; height: 22px; }
.gate .field { margin-top: 20px; }
.gate .btn-block { margin-top: 20px; }
#v-error { margin-bottom: 24px; }
.modal-body .copy-field + p.label { margin-top: 16px; }
#otp-block { margin-bottom: 16px; }
.claim-head { margin: 0 0 16px; }
.claim-head h1 { margin: 0; font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 650; overflow-wrap: anywhere; }
.claim-head p { margin: 4px 0 0; overflow-wrap: anywhere; }
.svc-pick { margin-bottom: 12px; }
.svc-pick-label { margin-top: 16px; margin-bottom: 8px; }
.svc-pick-label + .svc-pick { margin-top: 0; }
#v-order > .row-between + .svc-pick { margin-top: 16px; }
.field-err { margin-top: 4px; }
.text-danger { color: var(--danger-text); }
.mb-16 { margin-bottom: 16px; }
/* invite code: collapsed by default */
details.promo-box { margin-top: 12px; }
details.promo-box summary { cursor: pointer; color: var(--cobalt); font-size: var(--fs-sm); width: max-content; max-width: 100%; }
details.promo-box summary:hover { color: var(--cobalt-press); }
.promo-form { display: flex; gap: 8px; margin-top: 8px; }
.promo-form .input { flex: 1; min-width: 0; }
.promo-result { margin-top: 8px; }
.promo-result.promo-ok { color: var(--success-text); font-weight: 600; }

/* Option cards (radio cards): /, /shop, /me and the claim page */
.opt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.opt { position: relative; display: block; cursor: pointer; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt-body {
  display: flex; flex-direction: column; gap: 2px; height: 100%;
  padding: 14px 16px; border: 1px solid var(--border-input); border-radius: var(--radius-card); background: var(--card);
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.opt:hover .opt-body { border-color: var(--cobalt); }
.opt input:checked + .opt-body, .opt.is-checked > .opt-body { border-color: var(--cobalt); background: var(--cobalt-tint); box-shadow: inset 0 0 0 1px var(--cobalt); }
.opt input:focus-visible + .opt-body { outline: var(--focus); outline-offset: var(--focus-offset); }
.opt-title { font-weight: 600; font-size: var(--fs-md); line-height: var(--lh-md); }
.opt-sub { color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); }

/* Switch: a checkbox with role=switch, drawn in CSS only */
input[role="switch"] {
  -webkit-appearance: none; appearance: none; flex: none;
  width: 44px; height: 24px; margin: 0; border-radius: var(--radius-pill); cursor: pointer;
  background: var(--border-input) radial-gradient(circle 10px at 12px 50%, #fff 9.5px, transparent 10px) no-repeat 0 0;
  transition: background-color var(--dur) var(--ease-out), background-position var(--dur) var(--ease-out);
}
input[role="switch"]:checked { background-color: var(--cobalt); background-position: 20px 0; }
input[role="switch"]:disabled {
  cursor: not-allowed; background-color: var(--neutral-bg); box-shadow: inset 0 0 0 1px var(--border-strong);
  background-image: radial-gradient(circle 10px at 12px 50%, var(--border-strong) 9.5px, transparent 10px);
}
input[role="switch"]:checked:disabled { background-color: var(--border-strong); background-image: radial-gradient(circle 10px at 12px 50%, #fff 9.5px, transparent 10px); }
.check.is-disabled { color: var(--text-2); cursor: not-allowed; }

/* Loading placeholder: a quiet block, no shimmer */
.skeleton { display: block; background: var(--neutral-bg); border-radius: var(--radius-inner); }

/* Code on screen: one large copy action and the "fill it in now" note */
.ticket-code .code-copy { min-width: 128px; }
.code-note { margin-top: 12px; color: var(--text); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 500; }

/* Retry facts under the get-number button */
#o-idle > .hint.o-retry { margin-top: 4px; }

/* FAQ (/, /c/<token>): facts-only disclosures with a hairline between items */
.faq { margin-top: 16px; }
#app > .faq { margin-top: 0; order: 4; }
#app > #v-history { order: 3; }
.faq h2 { font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 600; letter-spacing: 0; margin-bottom: 4px; }
.faq-item + .faq-item { border-top: 1px solid var(--border); }
.faq-item > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 12px 0; cursor: pointer; list-style: none; color: var(--text); font-size: var(--fs-body); line-height: var(--lh-body); font-weight: 500; border-radius: var(--radius-inner); }
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary:hover { color: var(--cobalt); }
.faq-item > summary .icon { color: var(--text-3); transition: transform var(--dur) var(--ease-out); }
.faq-item > summary:hover .icon { color: var(--cobalt); }
.faq-item[open] > summary .icon { transform: rotate(90deg); }
.faq-a { padding: 0 0 16px; color: var(--text-2); font-size: var(--fs-sm); line-height: var(--lh-sm); max-width: 36em; }
.faq-a ol { margin: 0; padding-left: 1.4em; }
.faq-a li + li { margin-top: 4px; }

/* Touch: every control reaches a usable target */
@media (pointer: coarse), (max-width: 640px) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; padding: 0 12px; }
  .btn-text, .btn-sm { position: relative; }
  .btn-text::after, .btn-sm::after { content: ""; position: absolute; inset: -4px 0; }
  details > summary { padding: 10px 0; }
}
@media (max-width: 399px) {
  .ticket-line .btn, .big-block .row-between .btn { flex: 1 0 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .waiting-dot { animation: none; opacity: 1; }
  .progress.is-indeterminate > span { animation: none; transform: none; width: 100%; opacity: .35; }
  html { scroll-behavior: auto; }
}
