/* Device Vault: same look as the Gift Cards, Net Worth and Quick Expense apps. */
:root {
  --bg: #F4F7F5; --card: #FFFFFF; --line: #E1E8E4; --line2: #EEF2F0; --fg: #0E1C17; --muted: #52625C;
  --brand: #0B6B4E; --brand-fg: #FFFFFF; --hero: #0B3D2E; --hero-2: #072B20; --hero-sub: #CFE6DC; --chip: #1E6B50;
  --key: #1E5A45; --neg: #B54708; --warn-bg: #FEF0E6; --warn-fg: #7A2E05; --warn-line: #F6D3BC;
  --bad-bg: #FDECEC; --bad-fg: #9B1C1C; --mask: #D5DFDA; --input: #C9D4CF; --soft: #E3ECE7; --ok-fg: #0B6B4E;
  --shadow: 0 10px 30px rgba(7, 43, 32, .18); --scrim: rgba(7, 43, 32, .55);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1310; --card: #121E19; --line: #23332C; --line2: #1A2822; --fg: #E6EFEA; --muted: #9DB2A9;
    --brand: #3CC58F; --brand-fg: #062117; --hero: #0F3B2D; --hero-2: #0A2A20; --hero-sub: #BFDCCF; --chip: #1E5A45;
    --key: #1E5A45; --neg: #F59E5B; --warn-bg: #3A2416; --warn-fg: #F8C9A4; --warn-line: #5A3721;
    --bad-bg: #3B1717; --bad-fg: #F5B4B4; --mask: #2C3D35; --input: #33463E; --soft: #1C2B25; --ok-fg: #3CC58F;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5); --scrim: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A1310; --card: #121E19; --line: #23332C; --line2: #1A2822; --fg: #E6EFEA; --muted: #9DB2A9;
  --brand: #3CC58F; --brand-fg: #062117; --hero: #0F3B2D; --hero-2: #0A2A20; --hero-sub: #BFDCCF; --chip: #1E5A45;
  --key: #1E5A45; --neg: #F59E5B; --warn-bg: #3A2416; --warn-fg: #F8C9A4; --warn-line: #5A3721;
  --bad-bg: #3B1717; --bad-fg: #F5B4B4; --mask: #2C3D35; --input: #33463E; --soft: #1C2B25; --ok-fg: #3CC58F;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5); --scrim: rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--fg);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
h1, h2, h3, p { margin: 0; }
.mono { font-family: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* ---------- Layout ---------- */
.shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
}
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; min-height: 48px; color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; border-radius: 12px; }
.nav a[aria-current="page"] { color: var(--brand); font-weight: 700; }
.nav .brand { display: none; }
.nav svg { width: 22px; height: 22px; }
@media (min-width: 600px) {
  .shell { flex-direction: row; }
  .nav { position: sticky; top: 0; height: 100vh; width: 88px; flex-shrink: 0; grid-template-columns: 1fr; grid-auto-rows: min-content; gap: 6px; padding: 18px 10px; background: var(--hero); border: 0; }
  .nav a { color: var(--hero-sub); }
  .nav a[aria-current="page"] { color: #fff; background: var(--chip); }
  .main { padding: 28px 28px 40px; max-width: 900px; }
}
@media (min-width: 1100px) {
  .nav { width: 236px; padding: 24px 16px; }
  .nav .brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: 17px; padding: 0 8px 20px; }
  .nav .brand span.ic { width: 36px; height: 36px; border-radius: 10px; background: var(--chip); display: flex; align-items: center; justify-content: center; }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 12px; font-size: 14px; }
  .main { max-width: 1120px; padding: 32px 40px 48px; }
  .cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .cols > .stack { display: flex; flex-direction: column; gap: 16px; }
}

.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 1099px) { .cols { display: flex; flex-direction: column; gap: 16px; min-width: 0; } }
.kv .val.nowrap { white-space: nowrap; }

/* ---------- Header ---------- */
.top { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.top h1 { font-size: 22px; font-weight: 800; letter-spacing: -.2px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.top .sub { font-size: 13px; color: var(--muted); }
.iconbtn { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--fg); text-decoration: none; }
.iconbtn.bare { border: 0; background: transparent; }
.iconbtn svg { width: 20px; height: 20px; }

/* ---------- Hero ---------- */
.hero { background: linear-gradient(135deg, var(--hero) 0%, var(--hero-2) 100%); color: #fff; border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 8px; position: relative; overflow: hidden; }
.hero .k { font-size: 13px; color: var(--hero-sub); font-weight: 600; }
.hero .big { font-size: 44px; font-weight: 800; line-height: 1; }
.hero .title { font-size: 22px; font-weight: 800; overflow-wrap: anywhere; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.hchip { background: var(--chip); color: #fff; border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 600; }

/* ---------- Cards and rows ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; }
.card.pad { padding: 14px 16px; }
.section { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.section > .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section h2 { font-size: 15px; font-weight: 700; }
.section .head a, .linkbtn { font-size: 13px; font-weight: 700; color: var(--brand); text-decoration: none; background: none; border: 0; padding: 8px 0; min-height: 36px; }
.list { display: flex; flex-direction: column; overflow: hidden; }
.irow { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line2); color: var(--fg); text-decoration: none; min-height: 60px; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.irow:last-child { border-bottom: 0; }
.irow .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.irow .t1 { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.irow .t2 { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.irow .end { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.logo { width: 38px; height: 38px; border-radius: 12px; background: var(--soft); color: var(--brand); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 11px; font-weight: 800; }
.logo svg { width: 20px; height: 20px; }
.logo.warn { background: var(--warn-bg); color: var(--neg); }
.pill { border-radius: 999px; padding: 3px 9px; font-size: 11px; font-weight: 700; white-space: nowrap; background: var(--soft); color: var(--ok-fg); }
.pill.muted { background: var(--line2); color: var(--muted); }
.pill.warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill.bad { background: var(--bad-bg); color: var(--bad-fg); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.visopt { flex: 1; min-height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
input[name=vis]:checked + .visopt { background: var(--card); color: var(--fg); font-weight: 700; }
input[name=vis]:focus-visible + .visopt { outline: 3px solid var(--brand); }
.fchip:has(input:checked) { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }
.fchip input { accent-color: var(--brand); }
.tile { font: inherit; text-align: left; cursor: pointer; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 12px; color: var(--fg); text-decoration: none; min-height: 60px; display: flex; flex-direction: column; justify-content: center; }
.tile .n { font-size: 20px; font-weight: 800; }
.tile .l { font-size: 12px; color: var(--muted); }
.tile.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-fg); }
.tile.warn .l { color: var(--warn-fg); font-weight: 600; }
@media (min-width: 600px) { .tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* Field rows (label / value / copy) */
.kv { padding: 2px 14px; }
.kv .r { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line2); min-height: 44px; }
.kv .r:last-child { border-bottom: 0; }
.kv .lab { color: var(--muted); font-size: 13px; flex: 0 0 38%; max-width: 180px; }
.kv .val { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; overflow-wrap: anywhere; text-align: right; }
.kv .val a { overflow-wrap: anywhere; }
.copy { height: 32px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--input); background: var(--card); font-size: 12px; font-weight: 700; flex-shrink: 0; }

/* Secrets */
.secrets { padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.sec { background: var(--bg); border-radius: 14px; padding: 10px 6px 10px 14px; display: flex; align-items: center; gap: 6px; }
.sec .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sec .lab { font-size: 12px; color: var(--muted); font-weight: 600; overflow-wrap: anywhere; }
.sec .mask { font-size: 18px; letter-spacing: 3px; color: var(--muted); line-height: 24px; }
.sec .shown { font-size: 17px; font-weight: 700; color: var(--brand); line-height: 24px; overflow-wrap: anywhere; word-break: break-all; }
.sec .count { font-size: 11px; color: var(--warn-fg); font-weight: 600; }
.sec .meta { font-size: 11px; color: var(--muted); }
.sec .acts { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.sec .eye, .sec .more { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 12px; color: var(--brand); display: flex; align-items: center; justify-content: center; }
.sec .eye svg, .sec .more svg { width: 20px; height: 20px; }

/* ---------- Controls ---------- */
.btn { min-height: 48px; border-radius: 14px; border: 0; padding: 0 18px; font-weight: 700; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn.primary { background: var(--brand); color: var(--brand-fg); }
.btn.dark { background: var(--hero); color: #fff; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.line { background: var(--card); color: var(--fg); border: 1px solid var(--input); }
.btn.warn { background: var(--warn-bg); color: var(--warn-fg); border: 1px solid var(--warn-line); }
.btn.danger { background: var(--bad-bg); color: var(--bad-fg); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.btnrow .btn { flex: 1 1 140px; }
.search { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--input); border-radius: 14px; padding: 0 14px; min-height: 46px; }
.search svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }
.search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; font-size: 16px; }
.seg { display: flex; background: var(--soft); border-radius: 12px; padding: 3px; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1 0 auto; min-height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; padding: 0 10px; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--fg); font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.fchips { display: flex; gap: 6px; flex-wrap: wrap; }
.fchip { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--input); background: var(--card); font-size: 13px; font-weight: 600; }
.fchip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }
select.fchip { padding-right: 8px; }
.form { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
fieldset.field { min-width: 0; }
.field input[type=radio], .field input[type=checkbox] { width: 18px; height: 18px; min-height: 0; margin: 0; flex-shrink: 0; }
.field input:not([type=radio]):not([type=checkbox]), .field select, .field textarea { min-height: 46px; border-radius: 12px; border: 1px solid var(--input); background: var(--card); padding: 0 12px; font-size: 16px; font-weight: 500; color: var(--fg); width: 100%; }
.field textarea { padding: 10px 12px; min-height: 90px; resize: vertical; }
.field .with { display: flex; align-items: center; gap: 4px; border: 1px solid var(--input); border-radius: 12px; background: var(--card); padding: 0 4px 0 12px; }
.field .with input:not([type=radio]):not([type=checkbox]) { border: 0; padding: 0; min-height: 44px; outline: 0; }
.field .help { font-weight: 500; color: var(--muted); }
.field .err { color: var(--bad-fg); font-weight: 600; }
.note { display: flex; gap: 10px; align-items: flex-start; background: var(--soft); border-radius: 16px; padding: 12px 14px; font-size: 13px; }
.note svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; color: var(--brand); }
.note.warn { background: var(--warn-bg); color: var(--warn-fg); }
.note.warn svg { color: var(--neg); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.banner { background: var(--warn-bg); color: var(--warn-fg); border: 1px solid var(--warn-line); border-radius: 14px; padding: 10px 14px; font-size: 13px; font-weight: 600; }
.steps .irow .num { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--brand-fg); font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.steps .irow.done .num { background: var(--soft); color: var(--brand); }
.steps .irow .t2 { white-space: normal; }

/* ---------- Lock and setup ---------- */
.gate { min-height: 100vh; min-height: 100dvh; background: linear-gradient(180deg, var(--hero) 0%, var(--hero-2) 100%); color: #fff; display: flex; flex-direction: column; align-items: center; padding: calc(56px + env(safe-area-inset-top)) 24px calc(28px + env(safe-area-inset-bottom)); text-align: center; }
.gate .appic { width: 64px; height: 64px; border-radius: 18px; background: var(--chip); display: flex; align-items: center; justify-content: center; }
.gate .appic svg { width: 32px; height: 32px; }
.gate h1 { font-size: 24px; font-weight: 800; margin-top: 16px; }
.gate p { color: var(--hero-sub); font-size: 14px; margin-top: 4px; }
.gate .msg { min-height: 20px; font-size: 13px; color: #FFD8B5; margin: 4px 0 20px; }
.dots { display: flex; gap: 16px; margin: 32px 0 8px; }
.dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--hero-sub); }
.dots span.on { background: #fff; border-color: #fff; }
.keypad { display: grid; grid-template-columns: repeat(3, 72px); gap: 16px 28px; justify-content: center; }
.keypad button { width: 72px; height: 72px; border-radius: 50%; border: 0; background: var(--key); color: #fff; font-size: 28px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.keypad button.plain { background: transparent; }
.keypad button svg { width: 28px; height: 28px; }
.keypad button:active { filter: brightness(1.25); }
.gate .foot { margin-top: auto; padding-top: 24px; font-size: 12px; color: var(--hero-sub); }
.gate .panel { width: 100%; max-width: 420px; background: var(--card); color: var(--fg); border-radius: 22px; padding: 18px; text-align: left; display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.gate .panel h2 { font-size: 17px; font-weight: 800; }
.gate .panel p { color: var(--muted); margin: 0; }
.gate .ghostlight { color: #fff; background: transparent; border: 0; font-weight: 700; min-height: 44px; margin-top: 8px; }
.stepper { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }
.stepper span { width: 28px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.25); }
.stepper span.on { background: #fff; }
.gbtn { min-height: 44px; display: flex; justify-content: center; }

/* ---------- Bottom sheet ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease-out; }
.sheet { width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: var(--card); border-radius: 26px 26px 0 0; padding: 12px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; animation: rise .2s ease-out; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--mask); align-self: center; }
.sheet h2 { font-size: 20px; font-weight: 800; text-align: center; }
.sheet .lead { font-size: 14px; color: var(--muted); text-align: center; }
.sheet .bigic { width: 72px; height: 72px; border-radius: 22px; background: var(--soft); color: var(--brand); display: flex; align-items: center; justify-content: center; align-self: center; }
.sheet .bigic svg { width: 38px; height: 38px; }
.sheet .keypad button { background: var(--soft); color: var(--fg); }
.sheet .keypad button.plain { background: transparent; }
.sheet .dots span { border-color: var(--muted); }
.sheet .dots span.on { background: var(--brand); border-color: var(--brand); }
.sheet .dots { justify-content: center; margin: 4px 0; }
@media (min-width: 600px) { .scrim { align-items: center; } .sheet { border-radius: 26px; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; z-index: 60; max-width: calc(100vw - 32px); box-shadow: var(--shadow); animation: rise .2s ease-out; }
@media (min-width: 600px) { .toast { bottom: 28px; } }
.spin { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .8s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
