/* ------------------------------------------------------------------
   Keymanager — flat, editorial, one accent colour.
   Tokens first, then layout, then components, then views.
   ------------------------------------------------------------------ */

:root {
  --bg: #f5f5f2;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --surface-3: #f0f0ec;
  --text: #131317;
  --text-dim: #5e5e69;
  --text-faint: #8b8b95;
  --search-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8b95' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.2'/%3E%3Cpath d='M15.2 15.2 20 20'/%3E%3C/svg%3E");
  --line: #e3e3dd;
  --line-strong: #cfcfc8;
  --accent: #3f46c9;
  --accent-hover: #333ab2;
  --accent-soft: #ecedfb;
  --accent-text: #ffffff;
  --danger: #ab3327;
  --danger-soft: #fbeeeb;
  --ok: #1b6f53;
  --ok-soft: #eaf4ef;
  --warn: #7d5410;
  --warn-soft: #fbf3e2;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --sidebar: 236px;
  --maxw: 940px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --shadow-overlay: 0 24px 60px -20px rgba(12, 12, 20, .35), 0 2px 8px rgba(12, 12, 20, .06);
  --ease: cubic-bezier(.2, .7, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0d10;
    --surface: #15151a;
    --surface-2: #1a1a20;
    --surface-3: #202028;
    --text: #f1f1ee;
    --text-dim: #a5a5b0;
    --text-faint: #7c7c88;
    --line: #25252c;
    --line-strong: #35353f;
    --accent: #9ba3ff;
    --accent-hover: #b0b6ff;
    --accent-soft: #1c1f36;
    --accent-text: #101018;
    --danger: #f0897d;
    --danger-soft: #2a1917;
    --ok: #71cfa9;
    --ok-soft: #12251f;
    --warn: #e0b978;
    --warn-soft: #241d10;
    --shadow-overlay: 0 30px 70px -24px rgba(0, 0, 0, .8);
  }
}

:root[data-theme="dark"] {
  --bg: #0d0d10;
  --surface: #15151a;
  --surface-2: #1a1a20;
  --surface-3: #202028;
  --text: #f1f1ee;
  --text-dim: #a5a5b0;
  --text-faint: #7c7c88;
  --line: #25252c;
  --line-strong: #35353f;
  --accent: #9ba3ff;
  --accent-hover: #b0b6ff;
  --accent-soft: #1c1f36;
  --accent-text: #101018;
  --danger: #f0897d;
  --danger-soft: #2a1917;
  --ok: #71cfa9;
  --ok-soft: #12251f;
  --warn: #e0b978;
  --warn-soft: #241d10;
  --shadow-overlay: 0 30px 70px -24px rgba(0, 0, 0, .8);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; overflow-x: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: .98rem; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.mono { font-family: var(--mono); font-variant-ligatures: none; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.small { font-size: .82rem; }
.tiny { font-size: .74rem; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; }
.row > svg { width: 16px; height: 16px; flex: 0 0 auto; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1 1 auto; min-width: 0; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.hidden { display: none !important; }
.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;
}

/* ---------------------------- boot ---------------------------- */
.boot {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; min-height: 100dvh; color: var(--text-faint);
}
.boot-text { font-size: .85rem; letter-spacing: .02em; }
.brand-mark { color: var(--accent); display: inline-flex; }
.brand-mark svg { width: 40px; height: 40px; display: block; }
.noscript { padding: 40px; text-align: center; }

/* --------------------------- app shell ------------------------- */
.app { display: block; }

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100dvh;
  display: flex; flex-direction: column;
  padding: 22px 14px 18px;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
}

.brand {
  display: flex; align-items: center; gap: 9px;
  padding: 4px 10px 22px;
  font-weight: 650; letter-spacing: -.02em; font-size: 1.02rem;
}
.brand .brand-mark { color: var(--accent); }
.brand .brand-mark svg { width: 24px; height: 24px; display: block; }

.nav-item svg { display: block; }
.user-chip svg { width: 15px; height: 15px; flex: 0 0 auto; color: var(--text-faint); display: block; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: .92rem; font-weight: 500;
  border: 1px solid transparent; background: none; cursor: pointer;
  text-align: left; width: 100%;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 auto; opacity: .85; }
.nav-item:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--surface); color: var(--text); border-color: var(--line); font-weight: 600; }
.nav-item.active svg { color: var(--accent); opacity: 1; }
.nav-count { margin-left: auto; font-size: .72rem; color: var(--text-faint); font-family: var(--mono); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding: 10px 4px 0; }
.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 9px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); min-width: 0;
}
.avatar {
  width: 27px; height: 27px; border-radius: 50%; flex: 0 0 auto;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: .78rem; font-weight: 700;
  text-transform: uppercase; font-family: var(--mono);
}

.main {
  min-width: 0;
  padding: 34px clamp(18px, 4vw, 46px) 96px;
}
.main-inner { max-width: var(--maxw); margin: 0 auto; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.page-head h1 { font-size: 1.45rem; }
.page-head .sub { color: var(--text-dim); font-size: .88rem; margin-top: 5px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* mobile header + tab bar */
.mobile-head { display: none; }
.tabbar { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .main { padding: 12px 16px calc(88px + env(safe-area-inset-bottom)); }
  .mobile-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 2px 14px;
  }
  .mobile-head .brand { padding: 0; font-size: .98rem; }
  .tabbar {
    display: flex; position: fixed; z-index: 40;
    left: 0; right: 0; bottom: 0;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 5px 2px; border-radius: var(--radius-xs);
    color: var(--text-faint); font-size: .66rem; font-weight: 600; letter-spacing: .01em;
  }
  .tabbar a svg { width: 20px; height: 20px; }
  .tabbar a.active { color: var(--accent); background: var(--accent-soft); text-decoration: none; }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 1.3rem; }
}

/* --------------------------- buttons --------------------------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-border: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--btn-border);
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: .88rem; font-weight: 560; letter-spacing: -.005em;
  cursor: pointer; white-space: nowrap;
  transition: background .12s var(--ease), border-color .12s var(--ease), opacity .12s;
}
.btn svg { width: 15px; height: 15px; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(.5px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  --btn-bg: var(--accent); --btn-fg: var(--accent-text); --btn-border: var(--accent);
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { --btn-bg: transparent; --btn-border: transparent; --btn-fg: var(--text-dim); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { --btn-fg: var(--danger); --btn-border: color-mix(in srgb, var(--danger) 32%, var(--line)); --btn-bg: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { min-height: 31px; padding: 0 10px; font-size: .81rem; border-radius: var(--radius-xs); }
.btn.sm svg { width: 13px; height: 13px; }
.btn.block { width: 100%; }
.btn.lg { min-height: 44px; font-size: .95rem; }
.icon-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: var(--radius-xs);
  border: 1px solid transparent; background: transparent; color: var(--text-faint);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

/* --------------------------- forms ---------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: .8rem; font-weight: 600; color: var(--text-dim); letter-spacing: .01em; }
.hint { font-size: .76rem; color: var(--text-faint); line-height: 1.45; }
.hint.error { color: var(--danger); }
.input, .textarea, .select {
  width: 100%; min-height: 40px; padding: 9px 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  transition: border-color .12s var(--ease), background .12s var(--ease);
  font-size: .92rem;
}
.input:hover, .textarea:hover, .select:hover { border-color: var(--text-faint); }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.textarea { min-height: 132px; resize: vertical; font-family: var(--mono); font-size: .82rem; line-height: 1.6; }
.select { appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.input-group { display: flex; gap: 6px; }
.input-group .input { flex: 1 1 auto; }
.form-grid { display: grid; gap: 14px; }
@media (min-width: 620px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }

.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-3); border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.segmented button {
  border: 0; background: transparent; color: var(--text-dim);
  padding: 6px 12px; border-radius: calc(var(--radius-sm) - 2px);
  font-size: .82rem; font-weight: 570; cursor: pointer; white-space: nowrap;
}
.segmented button[aria-selected="true"] {
  background: var(--surface); color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.segmented.full { display: flex; }
.segmented.full button { flex: 1; }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: .86rem; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 36px; height: 21px; border-radius: 999px; background: var(--line-strong);
  position: relative; transition: background .15s var(--ease); flex: 0 0 auto;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px;
  border-radius: 50%; background: var(--surface); transition: transform .15s var(--ease);
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(15px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --------------------------- surfaces -------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.card.tight { padding: 16px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.card-body { padding: 18px; }
.card-foot { padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface-2); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 10px; }

.divider { height: 1px; background: var(--line); border: 0; margin: 18px 0; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2);
  font-size: .72rem; font-weight: 600; color: var(--text-dim);
  font-family: var(--mono); letter-spacing: .01em; white-space: nowrap;
}
.chip.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); background: var(--accent-soft); }
.chip.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 28%, var(--line)); background: var(--ok-soft); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); background: var(--warn-soft); }
.chip.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); background: var(--danger-soft); }
.chip.plain { font-family: var(--sans); }

.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 44px 24px; text-align: center; color: var(--text-dim);
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--surface-2);
}
.empty h3 { color: var(--text); }
.empty p { font-size: .87rem; max-width: 40ch; }
.empty svg { width: 30px; height: 30px; color: var(--text-faint); }

/* --------------------------- key list -------------------------- */
.key-list { display: flex; flex-direction: column; }
.key-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 14px; align-items: center;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  transition: background .12s var(--ease);
}
.key-row:last-child { border-bottom: 0; }
.key-row:hover { background: var(--surface-2); }
.key-glyph {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-dim);
  border: 1px solid var(--line);
}
.key-glyph.pqc { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, var(--line)); }
.key-glyph svg { width: 18px; height: 18px; }
.key-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.key-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.key-title .name { font-weight: 600; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .74rem; color: var(--text-faint); }
.fp { font-family: var(--mono); font-size: .72rem; color: var(--text-dim); letter-spacing: .02em; }
.key-actions { display: flex; align-items: center; gap: 4px; }
.key-actions .btn { min-height: 30px; padding: 0 9px; font-size: .79rem; }
.menu {
  position: absolute; z-index: 60; min-width: 190px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 4px;
  box-shadow: var(--shadow-overlay);
}
.menu button {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border: 0; background: none; border-radius: var(--radius-xs);
  font-size: .85rem; text-align: left; cursor: pointer; color: var(--text);
}
.menu button:hover { background: var(--surface-3); }
.menu button.danger { color: var(--danger); }
.menu button svg { width: 14px; height: 14px; opacity: .8; }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 4px 0; }

@media (max-width: 620px) {
  .key-row { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; padding: 13px 14px; }
  .key-glyph { width: 34px; height: 34px; border-radius: 10px; }
  .key-actions .btn-label { display: none; }
}

/* --------------------------- dialogs --------------------------- */
dialog {
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  width: min(560px, calc(100vw - 28px));
  max-height: min(88dvh, 860px);
  box-shadow: var(--shadow-overlay);
}
dialog::backdrop { background: rgba(10, 10, 16, .42); backdrop-filter: blur(2px); }
dialog[open] { animation: dialog-in .18s var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.dialog-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 20px 22px 0;
}
.dialog-head h2 { font-size: 1.1rem; }
.dialog-head p { color: var(--text-dim); font-size: .85rem; margin-top: 4px; }
.dialog-body { padding: 18px 22px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; max-height: 62dvh; }
.dialog-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.dialog-foot.split { justify-content: space-between; }
.dialog.wide { width: min(720px, calc(100vw - 24px)); }

/* --------------------------- toast ----------------------------- */
.toasts {
  position: fixed; z-index: 90; right: 18px; bottom: 18px;
  display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 24px));
}
@media (max-width: 860px) { .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); left: 12px; right: 12px; max-width: none; } }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 13px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-overlay); font-size: .86rem;
  animation: toast-in .18s var(--ease);
}
.toast.err { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); background: var(--danger-soft); color: var(--danger); }
.toast.ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); background: var(--ok-soft); color: var(--ok); }
.toast svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* --------------------------- misc ------------------------------ */
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor; animation: spin .7s linear infinite;
  display: inline-block; flex: 0 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner.lg { width: 26px; height: 26px; border-width: 2.5px; }

.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .18s linear; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 26px 18px; text-align: center;
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--surface-2); cursor: pointer;
  transition: border-color .12s, background .12s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 24px; height: 24px; color: var(--text-faint); }
.dropzone .file-name { font-weight: 600; font-size: .9rem; }
.dropzone input[type=file] { display: none; }

pre.code, .code-block {
  margin: 0; padding: 13px 14px;
  background: var(--surface-3); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: .76rem; line-height: 1.55;
  overflow: auto; max-height: 220px; white-space: pre-wrap; word-break: break-all;
}

.alert {
  display: flex; gap: 10px; padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2); font-size: .85rem;
  color: var(--text-dim);
}
.alert svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 2px; }
.alert.warn { border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); background: var(--warn-soft); color: var(--warn); }
.alert.ok { border-color: color-mix(in srgb, var(--ok) 32%, var(--line)); background: var(--ok-soft); color: var(--ok); }
.alert.danger { border-color: color-mix(in srgb, var(--danger) 32%, var(--line)); background: var(--danger-soft); color: var(--danger); }

.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 18px; border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }
.list-row .label { font-weight: 560; font-size: .9rem; }
.list-row .meta { color: var(--text-faint); font-size: .76rem; margin-top: 2px; }

.kv { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 8px 14px; font-size: .85rem; }
.kv dt { color: var(--text-faint); }
.kv dd { margin: 0; min-width: 0; }

.section-title { font-size: .76rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 10px; }

/* --------------------------- auth ------------------------------ */
/* Flex + auto margins keeps the card dead centre on every engine, and still
   scrolls from the top instead of clipping when the viewport is short. */
.auth {
  min-height: 100dvh;
  width: 100%;
  display: flex;
  padding: 24px 18px;
  background: var(--bg);
}
.auth-card { width: min(420px, 100%); margin: auto; }
.auth-brand {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  margin-bottom: 26px; text-align: center;
}
.auth-brand h1 { font-size: 1.35rem; letter-spacing: -.03em; }
.auth-brand p { color: var(--text-dim); font-size: .87rem; }
.auth-panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 22px;
}
.auth-tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.auth-tabs button {
  flex: 1; padding: 10px 6px; border: 0; background: none; cursor: pointer;
  color: var(--text-faint); font-size: .88rem; font-weight: 570;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.auth-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.auth-foot { margin-top: 16px; text-align: center; }
.auth-alt { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--text-faint); font-size: .74rem; }
.auth-alt::before, .auth-alt::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.strength { display: flex; gap: 4px; margin-top: 7px; }
.strength span { height: 3px; flex: 1; border-radius: 2px; background: var(--line); }
.strength span.on { background: var(--accent); }
.strength span.warn { background: var(--warn); }
.strength span.bad { background: var(--danger); }

/* --------------------------- tools ----------------------------- */
.tool-grid { display: grid; gap: 18px; }
@media (min-width: 900px) { .tool-grid.split { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; } }
.recipient-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.recipient {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface);
  font-size: .8rem; color: var(--text-dim);
}
.recipient[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.recipient[disabled] { opacity: .38; cursor: not-allowed; }
.card-sep { height: 1px; background: var(--line); margin: 0; }
.list-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.list-toolbar .search-input { flex: 1 1 auto; max-width: 420px; padding-left: 36px;
  background-image: var(--search-glyph); background-repeat: no-repeat;
  background-position: 12px 50%; background-size: 15px 15px; }
.list-toolbar .search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
@media (max-width: 560px) { .list-toolbar .search-input { max-width: none; width: 100%; } }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 12px; font-size: .8rem; color: var(--text-faint); }
.pager.hidden { display: none; }
.pager-count { font-variant-numeric: tabular-nums; }
.pager-buttons { display: flex; align-items: center; gap: 8px; }
.pager-page { font-variant-numeric: tabular-nums; color: var(--text-dim); min-width: 3.2em; text-align: center; }
.pager .btn { padding: 5px 10px; }
.empty-row { padding: 28px 16px; text-align: center; color: var(--text-faint); font-size: .88rem; }
.recipient.contact { border-style: dashed; }
.recipient.contact[aria-pressed="true"] { border-style: solid; }
.recipient .fp-short { font-family: var(--mono); font-size: .7rem; opacity: .7; }
.recipient svg { width: 13px; height: 13px; flex: 0 0 auto; }
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.verify-status { display: flex; align-items: center; gap: 7px; font-size: .84rem; font-weight: 600; }
.verify-status.ok { color: var(--ok); }
.verify-status.bad { color: var(--danger); }
.verify-status.unknown { color: var(--warn); }

/* --------------------------- responsive tweaks ------------------ */
@media (max-width: 520px) {
  .card { padding: 16px; border-radius: 12px; }
  .page-actions .btn.primary { flex: 1; }
  .dialog-foot { flex-direction: column-reverse; }
  .dialog-foot .btn { width: 100%; }
  .kv { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}