:root {
  color-scheme: light;
  --ink: #182235;
  --muted: #64748b;
  --line: #e3e9f1;
  --paper: #ffffff;
  --canvas: #f3f6fa;
  --navy: #101827;
  --blue: #3768f5;
  --blue-dark: #2450d6;
  --mint: #dff7ed;
  --red: #d54d5c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid #8fb2ff;
  outline-offset: 2px;
}

.shell { width: min(900px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 52px; }
.gate-panel {
  width: min(100%, 480px);
  margin: clamp(28px, 9vh, 88px) auto;
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 22px 70px rgba(23, 39, 69, .09);
}
.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 18px;
  background: var(--navy);
  color: #fff;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -.04em;
}
.brand-mark.small { width: 44px; height: 44px; border-radius: 14px; font-size: 14px; flex: 0 0 auto; }
.eyebrow {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.gate-panel .eyebrow { margin-top: 26px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(28px, 5vw, 38px); letter-spacing: -.045em; }
h2 { margin-bottom: 0; font-size: 26px; letter-spacing: -.04em; }
h3 { margin-bottom: 8px; }
.lead { margin: 0 0 24px; color: var(--muted); line-height: 1.65; }
.stack-form { display: grid; gap: 10px; }
.stack-form label, .form-grid > label, .form-row label, .import-box > label {
  color: #344258;
  font-size: 13px;
  font-weight: 750;
}
.stack-form input, .form-grid input, .form-grid select, .import-box textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid #d7e0eb;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
.stack-form input { margin-bottom: 8px; }
.gate-error { min-height: 1.25em; margin: -2px 0 0; color: #a52b39; font-size: 12px; font-weight: 750; }
.import-box textarea { min-height: 82px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.primary-button, .secondary-button, .icon-button, .copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 15px;
  font-weight: 800;
  transition: background .15s ease, transform .15s ease;
}
.primary-button { background: var(--blue); color: #fff; }
.primary-button:hover { background: var(--blue-dark); transform: translateY(-1px); }
.secondary-button, .icon-button, .copy-button { border-color: var(--line); background: #fff; color: #33445c; }
.secondary-button:hover, .icon-button:hover, .copy-button:hover { background: #f7f9fc; }
.primary-button:disabled, .copy-button:disabled { cursor: not-allowed; opacity: .55; }
.security-note {
  display: grid;
  gap: 5px;
  margin-top: 22px;
  padding: 14px 15px;
  border: 1px solid #f4d7a7;
  border-radius: 14px;
  background: #fff9ec;
  color: #76511c;
  font-size: 12px;
  line-height: 1.6;
}
.security-note strong { font-size: 12px; }
.backup-tools { display: grid; justify-items: start; gap: 9px; margin-top: 16px; }
.backup-tools p { margin: 0; color: var(--muted); font-size: 12px; }
.file-button { position: relative; overflow: hidden; }
.file-button input { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; opacity: 0; }

.vault-panel { min-height: calc(100vh - 80px); }
.topbar, .brand-lockup, .top-actions, .section-heading, .account-heading, .code-row, .timer-row, .button-row, .dialog-heading, .dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar { gap: 16px; padding: 4px 0 24px; }
.brand-lockup { justify-content: flex-start; gap: 13px; }
.brand-lockup h1 { margin: 0; font-size: 23px; }
.brand-lockup .eyebrow { margin-bottom: 3px; }
.top-actions { gap: 8px; }
.icon-button { min-width: 48px; min-height: 40px; padding: 8px 12px; }
.security-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid #cdebdc;
  border-radius: 15px;
  background: #effbf5;
  color: #23604a;
  font-size: 12px;
  line-height: 1.55;
}
.security-banner p { margin: 0; }
.shield { color: #1e9b6c; font-size: 18px; line-height: 1; }
.section-heading { gap: 12px; margin: 34px 0 17px; }
.section-heading h2 { font-size: 25px; }
.section-heading .eyebrow { margin-bottom: 3px; }
.add-button { white-space: nowrap; }
.add-button span { font-size: 18px; line-height: 1; }
.account-list { display: grid; gap: 12px; }
.account-card {
  padding: 18px 20px 15px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--paper);
  box-shadow: 0 7px 22px rgba(18, 32, 56, .035);
}
.account-heading { align-items: flex-start; gap: 12px; }
.issuer { color: #2d3c52; font-size: 13px; font-weight: 850; }
.account-label { margin-top: 3px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.remove-button { min-width: auto; min-height: 34px; padding: 6px 9px; color: #8b4a54; font-size: 11px; }
.code-row { justify-content: flex-start; gap: 14px; margin: 14px 0 11px; }
.otp-code {
  font-variant-numeric: tabular-nums;
  font-size: clamp(30px, 8vw, 42px);
  font-weight: 850;
  letter-spacing: .11em;
  line-height: 1.1;
  color: #17243a;
}
.copy-button { min-height: 36px; margin-left: auto; padding: 7px 12px; font-size: 12px; }
.timer-row { gap: 12px; color: var(--muted); font-size: 11px; }
.progress-track { width: min(190px, 42%); height: 5px; overflow: hidden; border-radius: 999px; background: #e9eef5; }
.progress-bar { height: 100%; border-radius: inherit; background: #4e82f7; transition: width .2s linear; }
.progress-bar.ending { background: #ed9a54; }
.empty-state {
  padding: 52px 22px;
  border: 1px dashed #cbd6e4;
  border-radius: 18px;
  background: rgba(255, 255, 255, .65);
  text-align: center;
}
.empty-state p { max-width: 440px; margin: 0 auto 18px; color: var(--muted); line-height: 1.6; }
.empty-icon { margin-bottom: 14px; color: var(--blue); font-size: 28px; font-weight: 900; letter-spacing: .18em; }
.app-footer { display: flex; justify-content: space-between; gap: 16px; margin-top: 28px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.app-footer p { max-width: 620px; margin: 0; }
.app-footer a { color: #355fc4; white-space: nowrap; }

.account-dialog {
  width: min(620px, calc(100% - 24px));
  max-height: min(92vh, 900px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 25px 90px rgba(10, 20, 40, .25);
}
.account-dialog::backdrop { background: rgba(13, 23, 39, .55); backdrop-filter: blur(3px); }
.dialog-content { padding: clamp(19px, 4vw, 30px); }
.dialog-heading { margin-bottom: 20px; }
.dialog-heading h2 { font-size: 22px; }
.dialog-heading .eyebrow { margin-bottom: 4px; }
.import-box { display: grid; gap: 9px; margin-bottom: 18px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafd; }
.button-row { justify-content: flex-start; flex-wrap: wrap; gap: 8px; }
.button-row button { min-height: 36px; padding: 7px 11px; font-size: 12px; }
.scanner-panel { display: grid; gap: 9px; }
.scanner-panel video { width: min(100%, 360px); max-height: 260px; margin: 0 auto; border-radius: 12px; background: #101827; object-fit: cover; }
.scanner-panel button { justify-self: end; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.form-grid > label span { color: #8793a5; font-size: 11px; font-weight: 600; }
.form-grid input, .form-grid select { margin-bottom: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 4px; }
.dialog-warning { margin: 15px 0 0; color: #8c5d1f; font-size: 11px; line-height: 1.5; }
.dialog-actions { justify-content: flex-end; gap: 8px; margin-top: 19px; }
.toast {
  position: fixed;
  z-index: 5;
  right: 18px;
  bottom: 18px;
  max-width: min(440px, calc(100% - 36px));
  padding: 12px 16px;
  border-radius: 12px;
  background: #17243a;
  color: #fff;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 10px 30px rgba(10, 20, 40, .22);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
}
.toast.visible { opacity: 1; transform: translateY(0); }
.toast[data-kind="error"] { background: #8e2d3a; }

@media (max-width: 600px) {
  .shell { width: min(100% - 22px, 900px); padding-top: 14px; }
  .gate-panel { margin-top: 5vh; padding: 23px 18px; border-radius: 19px; }
  .topbar { align-items: flex-start; }
  .top-actions { flex-direction: column-reverse; align-items: stretch; }
  .top-actions button { min-height: 36px; padding: 7px 9px; font-size: 11px; }
  .section-heading { align-items: flex-end; }
  .section-heading h2 { font-size: 22px; }
  .add-button { min-height: 38px; padding: 8px 10px; font-size: 12px; }
  .account-card { padding: 16px 14px 13px; }
  .otp-code { letter-spacing: .08em; }
  .progress-track { width: 34%; }
  .app-footer { flex-direction: column; }
}
