/* ZK Vault v2: all styling lives here so the page runs under a strict CSP (style-src 'self'). */

:root {
  color-scheme: dark;
  --bg: #0f1117;
  --bg-card: #1a1d27;
  --bg-input: #12151f;
  --bg-raised: #232736;
  --border: #2a2d3a;
  --border-strong: #3a3f52;
  --text: #e8eaf0;
  --text-muted: #8890a4;
  --accent: #4f7ef8;
  --accent-hover: #6b95ff;
  /* Deeper accent for filled buttons so white labels keep a 4.5:1 contrast ratio. */
  --accent-strong: #3563e9;
  --accent-strong-hover: #2c55cf;
  --accent-soft: rgba(79, 126, 248, 0.12);
  --success: #2dd4a1;
  --success-soft: rgba(45, 212, 161, 0.12);
  --error: #f87171;
  --error-soft: rgba(248, 113, 113, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.1);
  --focus-ring: #8fb0ff;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

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

[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

h1, h2, h3, p, ul, ol, dl, dd, fieldset { margin: 0; }
h1 { font-size: 1.5rem; line-height: 1.25; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; line-height: 1.3; }
h3 { font-size: 0.95rem; }
strong { font-weight: 650; }
button, input { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.muted { color: var(--text-muted); }
.mono { font-family: var(--mono); font-size: 0.85em; }
.lead { color: var(--text-muted); font-size: 1rem; }
.hint { color: var(--text-muted); font-size: 0.85rem; }
.subhead { font-size: 0.95rem; margin-top: 8px; }

/* ── Layout ─────────────────────────────────────────────────────────────── */

.app {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 16px 32px;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 0 20px;
}
.brand-mark { width: 36px; height: 36px; flex: none; }
.brand-name { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; }
.brand-tag { color: var(--text-muted); font-size: 0.82rem; }

.app-main { display: block; }

.screen { display: flex; flex-direction: column; gap: 20px; }
.screen-narrow { max-width: 520px; margin: 0 auto; }
.screen-medium { max-width: 800px; margin: 0 auto; }

.app-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card-hero { padding: 28px; gap: 20px; }
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-head > h1 { flex: 1 1 0; min-width: 0; }
.card-head > h1 + .btn { align-self: flex-start; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.bullets { padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.bullets li::marker { color: var(--text-muted); }

/* ── Status (single live region) ───────────────────────────────────────── */

/* In the normal page flow on purpose: a sticky or fixed banner would sit on top of instructions and buttons,
   especially on phones. app.js scrolls it into view for errors and warnings instead. */
.status-wrap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 auto 16px;
  scroll-margin: 8px;
  padding: 12px 12px 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  border-left-width: 4px;
  background: #1d2130;
  box-shadow: var(--shadow);
}
.status-wrap:has(.status:empty) { display: none; }
.status { flex: 1; font-size: 0.92rem; }
.status strong { font-weight: 700; }
.status-wrap:has(.status[data-tone="info"]) { border-color: rgba(79, 126, 248, 0.5); border-left-color: var(--accent); }
.status-wrap:has(.status[data-tone="success"]) { border-color: rgba(45, 212, 161, 0.4); border-left-color: var(--success); }
.status-wrap:has(.status[data-tone="warning"]) { border-color: rgba(251, 191, 36, 0.4); border-left-color: var(--warning); }
.status-wrap:has(.status[data-tone="error"]) { border-color: rgba(248, 113, 113, 0.5); border-left-color: var(--error); background: #2a1c22; }
.status[data-tone="error"] strong { color: var(--error); }
.status[data-tone="warning"] strong { color: var(--warning); }
.status-close {
  flex: none;
  width: 32px;
  height: 32px;
  margin: -4px -4px -4px 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.status-close:hover { background: var(--bg-raised); color: var(--text); }
/* As wide as the screen it belongs to. */
.app-main[data-screen="unlock"] .status-wrap,
.app-main[data-screen="unsupported"] .status-wrap { max-width: 520px; }
.app-main[data-screen="setup"] .status-wrap { max-width: 800px; }

/* ── Notices ───────────────────────────────────────────────────────────── */

.notice {
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: 0.9rem;
}
.notice-warning { background: var(--warning-soft); border-color: rgba(251, 191, 36, 0.35); }
.notice-warning strong, .notice-title { color: var(--warning); }
.notice-error { background: var(--error-soft); border-color: rgba(248, 113, 113, 0.4); color: var(--error); }
.notice-title { font-weight: 650; margin-bottom: 6px; }

/* The warning before a key's last attempt, with its confirmation checkbox; red when the vault is at stake. Its title
   (the key and its vault) stands out in that colour; the explanation reads as plain text, as in the status notices. */
.last-attempt { display: flex; flex-direction: column; gap: 10px; }
.last-attempt p { color: var(--text); }
.last-attempt p strong { font-weight: 650; }
.last-attempt.notice-error p strong { color: var(--error); }
.last-attempt.notice-warning p strong { color: var(--warning); }
.last-attempt label { color: var(--text); }

/* ── Forms ─────────────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, legend {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

input[type="text"], input[type="password"] {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:hover, input[type="password"]:hover { border-color: #4a5068; }
input[type="text"]:focus-visible, input[type="password"]:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 126, 248, 0.35);
}

.secret-input { display: flex; }
.secret-input input { border-top-right-radius: 0; border-bottom-right-radius: 0; min-width: 0; }
.reveal {
  flex: none;
  min-width: 64px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--bg-raised);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.reveal:hover { color: var(--text); }

input[type="radio"], input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  flex: none;
  accent-color: var(--accent);
}

.choices {
  border: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.choices legend { grid-column: 1 / -1; padding: 0; margin-bottom: 10px; }
.choice {
  display: flex;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-input);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.choice:hover { border-color: #4a5068; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice:has(input:focus-visible) { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.choice input:focus-visible { outline: none; }
.choice-body { display: flex; flex-direction: column; gap: 6px; }
.choice-title { font-weight: 650; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.choice-text { color: var(--text-muted); font-size: 0.87rem; }

.check-field { display: flex; gap: 10px; align-items: flex-start; }
.check-field label { cursor: pointer; }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.tag-muted { background: var(--bg-raised); color: var(--text-muted); }

.checklist {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg-input);
  border: 1px solid var(--border);
  font-size: 0.87rem;
  color: var(--text-muted);
}
.checklist-title { color: var(--text); font-weight: 600; margin-bottom: 6px; }

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: 0.85rem; }
.btn-primary { background: var(--accent-strong); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong-hover); }
.btn-secondary { background: var(--bg-raised); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: #2c3143; }
.btn-danger { background: var(--error-soft); border-color: rgba(248, 113, 113, 0.35); color: var(--error); }
.btn-danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.22); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--bg-raised); }

@media (pointer: coarse) {
  .btn-small { min-height: 44px; }
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-hover);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link:disabled { opacity: 0.5; cursor: not-allowed; }

.spinner {
  display: inline-block;
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.working { display: flex; align-items: center; gap: 10px; color: var(--accent-hover); font-size: 0.9rem; }

/* ── Unlock ────────────────────────────────────────────────────────────── */

.how-steps {
  padding: 16px 16px 16px 36px;
  border-radius: var(--radius);
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.how-steps li::marker { color: var(--accent-hover); font-weight: 700; }

.explain { font-size: 0.88rem; color: var(--text-muted); }
.explain summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
  padding: 4px 0;
  border-radius: var(--radius-sm);
}
.explain p { margin-top: 10px; }

.below-card { text-align: center; color: var(--text-muted); }

.shamir-progress { display: flex; flex-direction: column; gap: 14px; }

.key-pills {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.key-pills li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-input);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.key-pills li[data-state="done"] { border-color: rgba(45, 212, 161, 0.5); color: var(--success); }
.key-pills li[data-state="done"] .key-letter { background: var(--success-soft); color: var(--success); }

/* ── Key letter badge (mirrors the physical A/B/C labels) ──────────────── */

.key-letter {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-weight: 750;
  font-size: 1rem;
}

/* ── Setup stepper ─────────────────────────────────────────────────────── */

.stepper {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.stepper li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 3px solid var(--border-strong);
  color: var(--text-muted);
  font-size: 0.85rem;
  min-width: 0;
}
.stepper-num {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  font-size: 0.75rem;
  font-weight: 700;
}
.stepper-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepper li[data-state="current"] { border-top-color: var(--accent); color: var(--text); font-weight: 600; }
.stepper li[data-state="current"] .stepper-num { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.stepper li[data-state="done"] { border-top-color: var(--success); color: var(--text); }
.stepper li[data-state="done"] .stepper-num { background: var(--success); border-color: var(--success); color: var(--bg); font-size: 0; }
.stepper li[data-state="done"] .stepper-num::before { content: "\2713"; font-size: 0.8rem; }

.deadline:empty { display: none; }

.setup-panel { display: flex; flex-direction: column; gap: 16px; }

.pin-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pin-card {
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 0.87rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pin-card:first-child { border-color: rgba(79, 126, 248, 0.45); }
.pin-card-title { color: var(--text); font-weight: 650; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.key-cards {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.key-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-input);
  transition: border-color 0.15s, opacity 0.15s;
}
.key-card-head { display: flex; align-items: center; gap: 12px; }
.key-card-title { font-size: 1rem; }
.key-card-status { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.key-card-text { font-size: 0.87rem; color: var(--text-muted); }
.key-card-error { font-size: 0.87rem; color: var(--error); }
.key-card-actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; }
.key-card[data-state="waiting"] { opacity: 0.6; }
.key-card[data-state="current"], .key-card[data-state="working"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.key-card[data-state="current"] .key-letter, .key-card[data-state="working"] .key-letter {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}
.key-card[data-state="working"] .key-card-status { color: var(--accent-hover); }
.key-card[data-state="done"] { border-color: rgba(45, 212, 161, 0.5); }
.key-card[data-state="done"] .key-letter { background: var(--success-soft); border-color: rgba(45, 212, 161, 0.5); color: var(--success); }
.key-card[data-state="done"] .key-card-status { color: var(--success); }
.key-card[data-state="error"] { border-color: rgba(248, 113, 113, 0.6); }
.key-card[data-state="error"] .key-card-status { color: var(--error); }

.done-head { display: flex; align-items: center; gap: 12px; }
.done-mark { width: 40px; height: 40px; flex: none; }
.done-head h2 { font-size: 1.25rem; }

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.facts div {
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--bg-input);
  border: 1px solid var(--border);
}
.facts dt { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }
.key-labels { overflow-wrap: anywhere; }

/* ── Vault ─────────────────────────────────────────────────────────────── */

.vault-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.vault-bar > div { min-width: 0; }
.vault-bar > .btn { flex: none; }
.vault-tag { margin-top: 2px; font-size: 1.05rem; font-weight: 650; color: var(--accent-hover); overflow-wrap: anywhere; }

.usage { width: 100%; height: 8px; }
.usage::-webkit-meter-bar { background: var(--bg-raised); border: 0; border-radius: 999px; height: 8px; }
.usage::-webkit-meter-optimum-value { background: var(--accent); border-radius: 999px; }
.usage::-webkit-meter-suboptimum-value { background: var(--warning); border-radius: 999px; }
.usage::-webkit-meter-even-less-good-value { background: var(--error); border-radius: 999px; }
.usage::-moz-meter-bar { background: var(--accent); border-radius: 999px; }
.usage:-moz-meter-sub-optimum::-moz-meter-bar { background: var(--warning); }
.usage:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: var(--error); }

.drop-zone {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 16px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-input);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.drop-zone:hover, .drop-zone.is-dragover { border-color: var(--accent); background: var(--accent-soft); }
.drop-icon { width: 28px; height: 28px; color: var(--accent-hover); }
.drop-title { font-weight: 650; font-size: 1rem; }
.drop-help { color: var(--text-muted); font-size: 0.85rem; }

progress {
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: var(--bg-raised);
  overflow: hidden;
  appearance: none;
}
progress::-webkit-progress-bar { background: var(--bg-raised); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; transition: width 0.2s; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

.queue { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.queue:empty { display: none; }
.queue-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
}
.queue-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.queue-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-status { font-size: 0.82rem; color: var(--text-muted); }
.queue-row[data-state="done"] { border-color: rgba(45, 212, 161, 0.4); }
.queue-row[data-state="done"] .queue-status { color: var(--success); }
.queue-row[data-state="failed"] { border-color: rgba(248, 113, 113, 0.5); }
.queue-row[data-state="failed"] .queue-status { color: var(--error); }

.file-list { list-style: none; padding: 0; display: flex; flex-direction: column; }
.file-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.file-row:first-child { border-top: 0; padding-top: 0; }
.file-row:last-child { padding-bottom: 0; }
.file-type {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  color: var(--accent-hover);
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.04em;
}
.file-row[data-state="damaged"] .file-type { color: var(--warning); }
.file-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.file-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-details { font-size: 0.82rem; color: var(--text-muted); }
.file-row[data-state="damaged"] .file-details { color: var(--warning); }
.file-confirm { font-size: 0.87rem; color: var(--error); }
.file-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.key-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.key-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
}
.key-row[data-state="bad"] .key-letter { color: var(--text-muted); background: transparent; border-style: dashed; }
.key-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.key-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 650; }
.key-detail { font-size: 0.82rem; color: var(--text-muted); }
.key-entry { font-family: var(--mono); font-size: 0.76rem; color: var(--text-muted); }
.key-entry-unknown { font-family: inherit; font-style: italic; }
.key-actions { display: flex; gap: 8px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--bg-raised);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 650;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-ok { background: var(--success-soft); color: var(--success); }
.chip-warn { background: var(--warning-soft); color: var(--warning); }
.chip-bad { background: var(--error-soft); color: var(--error); }

.key-action {
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: var(--bg-input);
}
.key-flow { display: flex; flex-direction: column; gap: 14px; }
.key-flow p { font-size: 0.9rem; color: var(--text-muted); }
.key-flow .flow-error { color: var(--error); }
.key-flow .flow-error-warning { color: var(--warning); }

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 760px) {
  .key-cards { grid-template-columns: 1fr; }
  .key-card-actions { flex-direction: row; flex-wrap: wrap; }
}

@media (max-width: 600px) {
  body { font-size: 14.5px; }
  .card { padding: 18px; }
  .card-hero { padding: 20px; }
  .choices, .pin-compare, .facts { grid-template-columns: 1fr; }
  .stepper li { flex-direction: column; align-items: flex-start; gap: 4px; font-size: 0.78rem; }
  .file-row { grid-template-columns: 40px minmax(0, 1fr); }
  .file-actions { grid-column: 1 / -1; }
  .key-row { grid-template-columns: auto minmax(0, 1fr); }
  .key-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .brand-tag { display: none; }
}

@media (max-width: 400px) {
  .app { padding: 0 12px 24px; }
  h1 { font-size: 1.3rem; }
  .stepper { gap: 6px; }
  .stepper-label { white-space: normal; }
  .vault-bar { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .spinner { animation-duration: 2.4s; }
}
