/* Mail console. Brand: ink #15131C, amber #EDB55A (dark primary), amber-dark #8A5A12 (light
   primary), record red #E5484D reserved for danger. No hover underlines anywhere: links and
   buttons shift colour and background instead. */

:root {
  --ink: #15131C;
  --amber: #EDB55A;
  --amber-dark: #8A5A12;
  --record: #E5484D;

  --bg: #F3F2F6;
  --surface: #FFFFFF;
  --surface-2: #F8F7FA;
  --sunken: #EFEDF3;
  --text: #15131C;
  --muted: #5E5A69;
  --faint: #8A8696;
  --line: #E4E1EA;
  --line-strong: #CFCBD8;

  --primary: #8A5A12;
  --primary-hover: #744A0C;
  --primary-press: #633F09;
  --on-primary: #FFFFFF;
  --primary-soft: #F6ECDC;
  --primary-soft-2: #EEDDBF;
  --primary-text: #7A4F0F;

  --danger: #E5484D;
  --danger-hover: #CF3439;
  --danger-text: #B8262C;
  --danger-soft: #FDECEC;
  --ok: #1D7A4B;
  --ok-soft: #E3F3EA;
  --warn: #8F5A00;
  --warn-soft: #FBF0DA;

  --focus: #8A5A12;
  --focus-halo: rgba(138, 90, 18, .22);

  --shadow-sm: 0 1px 2px rgba(21, 19, 28, .05), 0 1px 1px rgba(21, 19, 28, .03);
  --shadow-md: 0 1px 2px rgba(21, 19, 28, .04), 0 6px 20px -8px rgba(21, 19, 28, .14);
  --shadow-lg: 0 2px 6px rgba(21, 19, 28, .06), 0 28px 64px -16px rgba(21, 19, 28, .34);
  --backdrop: rgba(21, 19, 28, .48);

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 16px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15131C;
    --surface: #1D1A26;
    --surface-2: #221F2D;
    --sunken: #17151F;
    --text: #EEEBF3;
    --muted: #A7A2B3;
    --faint: #7C7789;
    --line: #2E2A3A;
    --line-strong: #433E52;

    --primary: #EDB55A;
    --primary-hover: #F3C77D;
    --primary-press: #F7D59A;
    --on-primary: #15131C;
    --primary-soft: rgba(237, 181, 90, .12);
    --primary-soft-2: rgba(237, 181, 90, .2);
    --primary-text: #EDB55A;

    --danger: #E5484D;
    --danger-hover: #EE5D62;
    --danger-text: #FF8A8E;
    --danger-soft: rgba(229, 72, 77, .15);
    --ok: #63D39A;
    --ok-soft: rgba(99, 211, 154, .12);
    --warn: #EDB55A;
    --warn-soft: rgba(237, 181, 90, .13);

    --focus: #EDB55A;
    --focus-halo: rgba(237, 181, 90, .28);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -10px rgba(0, 0, 0, .6);
    --shadow-lg: 0 2px 8px rgba(0, 0, 0, .4), 0 30px 70px -18px rgba(0, 0, 0, .8);
    --backdrop: rgba(8, 7, 12, .66);

    color-scheme: dark;
  }
}

/* ---------------------------------------------------------------- base */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 26px; letter-spacing: -.02em; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
code { font-family: var(--mono); font-size: .88em; background: var(--sunken); padding: 1px 5px; border-radius: 6px; }

a { color: var(--primary-text); text-decoration: none; border-radius: 4px; transition: color .12s, background-color .12s; }
a:hover { color: var(--primary-hover); text-decoration: none; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* Headings take focus only so screen readers land somewhere sensible after a change. */
h1[tabindex="-1"]:focus, h1[tabindex="-1"]:focus-visible { outline: none; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.offscreen { position: absolute !important; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.muted { color: var(--muted); }
.mono-sm { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }

.icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: middle; }
.icon-muted { color: var(--faint); }
.icon-xl { width: 40px; height: 40px; }

.stack { display: flex; flex-direction: column; gap: 18px; }
.stack-tight { display: flex; flex-direction: column; gap: 8px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* ---------------------------------------------------------------- buttons */

.btn {
  --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--line-strong);
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px;
  font: inherit; font-weight: 600; font-size: 14.5px; line-height: 1;
  color: var(--btn-fg); background: var(--btn-bg);
  border: 1px solid var(--btn-bd); border-radius: var(--r-sm);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .14s, border-color .14s, color .14s, box-shadow .14s, transform .06s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 5px var(--focus-halo); }
.btn:disabled { cursor: default; opacity: .5; }
.btn .icon { width: 17px; height: 17px; }

.btn.primary { --btn-bg: var(--primary); --btn-fg: var(--on-primary); --btn-bd: var(--primary); box-shadow: var(--shadow-sm); }
.btn.primary:hover:not(:disabled) { --btn-bg: var(--primary-hover); --btn-bd: var(--primary-hover); }
.btn.primary:active:not(:disabled) { --btn-bg: var(--primary-press); }

.btn.secondary { --btn-bg: var(--surface); --btn-fg: var(--text); --btn-bd: var(--line-strong); box-shadow: var(--shadow-sm); }
.btn.secondary:hover:not(:disabled) { --btn-bg: var(--primary-soft); --btn-bd: var(--primary); --btn-fg: var(--primary-text); }

.btn.ghost { --btn-bg: transparent; --btn-fg: var(--muted); --btn-bd: var(--line); }
.btn.ghost:hover:not(:disabled) { --btn-bg: var(--sunken); --btn-fg: var(--text); --btn-bd: var(--line-strong); }

.btn.quiet { --btn-bg: transparent; --btn-fg: var(--muted); --btn-bd: transparent; font-weight: 550; }
.btn.quiet:hover:not(:disabled) { --btn-bg: var(--sunken); --btn-fg: var(--text); }

.btn.danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-bd: var(--danger); }
.btn.danger:hover:not(:disabled) { --btn-bg: var(--danger-hover); --btn-bd: var(--danger-hover); }
.btn.danger:focus-visible { outline-color: var(--danger); box-shadow: 0 0 0 5px var(--danger-soft); }

.btn.danger-ghost { --btn-bg: transparent; --btn-fg: var(--danger-text); --btn-bd: var(--line); }
.btn.danger-ghost:hover:not(:disabled) { --btn-bg: var(--danger-soft); --btn-bd: var(--danger); }

.btn.danger-outline { --btn-bg: transparent; --btn-fg: var(--danger-text); --btn-bd: color-mix(in srgb, var(--danger) 55%, transparent); }
.btn.danger-outline:hover:not(:disabled) { --btn-bg: var(--danger-soft); --btn-bd: var(--danger); }
.btn.danger-outline:focus-visible { outline-color: var(--danger); box-shadow: 0 0 0 5px var(--danger-soft); }

.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn-md { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn-md .icon { width: 16px; height: 16px; }
.btn-lg { min-height: 48px; padding: 0 20px; font-size: 15.5px; border-radius: 12px; }
.btn-block { width: 100%; }

/* Loading state: the label fades and a spinner takes its place. */
.btn.is-busy { cursor: progress; opacity: 1; }
.btn.is-busy > * { visibility: hidden; }
.btn.is-busy::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px;
  border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Progress with words ("Deleting…"): the label stays, a spinner leads it. */
.btn.is-progress { cursor: progress; }
.btn.is-progress:disabled { opacity: .88; }
.btn.is-progress::before {
  content: ""; width: 15px; height: 15px; border-radius: 50%; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}

.icon-btn {
  position: relative;
  display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0;
  color: var(--muted); background: transparent; border: 1px solid transparent; border-radius: 10px;
  cursor: pointer; transition: background-color .14s, color .14s, border-color .14s;
}
.icon-btn:hover:not(:disabled) { background: var(--sunken); color: var(--text); border-color: var(--line); }
.icon-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.icon-btn .icon { width: 19px; height: 19px; }
.icon-btn.is-busy { cursor: progress; }
.icon-btn.is-busy .icon { animation: spin .8s linear infinite; }

/* Tooltips from data-tip, shown on hover and keyboard focus. */
[data-tip] { position: relative; }
[data-tip]:not([data-tip=""])::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 8px); left: 50%; transform: translate(-50%, -3px);
  padding: 5px 9px; border-radius: 7px; z-index: 30;
  font: 500 12.5px/1.3 var(--font); white-space: nowrap; letter-spacing: 0;
  color: var(--bg); background: var(--text); box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s;
}
[data-tip]:not([data-tip=""]):hover::after,
[data-tip]:not([data-tip=""]):focus-visible::after { opacity: 1; transform: translate(-50%, 0); transition-delay: .25s; }
.btn.is-busy[data-tip]::after { visibility: visible; }
/* Touch screens have no hover, and a hidden tooltip still takes room at the page edge. */
@media (hover: none), (max-width: 760px) { [data-tip]::after { display: none; } }

/* ---------------------------------------------------------------- fields */

.field { display: flex; flex-direction: column; gap: 7px; }
.field > label, .filter-field > label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.field-sep { padding-top: 16px; border-top: 1px dashed var(--line-strong); }

input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; min-width: 0; min-height: 44px; padding: 10px 13px;
  font: inherit; font-size: 15px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  transition: border-color .14s, box-shadow .14s, background-color .14s;
}
input::placeholder { color: var(--faint); }
input:hover:not(:focus), select:hover:not(:focus) { border-color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 4px var(--focus-halo); }
input[aria-invalid=true] { border-color: var(--danger); }
input[aria-invalid=true]:focus { box-shadow: 0 0 0 4px var(--danger-soft); }
select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }

.hint { font-size: 13px; color: var(--muted); }
.field-error { font-size: 13px; color: var(--danger-text); font-weight: 500; }

.form-error {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px; border-radius: var(--r-sm);
  color: var(--danger-text); background: var(--danger-soft);
  font-size: 14px; font-weight: 500; line-height: 1.45;
}
.notice {
  padding: 10px 12px; border-radius: var(--r-sm); margin-bottom: 18px;
  color: var(--primary-text); background: var(--primary-soft); font-size: 14px; font-weight: 500;
}

.input-wrap { position: relative; }
.input-wrap input { padding-right: 48px; }
.reveal {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 36px; height: 36px; padding: 0;
  color: var(--muted); background: transparent; border: 0; border-radius: 8px; cursor: pointer;
  transition: background-color .12s, color .12s;
}
.reveal:hover { background: var(--sunken); color: var(--text); }
.reveal:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.reveal[data-tip]::after { top: auto; bottom: calc(100% + 6px); }
.reveal.reveal { position: absolute; }

.pin-input { font-family: var(--mono); font-size: 20px !important; letter-spacing: .3em; }
.pin-input::placeholder { letter-spacing: normal; }

.input-suffix { display: flex; align-items: stretch; }
.input-suffix input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-suffix > span {
  display: grid; place-items: center; padding: 0 13px; font-size: 14px; color: var(--muted);
  background: var(--sunken); border: 1px solid var(--line-strong); border-left: 0;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.input-suffix-sm input { width: 96px; min-height: 36px; padding: 6px 10px; }
.input-suffix-sm > span { font-size: 13.5px; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 550; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); cursor: pointer; }

/* Password strength */
.meter { display: flex; flex-direction: column; gap: 6px; }
.meter-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.meter-seg { height: 4px; border-radius: 2px; background: var(--line); transition: background-color .2s; }
.meter-text { font-size: 12.5px; color: var(--muted); min-height: 1.4em; }
.meter-label { font-weight: 650; }
.meter.s0 .meter-seg.on, .meter.s1 .meter-seg.on { background: var(--danger); }
.meter.s0 .meter-label, .meter.s1 .meter-label { color: var(--danger-text); }
.meter.s2 .meter-seg.on { background: var(--warn); }
.meter.s2 .meter-label { color: var(--warn); }
.meter.s3 .meter-seg.on, .meter.s4 .meter-seg.on { background: var(--ok); }
.meter.s3 .meter-label, .meter.s4 .meter-label { color: var(--ok); }

/* ---------------------------------------------------------------- boot + origin */

.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }
.boot-mark { width: 56px; height: 56px; color: var(--primary); animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }

.solo { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--ink); }
.solo-card {
  max-width: 520px; padding: 40px 36px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 16px; align-items: flex-start;
}
.solo-card p { color: var(--muted); }
.solo-card strong { color: var(--text); font-weight: 650; word-break: break-all; }
.solo-mark { width: 44px; height: 44px; color: var(--primary); margin-bottom: 4px; }

/* ---------------------------------------------------------------- sign in */

.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 44fr) 56fr; }

/* The brand panel is an emblem: the grid, the name and one neutral line, centred on the ink. */
.auth-brand {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 44px 52px; color: #EEEBF3;
  background: radial-gradient(52% 38% at 50% 44%, rgba(237, 181, 90, .11), transparent 72%), var(--ink);
  border-right: 1px solid rgba(255, 255, 255, .06);
}
.auth-brand-top { display: none; align-items: center; gap: 12px; width: 100%; }
.auth-brand-mark { width: 26px; height: 26px; color: var(--amber); }
.wordmark { font-size: 21px; font-weight: 700; letter-spacing: -.01em; }
.wordmark-sub { margin-left: auto; font-size: 13px; font-weight: 550; color: #A7A2B3; }
.auth-brand-body { display: flex; flex-direction: column; align-items: center; gap: 44px; width: 100%; margin-top: -4vh; }
.auth-grid { width: min(52%, 200px); height: auto; color: var(--amber); }
.auth-brand-name { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.auth-name { font-size: 44px; line-height: 1; font-weight: 700; letter-spacing: -.03em; color: #F4F1F8; }
.auth-product {
  display: inline-flex; align-items: center; gap: 12px;
  font-size: 12.5px; font-weight: 650; letter-spacing: .18em; text-transform: uppercase; color: rgba(237, 181, 90, .78);
}
/* A short rule either side of the product line. */
.auth-product::before, .auth-product::after { content: ""; width: 28px; height: 1px; background: rgba(237, 181, 90, .4); }

.cell-key { transform-box: fill-box; transform-origin: center; }

.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 48px 24px; }
.auth-card {
  width: 100%; max-width: 440px; padding: 36px 36px 32px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-md);
}
.auth-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.auth-sub { color: var(--muted); font-size: 15px; }
.auth-foot { font-size: 13px; color: var(--faint); }

/* Step indicator: the steps sit on a running line. */
.steps { list-style: none; margin: -6px 0 24px; padding: 0; display: flex; align-items: center; gap: 0; }
.step { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--faint); }
.step + .step::before {
  content: ""; width: 36px; height: 2px; margin: 0 10px; border-radius: 1px; background: var(--line-strong);
}
.step-dot {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  font-size: 12px; font-weight: 700; border: 1.5px solid var(--line-strong); color: var(--faint);
}
.step-dot .icon { width: 14px; height: 14px; }
.step-done { color: var(--muted); }
.step-done .step-dot { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.step-done + .step::before { background: var(--primary); }
.step-current { color: var(--text); }
.step-current .step-dot { border-color: var(--primary); color: var(--primary-text); box-shadow: 0 0 0 4px var(--primary-soft); }

/* Key step: the keyhole cell breathes while the browser waits for the key. */
.key-step { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.key-grid { width: 96px; height: auto; color: var(--primary); margin: 6px 0 10px; }
.key-step.is-waiting .cell-key { animation: keycell 1.6s ease-in-out infinite; }
.key-step.is-failed .key-grid { color: var(--faint); }
@keyframes keycell { 50% { opacity: .35; transform: scale(.86); } }
.key-step h2 { font-size: 20px; }
.key-text { color: var(--muted); max-width: 34ch; }
.key-step .form-error { text-align: left; width: 100%; }
.key-step .stack-tight { width: 100%; margin-top: 8px; }

/* ---------------------------------------------------------------- app shell */

.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  padding: 0 28px; min-height: 64px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); padding: 4px 6px; margin-left: -6px; border-radius: 10px; }
.brand:hover { color: var(--text); background: var(--sunken); }
.brand-mark { width: 24px; height: 24px; color: var(--primary); }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand-sub { color: var(--muted); font-size: 15px; }

.tabs { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.tab {
  display: inline-flex; align-items: center; min-height: 38px; padding: 0 14px;
  font-size: 14.5px; font-weight: 600; color: var(--muted); border-radius: 10px; white-space: nowrap;
}
.tab:hover { color: var(--text); background: var(--sunken); }
.tab[aria-current=page] { color: var(--primary-text); background: var(--primary-soft); }
.tab:focus-visible { outline-offset: 0; }

.who { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.who-name {
  display: inline-flex; align-items: center; gap: 7px; padding: 0 10px 0 4px;
  font-size: 14px; font-weight: 600; color: var(--text); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.who-name .icon { color: var(--faint); }

.content { width: 100%; max-width: 1180px; margin: 0 auto; padding: 36px 28px 96px; flex: 1; }

.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.view-head > div:first-child { min-width: 0; flex: 1 1 380px; }
.view-sub { margin-top: 6px; color: var(--muted); max-width: 72ch; }
.view-actions { display: flex; align-items: center; gap: 10px; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: 22px 24px; margin-bottom: 20px;
}
.panel-flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-head .muted { margin-top: 4px; font-size: 14px; max-width: 60ch; }
.panel > .table-wrap { margin: -22px -24px; border-radius: inherit; }
.panel.detail > .table-wrap { margin: 0 -24px; }
.panel-flush > .table-wrap { margin: 0; border-radius: var(--r-lg) var(--r-lg) 0 0; }

/* ---------------------------------------------------------------- tables */

/* position: relative keeps absolutely positioned descendants (the .sr-only header labels) inside
   the scroller; without it they widen the page on phones. */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table th:first-child, .table td:first-child { padding-left: 24px; }
.table th:last-child, .table td:last-child { padding-right: 24px; }
.table thead th { font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--surface-2); letter-spacing: .01em; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background-color .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.actions { text-align: right; width: 1%; }
.cell-strong { font-weight: 600; }
.cell-strong > * + * { margin-left: 8px; }
.cell-strong .icon { margin-right: 2px; }
.table tr.is-muted td { color: var(--faint); }

.table-click tbody tr { cursor: pointer; }
.table-click tbody tr.is-selected { background: var(--primary-soft); }
.table-click tbody tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.table-click tbody tr.is-new { animation: arrive 2.6s ease-out; }
@keyframes arrive {
  0%, 30% { background: var(--primary-soft-2); }
  100% { background: var(--primary-soft); }
}

.usage { min-width: 190px; }
.usage-text { font-size: 13px; font-variant-numeric: tabular-nums; margin-bottom: 6px; }
.usage-bar {
  display: block; width: 100%; height: 6px; border: 0; border-radius: 3px; overflow: hidden;
  appearance: none; -webkit-appearance: none; background: var(--sunken); color: var(--primary);
}
.usage-bar::-webkit-progress-bar { background: var(--sunken); border-radius: 3px; }
.usage-bar::-webkit-progress-value { background: var(--primary); border-radius: 3px; }
.usage-bar::-moz-progress-bar { background: var(--primary); border-radius: 3px; }
.usage-bar.high::-webkit-progress-value { background: var(--warn); }
.usage-bar.high::-moz-progress-bar { background: var(--warn); }
.usage-bar.full::-webkit-progress-value { background: var(--danger); }
.usage-bar.full::-moz-progress-bar { background: var(--danger); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; min-height: 22px; padding: 0 9px;
  font-size: 12.5px; font-weight: 650; border-radius: 999px; white-space: nowrap; vertical-align: middle;
  color: var(--muted); background: var(--sunken);
}
.badge:empty { display: none; }
.badge-ok { color: var(--ok); background: var(--ok-soft); }
.badge-warn { color: var(--warn); background: var(--warn-soft); }
.badge-danger { color: var(--danger-text); background: var(--danger-soft); }
.badge-muted { color: var(--muted); background: var(--sunken); }
.badge-accent { color: var(--primary-text); background: var(--primary-soft); }
h2 .badge { margin-left: 8px; }

.chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; min-height: 24px;
  font-size: 12.5px; font-weight: 600; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px;
}
.chip .icon { width: 13px; height: 13px; color: var(--primary-text); }

.empty { padding: 44px 24px; text-align: center; color: var(--muted); }
.empty-title { font-size: 16px; font-weight: 650; color: var(--text); margin-bottom: 6px; }
.empty-inline { color: var(--muted); font-size: 14px; padding: 16px 0 4px; }

/* ---------------------------------------------------------------- account detail */

.detail { padding-bottom: 22px; }
.detail .panel-head { padding-bottom: 18px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.detail .panel-head h2 { font-size: 20px; }
.detail .mono-sm { margin-top: 4px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 36px; }
.detail-grid h3 { font-size: 15.5px; }
.detail-grid .muted { font-size: 14px; }
.invite-out {
  display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap;
  padding: 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r);
}
#qr { display: block; width: 200px; height: 200px; background: #fff; border-radius: 12px; border: 1px solid var(--line); image-rendering: pixelated; }
.invite-meta { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 200px; }
.invite-code-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.code { font-family: var(--mono); font-size: 22px; font-weight: 600; letter-spacing: .08em; user-select: all; word-break: break-all; }
.invite-meta .row-wrap { margin-top: 10px; }
.devices-title { margin: 30px 0 10px; font-size: 15.5px; }

/* Danger zone: set apart at the bottom of the account, red only in its outline and title. */
.danger-zone { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.danger-zone h3 { margin-bottom: 12px; font-size: 15.5px; color: var(--danger-text); }
.danger-row {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px;
  padding: 16px 18px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--line));
  background: color-mix(in srgb, var(--danger-soft) 45%, transparent);
}
.danger-text { min-width: 0; flex: 1 1 280px; }
.danger-name { font-weight: 650; }
.danger-text .muted { font-size: 14px; }

/* A deleted row folds away before the list is redrawn. */
.table tbody tr.is-removing, .table tbody tr.is-removing:hover { background: var(--danger-soft); }
.cell-collapse { overflow: hidden; }

/* Delete dialog */
.dlg-head.dlg-head-icon { flex-direction: row; align-items: center; gap: 14px; }
.dlg-head-icon h2 { min-width: 0; overflow-wrap: anywhere; }
.dlg-text { font-size: 14.5px; line-height: 1.55; }
.del-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.del-fact { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.del-fact dt { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.del-fact dd { margin: 2px 0 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.dlg-note { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; color: var(--muted); }
.dlg-note .icon { width: 16px; height: 16px; margin-top: 2px; }
.del-name {
  font-family: var(--mono); font-size: .95em; font-weight: 650; padding: 1px 6px; border-radius: 6px;
  color: var(--text); background: var(--sunken); overflow-wrap: anywhere; user-select: all;
}
.match-mark {
  position: absolute; right: 14px; top: 50%; display: grid; place-items: center; pointer-events: none;
  color: var(--ok); opacity: 0; transform: translateY(-50%) scale(.6); transition: opacity .15s, transform .15s;
}
.input-wrap.is-match .match-mark { opacity: 1; transform: translateY(-50%) scale(1); }
.input-wrap.is-match input { border-color: var(--ok); }

/* ---------------------------------------------------------------- security */

/* One centred column of settings cards. Spacing scale: 4, 8, 12, 16, 20, 24. Every card has the
   same head: icon tile, title (+ state pill), one-line description, actions on the right. */
.view-narrow { max-width: 760px; margin-left: auto; margin-right: auto; }
.sec-stack { display: flex; flex-direction: column; gap: 16px; }

.card {
  position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); padding: 24px;
}

.setting-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; }
.setting-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.setting-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.setting-text h2 { font-size: 16.5px; }
.setting-desc { color: var(--muted); font-size: 14px; line-height: 1.5; text-wrap: pretty; }
.setting-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.setting-body { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.setting-note { margin-top: 12px; font-size: 13.5px; color: var(--muted); }

.tile {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 12px;
  color: var(--primary-text); background: var(--primary-soft);
}
.tile .icon { width: 22px; height: 22px; }
.tile-danger { color: var(--danger-text); background: var(--danger-soft); }
.tile-ok { color: var(--ok); background: var(--ok-soft); }

/* State pills: a dot and a word, never colour alone. */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px 0 9px;
  font-size: 12.5px; font-weight: 650; line-height: 1; white-space: nowrap;
  border: 1px solid transparent; border-radius: 999px;
}
.pill:empty { display: none; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill-on { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 28%, transparent); }
.pill-off { color: var(--muted); background: var(--surface-2); border-color: var(--line-strong); }
.pill-off::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.pill-plain { color: var(--text); background: var(--sunken); border-color: var(--line); padding: 0 10px; font-variant-numeric: tabular-nums; }
.pill-plain::before { display: none; }

/* Summary: the factors in the order they are asked. */
.factors {
  list-style: none; margin: 20px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px;
}
.factor {
  position: relative; min-width: 0;
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
}
.factor + .factor::before {
  content: ""; position: absolute; left: -19px; top: 50%; width: 7px; height: 7px;
  border-top: 2px solid var(--line-strong); border-right: 2px solid var(--line-strong);
  transform: translate(0, -50%) rotate(45deg);
}
.factor-mark { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; }
.factor-mark .icon { width: 16px; height: 16px; }
.factor-text { display: flex; flex-direction: column; min-width: 0; }
.factor-name { font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.factor-state { font-size: 12.5px; color: var(--muted); }
.factor.is-on .factor-mark { color: var(--surface); background: var(--ok); }
.factor.is-on .factor-state { color: var(--ok); font-weight: 600; }
.factor.is-off { background: transparent; border-style: dashed; border-color: var(--line-strong); }
.factor.is-off .factor-mark { color: var(--faint); background: var(--sunken); }
.factor.is-off .factor-name { color: var(--muted); }

.sum-hint {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  margin-top: 16px; padding: 12px 12px 12px 16px; border-radius: 12px;
  font-size: 14px; color: var(--text); background: var(--primary-soft);
}
.sum-hint > .icon { color: var(--primary-text); }
.sum-hint strong { font-weight: 650; }

/* Security keys */
.key-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.key-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 12px 12px 12px 16px; transition: background-color .12s;
}
.key-row + .key-row { border-top: 1px solid var(--line); }
.key-row:hover { background: var(--surface-2); }
.key-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--muted); background: var(--sunken); }
.key-main { min-width: 0; }
.key-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key-meta { font-size: 13px; color: var(--muted); }
.key-meta .sep { margin: 0 6px; color: var(--faint); }
.key-meta > span:not(.sep) { white-space: nowrap; }

.key-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 8px 12px 4px; }
.empty-art {
  display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 10px; border-radius: 50%;
  color: var(--primary-text); background: var(--primary-soft);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--primary-soft) 45%, transparent), 0 0 0 16px color-mix(in srgb, var(--primary-soft) 20%, transparent);
}
.empty-art .icon { width: 30px; height: 30px; }
.key-empty .empty-title { margin: 0; }
.empty-text { max-width: 50ch; font-size: 14px; color: var(--muted); }
.key-empty .btn { margin-top: 12px; }

/* Auto-lock presets: a radio group drawn as a segmented control. */
.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px;
  min-width: 0; margin: 0; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--sunken);
}
.seg { position: relative; display: block; min-width: 0; cursor: pointer; }
.seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.seg span {
  display: flex; align-items: center; justify-content: center; height: 36px; padding: 0 4px; border-radius: 9px;
  font-size: 13.5px; font-weight: 600; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.seg:hover span { color: var(--text); background: color-mix(in srgb, var(--surface) 55%, transparent); }
.seg input:checked + span { color: var(--primary-text); background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line-strong); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
.segmented + .form-error { margin-top: 12px; }

.save-status {
  display: inline-flex; align-items: center; gap: 6px; min-height: 24px;
  font-size: 13px; font-weight: 600; color: var(--muted); opacity: 0; transition: opacity .2s;
}
.save-status.is-shown { opacity: 1; }
.save-status.is-saved { color: var(--ok); }
.save-status .icon { width: 16px; height: 16px; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite;
}

.sec-foot { display: flex; align-items: flex-start; justify-content: center; gap: 8px; padding: 4px 8px 0; font-size: 13px; color: var(--faint); text-align: center; }
.sec-foot .icon { width: 16px; height: 16px; margin-top: 2px; }

/* Loading skeleton, shaped like the cards it stands in for. */
.skel { display: block; position: relative; overflow: hidden; border-radius: 8px; background: var(--sunken); }
.skel::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 55%, transparent), transparent);
  animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-tile { width: 44px; height: 44px; border-radius: 12px; }
.skel-lines { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.skel-line { height: 11px; }
.skel-line:first-child { height: 15px; }
.skel-w20 { width: 20%; } .skel-w25 { width: 25%; } .skel-w30 { width: 30%; } .skel-w60 { width: 60%; } .skel-w70 { width: 70%; }
.skel-btn { width: 112px; height: 36px; border-radius: 10px; }
.skel-factors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin-top: 20px; }
.skel-block { height: 56px; border-radius: 12px; }

.sec-failed .tile { align-self: start; }

/* ---------------------------------------------------------------- audit */

.chain { padding: 18px 22px; }
.chain-head { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.chain-fact { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.chain-k { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.chain-v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hash-btn {
  font: 600 15px/1.3 var(--mono); color: var(--text); background: transparent; border: 0; padding: 2px 6px; margin-left: -6px;
  border-radius: 7px; cursor: pointer; text-align: left; transition: background-color .12s, color .12s;
}
.hash-btn:hover { background: var(--sunken); color: var(--primary-text); }
.hash-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.hash-btn[data-tip]::after { white-space: normal; width: max-content; max-width: min(90vw, 560px); word-break: break-all; font-family: var(--mono); left: 0; transform: translate(0, -3px); }
.hash-btn[data-tip]:hover::after, .hash-btn[data-tip]:focus-visible::after { transform: translate(0, 0); }
#audit-verify { margin-left: auto; }

.verify { margin-top: 16px; padding: 14px 16px; border-radius: var(--r); display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; }
.verify-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.verify-when { font-size: 12.5px; opacity: .8; }
.verify-running { background: var(--sunken); color: var(--muted); }
.verify-ok { background: var(--ok-soft); color: var(--text); }
.verify-ok .verify-title { color: var(--ok); }
.verify-warn { background: var(--warn-soft); color: var(--text); }
.verify-warn .verify-title { color: var(--warn); }
.verify-bad { background: var(--danger-soft); color: var(--text); }
.verify-bad .verify-title { color: var(--danger-text); }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin: 0 0 14px; }
.filter-search { position: relative; flex: 2 1 280px; }
.filter-search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.filter-search input { padding-left: 38px; }
.filter-field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 170px; }
.filter-field > label { font-size: 12.5px; color: var(--muted); }
.filters input, .filters select { min-height: 40px; padding-top: 8px; padding-bottom: 8px; font-size: 14px; }
.filters .check { min-height: 40px; }
.filter-count { margin-left: auto; min-height: 40px; display: flex; align-items: center; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.audit-table { font-size: 13.5px; }
.audit-table td { padding-top: 9px; padding-bottom: 9px; }
.audit-row { cursor: pointer; }
.audit-row:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.audit-row[aria-expanded=true] { background: var(--surface-2); }
.audit-row.is-failure td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.cell-time { font-variant-numeric: tabular-nums; color: var(--muted); }
.cell-what { max-width: 460px; overflow: hidden; text-overflow: ellipsis; }
.actor { display: inline-flex; align-items: baseline; gap: 6px; }
.actor-kind { font-size: 12px; color: var(--faint); }
.actor-who { font-weight: 600; }
.kind { font-size: 13px; font-weight: 600; }
.kind-http { color: var(--muted); }
.kind-event { color: var(--primary-text); font-family: var(--mono); font-size: 12.5px; }
.what { display: inline-flex; align-items: baseline; gap: 8px; min-width: 0; }
.what-fields { color: var(--muted); font-family: var(--mono); font-size: 12.5px; white-space: pre; }
.method { font: 700 11.5px/1 var(--mono); padding: 3px 6px; border-radius: 5px; background: var(--sunken); color: var(--muted); }
.method-post, .method-put, .method-patch { color: var(--primary-text); background: var(--primary-soft); }
.method-delete { color: var(--danger-text); background: var(--danger-soft); }
.path { font-family: var(--mono); font-size: 12.5px; }
.audit-detail td { background: var(--surface-2); padding: 4px 24px 16px !important; white-space: normal; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 20px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; word-break: break-all; }
.audit-foot { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 58px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }

/* ---------------------------------------------------------------- lock screen */

.lock {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto;
  display: grid; place-items: center; padding: 24px 16px; background: var(--ink);
}
.lock::before {
  content: ""; position: fixed; left: 0; right: 0; top: 50%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(237, 181, 90, .25) 25%, rgba(237, 181, 90, .25) 75%, transparent);
}
.lock-card {
  position: relative; width: 100%; max-width: 400px; padding: 36px 32px 24px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  background: var(--surface); border-radius: 22px; box-shadow: var(--shadow-lg);
}
.lock-mark { width: 40px; height: 40px; color: var(--primary); margin-bottom: 6px; }
.lock-card h1 { font-size: 22px; }
.lock-reason { color: var(--muted); font-size: 14.5px; }
.lock-user {
  display: inline-flex; align-items: center; gap: 8px; margin: 8px 0 12px; padding: 6px 14px 6px 8px;
  font-weight: 650; border-radius: 999px; background: var(--sunken);
}
.lock-user .icon { color: var(--primary-text); }
.lock-card form { width: 100%; text-align: left; }
.lock-card #lock-signout { margin-top: 6px; }
.key-inline { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--primary-soft); color: var(--primary-text); font-weight: 600; font-size: 14px; }
.key-inline .icon { animation: breathe 1.2s ease-in-out infinite; }

/* ---------------------------------------------------------------- dialogs */

.dlg {
  width: min(520px, calc(100vw - 32px)); max-width: none; max-height: calc(100vh - 48px);
  padding: 0; border: 1px solid var(--line); border-radius: 18px;
  color: var(--text); background: var(--surface); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(6px) scale(.965);
  transition: opacity .18s ease, transform .18s cubic-bezier(.2, .8, .2, 1);
}
.dlg-sm { width: min(430px, calc(100vw - 32px)); }
.dlg::backdrop { background: var(--backdrop); opacity: 0; transition: opacity .18s ease; }
.dlg.is-open { opacity: 1; transform: none; }
.dlg.is-open::backdrop { opacity: 1; }
.dlg.is-closing { transition-duration: .15s; }
.dlg-body { display: flex; flex-direction: column; gap: 18px; padding: 26px 26px 22px; }
.dlg-head { display: flex; flex-direction: column; gap: 6px; }
.dlg-head h2 { font-size: 19px; }
.dlg-sub { color: var(--muted); font-size: 14.5px; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.key-touch { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 18px 0 6px; }
.key-touch .icon-xl { color: var(--primary); animation: breathe 1.2s ease-in-out infinite; margin-bottom: 4px; }
.key-touch-title { font-weight: 700; font-size: 16px; }

@media (prefers-reduced-motion: reduce) {
  .dlg, .dlg::backdrop { transition: none; transform: none; }
  .key-step.is-waiting .cell-key,
  .boot-mark, .key-inline .icon, .key-touch .icon-xl, .table-click tbody tr.is-new { animation: none; }
  .skel::after { animation: none; }
  .toast, .save-status, .seg span, .match-mark { transition: none; }
  *, *::before, *::after { scroll-behavior: auto !important; }
}

/* ---------------------------------------------------------------- toasts */

.toasts {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 12px;
  font-size: 14.5px; font-weight: 550; color: var(--bg); background: var(--text); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: auto;
}
.toast.in { opacity: 1; transform: none; }
.toast-icon { color: var(--primary); }
@media (prefers-color-scheme: dark) { .toast-icon { color: var(--amber-dark); } }
.toast-bad { background: var(--danger); color: #fff; }
.toast-bad .toast-icon { color: #fff; }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1000px) {
  .auth { grid-template-columns: 1fr 1.3fr; }
  .auth-brand { padding: 36px 36px; }
  .detail-grid { grid-template-columns: 1fr; gap: 28px; }
  .auth-name { font-size: 38px; }
}

@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; gap: 0 12px; padding: 8px 16px 0; }
  .tabs { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; padding: 6px 0 8px; margin: 0 -4px; }
  .tabs::-webkit-scrollbar { display: none; }
  .who-name { display: none; }
  .tab { padding: 0 11px; font-size: 14px; }
}

@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-brand {
    padding: 20px 20px; flex-direction: row; align-items: center; gap: 16px;
    background: var(--ink); border-right: 0; border-bottom: 1px solid rgba(255, 255, 255, .07);
  }
  .auth-brand-top { display: flex; }
  .auth-brand-body { display: none; }
  .auth-main { justify-content: flex-start; padding: 24px 16px 40px; }
  .auth-card { padding: 26px 20px 22px; border-radius: 18px; }
  h1 { font-size: 23px; }
  .content { padding: 24px 16px 80px; }
  .panel { padding: 18px 16px; border-radius: var(--r); }
  .panel > .table-wrap { margin: -18px -16px; }
  .panel.detail > .table-wrap { margin: 0 -16px; }
  .card { padding: 18px 16px; }
  .setting-head { grid-template-columns: auto minmax(0, 1fr); gap: 12px 14px; }
  .setting-actions { grid-column: 2 / -1; justify-content: flex-start; }
  .setting-actions-status { position: absolute; top: 18px; right: 16px; }
  .tile { width: 40px; height: 40px; }
  .tile .icon { width: 20px; height: 20px; }
  .setting-body { margin-top: 16px; padding-top: 16px; }
  .factors { grid-template-columns: 1fr; gap: 18px; margin-top: 16px; }
  .factor + .factor::before { left: 27px; top: -13px; transform: rotate(135deg); }
  .skel-factors { grid-template-columns: 1fr; gap: 10px; }
  .sum-hint { grid-template-columns: auto minmax(0, 1fr); padding: 12px 14px; }
  .sum-hint .btn { grid-column: 2; justify-self: start; }
  .segmented { grid-auto-flow: row; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .setting-head { align-items: start; }
  .setting-text { padding-top: 1px; }
  .key-row { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 12px; }
  .key-icon { display: none; }
  .factor { padding: 10px 12px; }
  .sec-foot { justify-content: flex-start; text-align: left; padding: 0 4px; }
  .danger-row { padding: 14px; }
  .danger-row .btn { width: 100%; }
  .del-facts { grid-template-columns: 1fr; gap: 8px; }
  .del-fact { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 14px; }
  .del-fact dd { margin: 0; font-size: 17px; }
  .panel-flush { padding: 0; }
  .panel-flush > .table-wrap { margin: 0; }
  .table th:first-child, .table td:first-child { padding-left: 16px; }
  .table th:last-child, .table td:last-child { padding-right: 16px; }
  .view-head { align-items: flex-start; }
  .chain-head { gap: 16px 24px; }
  #audit-verify { margin-left: 0; width: 100%; }
  .filter-count { margin-left: 0; flex-basis: 100%; min-height: 0; }
  .dlg-body { padding: 22px 18px 18px; }
  .lock-card { padding: 30px 20px 20px; }
  #qr { width: 180px; height: 180px; }
  .step + .step::before { width: 20px; margin: 0 8px; }
}
