/* TensorCash Verify portal styles.
   Drop-in replacement for portal/app/static/style.css.
   Keeps every existing class name; new ones are marked NEW.
   CSP-safe: no web fonts, no inline styles, no url() assets.
   The ALTCHA widget renders in the light DOM: element-wide input/button rules
   carry :not(altcha-widget *) so they don't restyle its checkbox. */

:root {
  --bg: #F7F8F9; --fg: #0F1115; --muted: #5B6168; --line: #D8DCDF; --card: #FFFFFF; --chip: #EEF0F2;
  --accent: #731D30; --accent-fg: #F7EEF0; --mark-dot: #E08496;
  --danger: #B3261E; --danger-bg: rgba(179,38,30,.07);
  --warn-bg: #FFF7E6; --warn-fg: #8A5300; --warn-line: #F0DDB5;
  --ok: #157F3B; --ok-bg: rgba(21,127,59,.10);
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --radius: 10px; --radius-lg: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E0F12; --fg: #F4F5F6; --muted: #8A9098; --line: #2A2E34; --card: #17191D; --chip: #1E2126;
    --accent: #C24A5E; --accent-fg: #231115; --mark-dot: #501421;
    --danger: #FF7B72; --danger-bg: rgba(255,123,114,.08);
    --warn-bg: #2A2312; --warn-fg: #E3B341; --warn-line: #4A3B17;
    --ok: #4CC27A; --ok-bg: rgba(76,194,122,.14);
    color-scheme: dark;
  }
}
/* Optional explicit themes: <html data-theme="light|dark|sober|sober-dark"> overrides the OS choice. */
[data-theme='light'] { --bg:#F7F8F9; --fg:#0F1115; --muted:#5B6168; --line:#D8DCDF; --card:#FFFFFF; --chip:#EEF0F2; --accent:#731D30; --accent-fg:#F7EEF0; --mark-dot:#E08496; --danger:#B3261E; --danger-bg:rgba(179,38,30,.07); --warn-bg:#FFF7E6; --warn-fg:#8A5300; --warn-line:#F0DDB5; --ok:#157F3B; --ok-bg:rgba(21,127,59,.10); color-scheme:light; }
[data-theme='dark'] { --bg:#0E0F12; --fg:#F4F5F6; --muted:#8A9098; --line:#2A2E34; --card:#17191D; --chip:#1E2126; --accent:#C24A5E; --accent-fg:#231115; --mark-dot:#501421; --danger:#FF7B72; --danger-bg:rgba(255,123,114,.08); --warn-bg:#2A2312; --warn-fg:#E3B341; --warn-line:#4A3B17; --ok:#4CC27A; --ok-bg:rgba(76,194,122,.14); color-scheme:dark; }
[data-theme='sober'] { --bg:#FFFFFF; --fg:#111111; --muted:#767676; --line:#E2E2E2; --card:#FFFFFF; --chip:#F2F2F2; --accent:#111111; --accent-fg:#FFFFFF; --mark-dot:#8A8A8A; --danger:#B3261E; --danger-bg:rgba(179,38,30,.06); --warn-bg:#FFF7E6; --warn-fg:#8A5300; --warn-line:#F0DDB5; --ok:#157F3B; --ok-bg:rgba(21,127,59,.10); color-scheme:light; }
[data-theme='sober-dark'] { --bg:#111111; --fg:#F2F2F2; --muted:#8F8F8F; --line:#2C2C2C; --card:#161616; --chip:#1F1F1F; --accent:#F2F2F2; --accent-fg:#111111; --mark-dot:#7A7A7A; --danger:#FF7B72; --danger-bg:rgba(255,123,114,.08); --warn-bg:#241F12; --warn-fg:#E3B341; --warn-line:#3E3417; --ok:#4CC27A; --ok-bg:rgba(76,194,122,.14); color-scheme:dark; }

* { box-sizing: border-box; }
body { margin: 0; }
body, [data-theme] {
  background: var(--bg); color: var(--fg);
  font: 15px/1.55 system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}
::selection { background: color-mix(in oklab, var(--accent) 25%, transparent); }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- header ---------- */
header.top {
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between;
  max-width: 1040px; margin: 0 auto; padding: 22px 24px;
}
.brand { display: inline-block; white-space: nowrap; color: var(--fg); text-decoration: none;
  font-weight: 650; font-size: 19px; letter-spacing: -0.022em; }
.brand:hover { text-decoration: none; }
.brand .dot { color: var(--accent); }                                  /* NEW */
.brand .product { font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent); margin-left: 10px; vertical-align: 1px; } /* NEW */
nav { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
nav a, nav button.link {
  display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 550;
  transition: color .15s, background .15s;
}
nav a:hover, nav button.link:hover { color: var(--fg); background: var(--chip); text-decoration: none; }
nav a[aria-current='page'] { color: var(--fg); background: var(--chip); }   /* NEW: active page */
nav form.inline { margin-left: 8px; padding-left: 12px; border-left: 1px solid var(--line); }

/* ---------- layout ---------- */
main { max-width: 1040px; margin: 0 auto; padding: 16px 24px 32px; }
footer { max-width: 1040px; margin: 0 auto; padding: 28px 24px 40px; color: var(--muted); font-size: 13px; }
footer p { margin: 0 0 8px; max-width: 620px; text-wrap: pretty; }
footer .links { font-family: var(--mono); font-size: 11px; letter-spacing: .06em; }
footer .links a { color: var(--muted); text-decoration: none; }
footer .links a:hover { color: var(--fg); }

h1 { font-size: 28px; font-weight: 650; letter-spacing: -0.028em; line-height: 1.2; margin: 8px 0 20px; text-wrap: balance; }
h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.015em; margin: 0 0 6px; }
main > h1 + .muted { margin-top: -12px; margin-bottom: 20px; }
p { margin: 0 0 12px; text-wrap: pretty; }
.card > :last-child { margin-bottom: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 24px; margin-bottom: 16px; overflow-x: auto; }
.narrow { max-width: 420px; margin: 40px auto; padding: 32px; }
.narrow h1 { font-size: 24px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* NEW: the tc. mark (sign-in, verify, redeem, error) */
.mark { width: 48px; height: 48px; border-radius: 11px; background: var(--accent); color: var(--accent-fg);
  display: flex; align-items: center; justify-content: center; white-space: nowrap; font-weight: 650; font-size: 21px; letter-spacing: -0.02em; }
.mark .dot { color: var(--mark-dot); }

/* ---------- forms ---------- */
label { display: block; margin: 14px 0 6px; font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
input:not([type="checkbox"]):not(altcha-widget *) {
  width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: var(--fg); font: inherit; font-size: 15px; transition: border-color .15s;
}
input:not([type="checkbox"]):not(altcha-widget *):hover { border-color: color-mix(in oklab, var(--line), var(--fg) 20%); }
input:not([type="checkbox"]):not(altcha-widget *):focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent); }
input:not(altcha-widget *)::placeholder { color: var(--muted); opacity: .8; }
input[autocomplete="one-time-code"]:not(altcha-widget *) { font-family: var(--mono); font-size: 22px; letter-spacing: .4em; text-align: center; height: 54px; }

button:not(altcha-widget *) {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 16px; height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: var(--radius); cursor: pointer;
  background: var(--accent); color: var(--accent-fg); font: inherit; font-size: 14.5px; font-weight: 650;
  transition: opacity .15s, background .15s, border-color .15s, color .15s;
}
button:not(altcha-widget *):hover { opacity: .9; }
button:not(altcha-widget *):active { opacity: .8; }
button:not(altcha-widget *):disabled { cursor: default; background: var(--chip); color: var(--muted); }
.narrow form > button { width: 100%; }
button.danger { background: transparent; color: var(--danger); border-color: var(--danger); margin: 0; height: 32px; padding: 0 12px; font-size: 13px; }
button.danger:hover { background: var(--danger-bg); opacity: 1; }
button.link { background: none; color: var(--fg); height: auto; padding: 0; margin: 0; font-weight: 550; }
form.inline { display: inline; margin: 0; }
form.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 14px; }
form.row input { flex: 1 1 260px; }
form.row button { margin: 0; }
.captcha { margin-top: 14px; }
/* ALTCHA widget theming via its own CSS variables (no inline styles needed).
   Names are those of the vendored altcha 3.x. Its derived variables (border, input,
   spinner, popover colours) are resolved on :root by altcha.css, so they are set here
   too rather than inherited from the base ones. */
altcha-widget {
  --altcha-max-width: 100%; --altcha-padding: 12px;
  --altcha-border-width: 1px; --altcha-border-radius: var(--radius);
  --altcha-border-color: var(--line); --altcha-popover-color: var(--line);
  --altcha-color-base: var(--bg); --altcha-color-base-content: var(--fg);
  --altcha-color-neutral: var(--line); --altcha-color-neutral-content: var(--muted);
  --altcha-color-primary: var(--accent); --altcha-color-primary-content: var(--accent-fg);
  --altcha-color-success: var(--ok); --altcha-color-success-content: var(--card);
  --altcha-color-error: var(--danger); --altcha-color-error-content: var(--card);
  --altcha-input-background-color: var(--card); --altcha-input-color: var(--fg);
  --altcha-checkbox-size: 20px; --altcha-checkbox-border-radius: 6px;
  --altcha-checkbox-border-color: color-mix(in oklab, var(--line), var(--fg) 25%);
  --altcha-checkbox-outline-color: var(--accent); --altcha-spinner-color: var(--accent);
  --altcha-switch-background-color: var(--line);
  --altcha-shadow: none;
}

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
th { font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding-top: 4px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.ua { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
tr.revoked td { color: var(--muted); }
tr.revoked td code { text-decoration: line-through; text-decoration-color: color-mix(in oklab, var(--muted) 60%, transparent); }
table + p.muted { margin-top: 16px; font-size: 13px; }

code { font-family: var(--mono); font-size: .86em; }
td code { padding: 2px 7px; border-radius: 6px; background: var(--chip); }
code.big { display: block; font-size: 15px; padding: 14px 16px; background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); word-break: break-all; color: var(--fg); }

/* ---------- badges & messages ---------- */
.badge { display: inline-block; height: 24px; line-height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--chip); color: var(--muted); }
.badge::before { content: ''; display: inline-block; vertical-align: 1px; margin-right: 6px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.on { background: var(--ok-bg); color: var(--ok); }
.badge.off { background: var(--chip); color: var(--muted); }
.badge.pending { background: var(--warn-bg); color: var(--warn-fg); white-space: normal; height: auto; line-height: 1.35; padding: 4px 10px; border-radius: 10px; max-width: 220px; }
.badge .countdown { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.notice, .warning { padding: 12px 16px; border-radius: var(--radius); margin: 0 0 16px; font-size: 14px; border: 1px solid transparent; }
.notice { background: var(--ok-bg); color: var(--fg); border-color: color-mix(in oklab, var(--ok) 25%, transparent); }
.warning { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-line); }
.maintenance { background: var(--warn-bg); color: var(--warn-fg); border-bottom: 1px solid var(--warn-line);
  margin: 0; padding: 10px 24px; text-align: center; font-size: 13.5px; font-weight: 600; }
.error { color: var(--danger); font-weight: 550; font-size: 14px; }
p.error[role="alert"] { padding: 10px 14px; border-radius: var(--radius); background: var(--danger-bg); }

/* ---------- usage ---------- */
.tabs { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.tabs a { display: inline-flex; align-items: center; height: 30px; padding: 0 14px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 550; }
.tabs a:hover { color: var(--fg); }
.tabs a.active { color: var(--accent-fg); background: var(--accent); }
.stats { display: flex; flex-wrap: wrap; gap: 48px; margin-bottom: 24px; }
.stats .num { display: block; font-size: 38px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats .label { font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }

/* ---------- specific cards ---------- */
.endpoint { background: color-mix(in oklab, var(--accent) 5%, var(--card)); border-color: color-mix(in oklab, var(--accent) 22%, var(--line)); }
.endpoint code.big { background: var(--card); border-color: color-mix(in oklab, var(--accent) 22%, var(--line)); }
.danger-zone { border-color: color-mix(in oklab, var(--danger) 45%, var(--line)); }
.danger-zone h2 { color: var(--danger); }
.card form:not(.inline) > button.danger { margin-top: 16px; height: 40px; padding: 0 16px; font-size: 14px; }
.card h2 + table, .card p + table { margin-top: 8px; }
.card table + form { margin-top: 16px; }
.card h2:not(:first-child) { margin-top: 24px; }
td:has(> form.inline) { text-align: right; }
.danger-zone form { max-width: 420px; }
.narrow form + p { margin-top: 16px; }
.legal { max-width: 720px; }
.legal h1 { margin-top: 0; }
.legal h2 { margin-top: 24px; font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.legal hr { border: 0; height: 1px; background: var(--line); margin: 32px 0; }
.legal table { margin: 8px 0 16px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (max-width: 640px) {
  header.top { padding: 16px; }
  main { padding: 8px 16px 24px; }
  footer { padding: 24px 16px 32px; }
  .card { padding: 18px; }
  .narrow { margin: 16px auto; padding: 24px; }
  h1 { font-size: 24px; }
  nav form.inline { margin-left: 0; padding-left: 0; border-left: 0; }
}
