/* Password Vault — phone first, then two and three columns on wider screens. */

:root {
  --bg: #0a0e16; --bg2: #0e131d; --panel: #131a26; --panel2: #19212f; --raise: #1f2939;
  --line: #243045; --line2: #2f3d56;
  --text: #e9eef8; --muted: #93a0b8; --faint: #627089;
  --accent: #3dd0ff; --accent2: #7b61ff; --on-accent: #03141c;
  --ok: #38d996; --warn: #ffb547; --bad: #ff6b6b;
  --digit: #6fc3ff; --sym: #ffad5c;
  --focus: #ffd166;
  --shadow: 0 12px 40px rgba(0, 0, 0, .45);
  --r: 14px; --r2: 20px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f3f5f9; --bg2: #eef1f6; --panel: #ffffff; --panel2: #f4f6fa; --raise: #ffffff;
  --line: #dfe4ee; --line2: #cfd7e4;
  --text: #0f1828; --muted: #56627a; --faint: #8390a6;
  --accent: #0b84c4; --accent2: #6a4ff0; --on-accent: #ffffff;
  --ok: #128a59; --warn: #b26a00; --bad: #d23b3b;
  --digit: #0a6fc2; --sym: #c25e00;
  --focus: #e09a00;
  --shadow: 0 12px 40px rgba(20, 30, 60, .16);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]) {
    --bg: #f3f5f9; --bg2: #eef1f6; --panel: #ffffff; --panel2: #f4f6fa; --raise: #ffffff;
    --line: #dfe4ee; --line2: #cfd7e4;
    --text: #0f1828; --muted: #56627a; --faint: #8390a6;
    --accent: #0b84c4; --accent2: #6a4ff0; --on-accent: #ffffff;
    --ok: #128a59; --warn: #b26a00; --bad: #d23b3b;
    --digit: #0a6fc2; --sym: #c25e00;
    --focus: #e09a00;
    --shadow: 0 12px 40px rgba(20, 30, 60, .16);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
a { color: var(--accent); }
.ic { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- buttons */
.btn {
  appearance: none; border: 1px solid var(--line2); background: var(--panel2);
  min-height: 48px; padding: 0 18px; border-radius: 12px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; transition: background .15s, transform .08s, border-color .15s; white-space: nowrap;
  touch-action: manipulation;
}
.btn:hover { border-color: var(--faint); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn.primary { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 70%, var(--accent2))); border-color: transparent; color: var(--on-accent); }
.btn.danger { background: color-mix(in srgb, var(--bad) 16%, var(--panel2)); border-color: color-mix(in srgb, var(--bad) 55%, transparent); color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.block { width: 100%; }
.btn.big { min-height: 56px; font-size: 16px; border-radius: 14px; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid var(--text); border-right-color: transparent; animation: spin .7s linear infinite;
}
.btn.primary.busy::after { border-color: var(--on-accent); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn {
  appearance: none; border: 0; background: transparent; width: 44px; height: 44px; flex: none;
  display: inline-grid; place-items: center; border-radius: 12px; cursor: pointer; color: var(--muted);
  touch-action: manipulation;
}
.icon-btn:hover { background: var(--panel2); color: var(--text); }
.icon-btn.on { color: var(--warn); }
.icon-btn.on .ic { fill: currentColor; }
.link { appearance: none; border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; padding: 6px 2px; }

/* ----------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; }
.lab { font-size: 13px; font-weight: 600; color: var(--muted); }
.hint { font-size: 12.5px; color: var(--faint); }
input[type="text"], input[type="password"], input[type="url"], input[type="email"], input[type="search"], input:not([type]), textarea, select {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line2); background: var(--bg2); color: var(--text);
  font-size: 16px; /* 16px: iOS zooms the page into smaller inputs */
  outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.field-in { position: relative; display: flex; align-items: center; }
.field-in input { padding-right: 52px; }
.field-in input:has(~ .icon-btn ~ .icon-btn) { padding-right: 96px; }
.field-in .icon-btn { position: absolute; right: 2px; }
.field-in .icon-btn:not(:last-child) { right: 46px; }
.err { color: var(--bad); font-size: 14px; min-height: 0; margin: -6px 0 12px; }
.err:empty { display: none; }
.note-box { padding: 12px 14px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.note-box.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 9%, var(--panel)); color: var(--text); }
.note-box.bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: color-mix(in srgb, var(--bad) 9%, var(--panel)); color: var(--text); }
.note-box b { color: var(--text); }

.toggle { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 0; cursor: pointer; }
.toggle-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch { width: 46px; height: 28px; border-radius: 99px; background: var(--line2); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.toggle input:checked + .switch { background: var(--accent); }
.toggle input:checked + .switch::after { transform: translateX(18px); }
.toggle input:focus-visible + .switch { outline: 2px solid var(--focus); outline-offset: 2px; }

.seg { display: flex; padding: 4px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); gap: 4px; }
.seg button { flex: 1; min-height: 40px; border: 0; background: transparent; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--raise); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.25); }

input[type="range"] { width: 100%; accent-color: var(--accent); height: 32px; }

/* ----------------------------------------------------- strength meter ---- */
.meter { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin: 2px 0 6px; }
.meter i { height: 6px; border-radius: 9px; background: var(--line); transition: background .2s; }
.meter[data-s="0"] i:nth-child(-n+1) { background: var(--bad); }
.meter[data-s="1"] i:nth-child(-n+2) { background: var(--bad); }
.meter[data-s="2"] i:nth-child(-n+3) { background: var(--warn); }
.meter[data-s="3"] i:nth-child(-n+4) { background: var(--ok); }
.meter[data-s="4"] i { background: var(--ok); }
.meter-text { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.meter-text b { color: var(--text); }

/* ------------------------------------------------------- passwords ------- */
.pw { font-family: var(--mono); letter-spacing: .02em; overflow-wrap: anywhere; }
.pw .d { color: var(--digit); }
.pw .s { color: var(--sym); }

/* ------------------------------------------------------ gate screens ----- */
.gate {
  min-height: 100dvh; display: grid; place-items: center;
  padding: calc(24px + var(--sat)) calc(18px + var(--sar)) calc(24px + var(--sab)) calc(18px + var(--sal));
  background:
    radial-gradient(1000px 500px at 50% -10%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(700px 400px at 100% 100%, color-mix(in srgb, var(--accent2) 12%, transparent), transparent 70%),
    var(--bg);
}
.gate-card { width: 100%; max-width: 440px; }
.gate-card.wide { max-width: 560px; }
.gate-top { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; margin-bottom: 26px; }
.gate-top h1 { font-size: 26px; letter-spacing: -.01em; }
.gate-top p { color: var(--muted); max-width: 34ch; }
.gate-box { background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line); border-radius: var(--r2); padding: 22px; box-shadow: var(--shadow); backdrop-filter: blur(8px); }
.gate-box + .gate-box { margin-top: 14px; }
.gate-actions { display: flex; flex-direction: column; gap: 10px; }
.gate-foot { margin-top: 18px; text-align: center; color: var(--faint); font-size: 13px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.gate-foot .link { font-size: 14px; }
.bio-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 0 auto 18px; padding: 18px 26px; border-radius: 22px; border: 1px solid var(--line2); background: var(--panel2); color: var(--accent); cursor: pointer; font-weight: 600; }
.bio-btn .ic { width: 46px; height: 46px; stroke-width: 1.5; }
.bio-btn span { color: var(--text); font-size: 14px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; margin: 4px 0 16px; text-transform: uppercase; letter-spacing: .08em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.steps { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
.steps i { width: 26px; height: 4px; border-radius: 9px; background: var(--line2); }
.steps i.on { background: var(--accent); }
.lead { color: var(--muted); margin-bottom: 16px; }
.lead b, .lead strong { color: var(--text); }
.points { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.points li { display: flex; gap: 12px; align-items: flex-start; color: var(--muted); font-size: 14px; }
.points li .ic { color: var(--accent); margin-top: 1px; }
.points li b { color: var(--text); display: block; font-size: 15px; }

/* ----------------------------------------------------------- the kit ----- */
.kit { display: grid; gap: 12px; }
.kit-row { background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kit-row .lab { display: block; margin-bottom: 4px; }
.kit-code { font-family: var(--mono); font-size: 17px; letter-spacing: .04em; overflow-wrap: anywhere; user-select: all; }
.kit-qr { display: grid; justify-items: center; gap: 8px; padding: 14px; background: #fff; border-radius: 14px; color: #222; font-size: 12.5px; text-align: center; }
.kit-qr canvas { width: 196px; height: 196px; image-rendering: pixelated; }
.check-row { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0; cursor: pointer; font-size: 14px; }
.check-row input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; margin: 0; }

/* -------------------------------------------------------------- shell ---- */
.shell { min-height: 100dvh; }
.rail { display: none; }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px calc(6px + var(--sar)) calc(6px + var(--sab)) calc(6px + var(--sal));
  background: color-mix(in srgb, var(--panel) 94%, transparent); border-top: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.tab { appearance: none; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 4px; min-height: 52px; font-size: 11px; font-weight: 600; color: var(--faint); cursor: pointer; border-radius: 12px; position: relative; }
.tab.on { color: var(--accent); }
.tab .badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 10px; line-height: 16px; }

.page { padding: 0 0 calc(84px + var(--sab)); min-height: 100dvh; }
.top {
  position: sticky; top: 0; z-index: 20;
  padding: calc(10px + var(--sat)) calc(14px + var(--sar)) 8px calc(14px + var(--sal));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.top-row { display: flex; align-items: center; gap: 6px; min-height: 48px; }
.top-row h1 { font-size: 24px; flex: 1; letter-spacing: -.01em; }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 6px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.sync[data-s="ok"] i { background: var(--ok); }
.sync[data-s="syncing"] i { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.sync[data-s="offline"] i, .sync[data-s="idle"] i { background: var(--warn); }
.sync[data-s="auth"] i, .sync[data-s="error"] i { background: var(--bad); }
@keyframes pulse { 50% { opacity: .3; } }
.search { position: relative; margin-top: 6px; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input { padding-left: 44px; padding-right: 44px; border-radius: 14px; background: var(--panel); }
.search .icon-btn { position: absolute; right: 2px; top: 2px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; margin: 0 calc(-14px - var(--sar)) 0 calc(-14px - var(--sal)); padding-left: calc(14px + var(--sal)); padding-right: calc(14px + var(--sar)); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--muted); border-radius: 99px; padding: 0 14px; min-height: 36px; font-size: 13.5px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: color-mix(in srgb, var(--accent) 16%, var(--panel)); border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--text); }
.chip .n { font-weight: 500; color: var(--faint); font-size: 12px; }

.banner { margin: 8px 14px 0; display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; font-size: 13.5px; background: color-mix(in srgb, var(--warn) 12%, var(--panel)); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
.banner.bad { background: color-mix(in srgb, var(--bad) 12%, var(--panel)); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.banner span { flex: 1; }
.banner .ic { color: var(--warn); }
.banner.bad .ic { color: var(--bad); }

.list { list-style: none; margin: 0; padding: 4px 8px; }
.list-head { font-size: 12px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; padding: 14px 12px 6px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px; border-radius: 14px; cursor: pointer;
  min-height: 64px; width: 100%; border: 0; background: none; text-align: left; touch-action: manipulation;
}
.row:hover { background: var(--panel); }
.row.on { background: color-mix(in srgb, var(--accent) 13%, var(--panel)); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.row-title .ic { color: var(--warn); fill: var(--warn); }
.row-sub { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .chev { color: var(--faint); }
.row-quick { color: var(--muted); }
.av { --h: 200; width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 18px; color: hsl(var(--h) 80% 88%); background: linear-gradient(135deg, hsl(var(--h) 55% 34%), hsl(calc(var(--h) + 40) 55% 26%)); }
:root[data-theme="light"] .av { color: #fff; background: linear-gradient(135deg, hsl(var(--h) 60% 52%), hsl(calc(var(--h) + 40) 60% 42%)); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .av { color: #fff; background: linear-gradient(135deg, hsl(var(--h) 60% 52%), hsl(calc(var(--h) + 40) 60% 42%)); } }
.av.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 24px; }

.empty { text-align: center; padding: 56px 24px; color: var(--muted); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.empty .ic { width: 48px; height: 48px; color: var(--faint); stroke-width: 1.4; }
.empty h3 { color: var(--text); font-size: 18px; }
.empty .btn { margin-top: 6px; }

.fab {
  position: fixed; right: calc(18px + var(--sar)); bottom: calc(84px + var(--sab)); z-index: 25;
  width: 58px; height: 58px; border-radius: 18px; border: 0; cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
  display: grid; place-items: center; box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 35%, transparent);
}
.fab .ic { width: 28px; height: 28px; stroke-width: 2.4; }

/* -------------------------------------------------------------- detail --- */
.detail { display: none; }
.detail.open {
  display: block; position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow-y: auto;
  animation: slide-in .22s ease-out; overscroll-behavior: contain;
}
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } }
.detail-in { max-width: 720px; margin: 0 auto; padding: 0 calc(14px + var(--sar)) calc(32px + var(--sab)) calc(14px + var(--sal)); }
.detail-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 4px; padding: calc(8px + var(--sat)) 0 8px; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(12px); }
.detail-bar .grow { flex: 1; }
.detail-hero { display: flex; align-items: center; gap: 14px; padding: 6px 4px 18px; }
.detail-hero h2 { font-size: 22px; word-break: break-word; }
.detail-hero .kind { color: var(--muted); font-size: 13.5px; }
.group { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 14px; overflow: hidden; }
.f { display: flex; align-items: center; gap: 6px; padding: 10px 6px 10px 14px; min-height: 64px; }
.f + .f { border-top: 1px solid var(--line); }
.f-main { flex: 1; min-width: 0; }
.f-lab { font-size: 12.5px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.f-val { font-size: 16px; word-break: break-word; margin-top: 2px; }
.f-val.mask { letter-spacing: .12em; color: var(--muted); }
.f-val.notes { white-space: pre-wrap; font-size: 15px; }
.f-val a { word-break: break-all; }
.otp { font-family: var(--mono); font-size: 26px; letter-spacing: .12em; font-weight: 600; }
.ring { width: 30px; height: 30px; flex: none; }
.ring circle { fill: none; stroke-width: 3.2; }
.ring .bg { stroke: var(--line2); }
.ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .9s linear; transform: rotate(-90deg); transform-origin: center; }
.ring.low .fg { stroke: var(--warn); }
.pill { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
.pill.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: color-mix(in srgb, var(--bad) 10%, var(--panel)); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 10%, var(--panel)); }
.pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 10%, var(--panel)); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.meta { color: var(--faint); font-size: 12.5px; padding: 4px 4px 16px; display: flex; flex-direction: column; gap: 2px; }
.detail-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.detail-empty { display: none; }

/* --------------------------------------------------------------- sheets -- */
#layer { position: relative; z-index: 60; }
.scrim { position: fixed; inset: 0; background: rgba(4, 8, 16, .6); opacity: 0; transition: opacity .2s; display: flex; align-items: flex-end; justify-content: center; }
.scrim.in { opacity: 1; }
.sheet {
  width: 100%; max-height: 100dvh; height: 100dvh; background: var(--bg); display: flex; flex-direction: column;
  transform: translateY(24px); transition: transform .22s ease-out;
}
.sheet.small { height: auto; max-height: 92dvh; border-radius: 22px 22px 0 0; background: var(--panel); padding-bottom: var(--sab); }
.scrim.in .sheet { transform: none; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--sat)) calc(10px + var(--sar)) 8px calc(6px + var(--sal)); border-bottom: 1px solid var(--line); }
.sheet.small .sheet-head { padding-top: 10px; }
.sheet-head h2 { flex: 1; font-size: 17px; }
.sheet-head-x { display: flex; gap: 6px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 18px calc(16px + var(--sar)) 18px calc(16px + var(--sal)); overscroll-behavior: contain; }
.sheet-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px calc(16px + var(--sar)) calc(12px + var(--sab)) calc(16px + var(--sal)); border-top: 1px solid var(--line); background: var(--panel); }
.sheet.small .sheet-foot { background: transparent; }
.sheet-foot .btn { flex: 1; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.type-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.type-pick button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: 14px; border: 1px solid var(--line2); background: var(--panel); cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.type-pick button.on { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
.type-pick .ic { width: 26px; height: 26px; }
.extra-field { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; align-items: center; margin-bottom: 10px; }
.extra-field .icon-btn { color: var(--faint); }
.small-toggles { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); margin: -6px 0 16px; }
.small-toggles label { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; min-height: 36px; }
.small-toggles input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ------------------------------------------------------- generator ------- */
.wrap { max-width: 760px; margin: 0 auto; padding: 4px calc(14px + var(--sar)) 24px calc(14px + var(--sal)); }
.gen-out { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); padding: 22px 18px 16px; margin: 6px 0 16px; }
.gen-out .pw { font-size: 22px; line-height: 1.45; display: block; min-height: 64px; }
.gen-out .meter-text { margin-top: 8px; }
.gen-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.card h3 { font-size: 15px; margin-bottom: 4px; }
.card > p { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.card .toggle + .toggle { border-top: 1px solid var(--line); }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.opt-row + .opt-row { border-top: 1px solid var(--line); }
.opt-row select { width: auto; min-width: 150px; min-height: 42px; padding: 8px 12px; }
.opt-row .lab2 { display: flex; flex-direction: column; }
.opt-row .lab2 .hint { margin-top: 2px; }
.len { display: flex; align-items: center; gap: 12px; }
.len b { font-family: var(--mono); min-width: 2.5ch; text-align: right; font-size: 17px; }
.recent { display: flex; flex-direction: column; gap: 6px; }
.recent button { text-align: left; border: 1px solid var(--line); background: var(--bg2); border-radius: 10px; padding: 10px 12px; cursor: pointer; }

/* ------------------------------------------------------- security -------- */
.score { display: flex; align-items: center; gap: 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r2); padding: 18px; margin: 6px 0 16px; }
.score-ring { width: 96px; height: 96px; flex: none; position: relative; display: grid; place-items: center; }
.score-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.score-ring circle { fill: none; stroke-width: 9; }
.score-ring .bg { stroke: var(--line); }
.score-ring .fg { stroke-linecap: round; }
.score-ring b { font-size: 28px; }
.score h2 { font-size: 19px; margin-bottom: 4px; }
.score p { color: var(--muted); font-size: 14px; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 24px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat.bad b { color: var(--bad); }
.stat.warn b { color: var(--warn); }
.stat.ok b { color: var(--ok); }
.progress { height: 6px; border-radius: 9px; background: var(--line); overflow: hidden; margin: 10px 0; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ------------------------------------------------------- settings -------- */
.set-group { margin-bottom: 20px; }
.set-group > h3 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin: 0 6px 8px; }
.set-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 0 14px; }
.set-list > * + * { border-top: 1px solid var(--line); }
.set-btn { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; border: 0; background: none; text-align: left; cursor: pointer; padding: 10px 0; }
.set-btn .ic:first-child { color: var(--accent); }
.set-btn.danger, .set-btn.danger .ic:first-child { color: var(--bad); }
.set-btn span { flex: 1; display: flex; flex-direction: column; }
.set-btn .hint { margin-top: 2px; }
.set-btn .chev { color: var(--faint); }
.about { color: var(--muted); font-size: 14px; display: flex; flex-direction: column; gap: 12px; }
.about b { color: var(--text); }
.about h4 { margin: 8px 0 0; color: var(--text); font-size: 15px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); word-break: break-all; }

.scan video { width: 100%; border-radius: 14px; background: #000; aspect-ratio: 1; object-fit: cover; }

/* ------------------------------------------------------------- toasts ---- */
#toasts { position: fixed; left: 0; right: 0; bottom: calc(92px + var(--sab)); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; background: var(--raise); color: var(--text); border: 1px solid var(--line2); padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow); font-size: 14px; font-weight: 500; opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; max-width: 520px; }
.toast.in { opacity: 1; transform: none; }
.toast.bad { border-color: color-mix(in srgb, var(--bad) 60%, transparent); }

/* Privacy curtain: covers the vault while the app is in the background, so
   app switchers don't keep a screenshot of your passwords. */
#curtain { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: none; place-items: center; }
body.curtain #curtain { display: grid; }

/* ------------------------------------------------- wider screens --------- */
@media (min-width: 640px) {
  .scrim { align-items: center; padding: 24px; }
  .sheet, .sheet.small { height: auto; max-height: min(860px, calc(100dvh - 48px)); max-width: 560px; border-radius: var(--r2); border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); padding-bottom: 0; }
  .sheet.wide { max-width: 680px; }
  .sheet-head { padding: 10px 10px 10px 6px; }
  .sheet-foot { border-radius: 0 0 var(--r2) var(--r2); background: transparent; }
  .sheet-foot .btn { flex: 0 0 auto; min-width: 120px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  #toasts { bottom: 24px; }
}

@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 236px minmax(330px, 400px) 1fr; height: 100dvh; overflow: hidden; }
  .shell.full { grid-template-columns: 236px 1fr; }
  .tabs, .fab { display: none; }
  .rail { display: flex; flex-direction: column; gap: 4px; padding: 18px 12px; border-right: 1px solid var(--line); background: var(--bg2); }
  .rail-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 700; font-size: 16px; }
  .rail .nav { appearance: none; border: 0; background: none; display: flex; align-items: center; gap: 12px; padding: 0 12px; min-height: 44px; border-radius: 11px; font-weight: 600; color: var(--muted); cursor: pointer; text-align: left; }
  .rail .nav:hover { background: var(--panel); color: var(--text); }
  .rail .nav.on { background: var(--panel2); color: var(--text); }
  .rail .nav.on .ic { color: var(--accent); }
  .rail .grow { flex: 1; }
  .rail .btn { margin-top: 6px; }
  .rail .new { margin-bottom: 10px; }
  .page { padding-bottom: 24px; overflow-y: auto; min-height: 0; border-right: 1px solid var(--line); }
  .shell.full .page { border-right: 0; }
  .top { padding-top: 16px; }
  .detail, .detail.open { display: block; position: static; overflow-y: auto; animation: none; background: var(--bg); min-height: 0; }
  .detail-bar .back { display: none; }
  .detail-empty { display: flex; height: 100%; align-items: center; justify-content: center; flex-direction: column; gap: 14px; color: var(--faint); }
  .detail-empty .logo { opacity: .35; }
  .wrap { padding-top: 10px; }
  .row .chev { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* ------------------------------------------------------------- print ----- */
#print { display: none; }
@media print {
  body > *:not(#print) { display: none !important; }
  #print { display: block; color: #000; background: #fff; font: 12pt/1.45 system-ui, sans-serif; padding: 0; }
  #print h1 { font-size: 22pt; margin-bottom: 4pt; }
  #print .pk-row { border: 1.5pt solid #000; border-radius: 8pt; padding: 10pt 12pt; margin: 10pt 0; }
  #print .pk-lab { font-size: 9pt; text-transform: uppercase; letter-spacing: .1em; color: #444; }
  #print .pk-code { font: 600 16pt/1.3 var(--mono); letter-spacing: .06em; }
  #print .pk-blank { height: 28pt; border-bottom: 1pt solid #000; }
  #print .pk-grid { display: grid; grid-template-columns: 1fr 170pt; gap: 16pt; align-items: start; }
  #print canvas { width: 160pt; height: 160pt; image-rendering: pixelated; }
  #print .pk-note { font-size: 10pt; color: #333; }
}
