/* =========================================================================
   Vault — application styles.  Dark, dense, NanoCore.
   Colour is reserved for meaning: vault tints, strength, alerts, code timers.
   ========================================================================= */

.app { min-height: 100dvh; }
.boot { display: grid; place-items: center; min-height: 100dvh; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); border-top-color: #fff; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- generic controls ------------------------------------------------------- */
.input, .field input, .field textarea, .field select {
  width: 100%; min-height: var(--tap); padding: 11px 14px;
  background: var(--panel-3); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--fg); font-size: 15px; transition: border-color var(--fast), box-shadow var(--fast);
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.input::placeholder, .field input::placeholder, .field textarea::placeholder { color: var(--ghost); }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: rgba(255,255,255,0.6); box-shadow: 0 0 0 3px rgba(255,255,255,0.07); }
.field { display: block; margin-bottom: 14px; }
.field > span, .field > label, .label { display: block; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.field--row { display: flex; gap: 8px; align-items: flex-end; }
.field--row > * { flex: 1; }
.field .mono-in { font-family: var(--font-mono); font-size: 14px; letter-spacing: 0.02em; }
.hint { font-size: 12.5px; color: var(--faint); margin-top: 6px; line-height: 1.45; }
.iconbtn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-xs); border: 0; background: none; color: var(--muted); cursor: pointer; transition: background var(--fast), color var(--fast); flex: 0 0 auto; }
.iconbtn:hover { background: var(--hover); color: var(--fg); }
.iconbtn.is-on { color: #fbbf24; }
.linkbtn { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px 0; }
.linkbtn:hover { color: var(--fg); text-decoration: underline; }
.btn--danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger-solid:hover:not(:disabled) { box-shadow: 0 0 0 1px var(--danger), 0 0 24px rgba(239,68,68,0.3); border-color: var(--danger); }
.btn--ghost { background: transparent; }
.btn--block { width: 100%; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); font-size: 12px; color: var(--fg-dim); white-space: nowrap; cursor: pointer; transition: border-color var(--fast), color var(--fast); min-height: 28px; }
.chip:hover { border-color: var(--line-hard); color: var(--fg); }
.chip.is-on { background: #fff; color: #000; border-color: #fff; }
.chip__dot { width: 8px; height: 8px; border-radius: 50%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600; color: #fff; flex: 0 0 auto; letter-spacing: 0.02em; }
.avatar--lg { width: 44px; height: 44px; font-size: 14px; }
.tile { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 14px; color: #fff; flex: 0 0 auto; text-shadow: 0 1px 2px rgba(0,0,0,0.4); }
.tile.lg { width: 56px; height: 56px; font-size: 20px; border-radius: 14px; }
.tile.sm { width: 28px; height: 28px; font-size: 10px; border-radius: 7px; }
.kbd { font-family: var(--font-mono); font-size: 10px; padding: 2px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; color: var(--muted); background: var(--panel-2); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; border: 1px solid var(--line); color: var(--muted); }
.pill--ok { color: var(--ok); border-color: rgba(34,197,94,0.4); }
.pill--warn { color: var(--warn); border-color: rgba(245,158,11,0.4); }
.pill--danger { color: var(--danger); border-color: rgba(239,68,68,0.4); }
.pill--accent { color: #d8b4fe; border-color: rgba(168,85,247,0.45); }
.meter { display: flex; gap: 3px; margin-top: 8px; }
.meter i { flex: 1; height: 3px; border-radius: 2px; background: var(--line); }
.meter[data-score="1"] i:nth-child(-n+1), .meter[data-score="2"] i:nth-child(-n+2) { background: var(--danger); }
.meter[data-score="2"] i:nth-child(-n+2) { background: var(--warn); }
.meter[data-score="3"] i:nth-child(-n+3) { background: #a3e635; }
.meter[data-score="4"] i:nth-child(-n+5) { background: var(--ok); }
.meter[data-score="0"] i:first-child { background: var(--danger); }

/* --- auth screens ------------------------------------------------------------ */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 28px 20px calc(28px + env(safe-area-inset-bottom)); background: radial-gradient(1200px 600px at 50% -10%, rgba(168,85,247,0.08), transparent 60%), #000; }
.auth__card { width: 100%; max-width: 440px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 38px 34px 30px; box-shadow: var(--shadow); position: relative; overflow: hidden; animation: auth-in 0.3s var(--ease) both; }
.auth__card--wide { max-width: 560px; }
@keyframes auth-in { from { opacity: 0; transform: translateY(12px) scale(0.985); } to { opacity: 1; transform: none; } }
.auth__card::before { content: ""; position: absolute; top: 0; left: 12%; right: 12%; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.75), transparent); }
.auth__brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 26px; text-align: center; }
.auth__emblem { position: relative; width: 74px; height: 74px; display: grid; place-items: center; }
.auth__emblem img { width: 46px; height: 46px; object-fit: contain; }
.auth__emblem::before { content: ""; position: absolute; inset: 0; border-radius: 22px; border: 1px solid var(--line); }
.auth__emblem::after { content: ""; position: absolute; inset: -8px; border-radius: 28px; border: 1px solid var(--line-soft); border-top-color: rgba(255,255,255,0.5); animation: spin 9s linear infinite; }
.auth__wordmark { font-family: var(--font-display); font-size: 28px; letter-spacing: 0.18em; text-transform: uppercase; line-height: 1; }
.auth__tagline { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.34em; text-transform: uppercase; color: var(--faint); margin-top: 9px; }
.auth__who { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); margin-bottom: 18px; background: var(--panel); }
.auth__who b { display: block; font-size: 14px; }
.auth__who span { font-size: 12px; color: var(--muted); }
.auth__who button { margin-left: auto; }
.auth__error { display: none; background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.4); color: #fca5a5; border-radius: var(--radius-sm); padding: 10px 13px; font-size: 13.5px; margin-bottom: 16px; }
.auth__error.is-on { display: block; }
.auth__note { font-size: 13.5px; color: var(--fg-dim); line-height: 1.55; margin-bottom: 18px; }
.auth__submit { width: 100%; margin-top: 6px; }
.auth__bio { width: 100%; margin-bottom: 14px; padding: 16px; gap: 12px; font-size: 13px; }
.auth__bio svg { width: 22px; height: 22px; }
.auth__or { display: flex; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ghost); margin: 8px 0 14px; }
.auth__or::before, .auth__or::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.auth__links { display: flex; justify-content: space-between; margin-top: 18px; font-size: 12.5px; color: var(--muted); }
.auth__links a, .auth__links button { color: var(--muted); background: none; border: 0; cursor: pointer; font-size: inherit; }
.auth__links a:hover, .auth__links button:hover { color: var(--fg); text-decoration: underline; }
.auth__foot { text-align: center; margin-top: 22px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ghost); }
.auth__foot a:hover { color: var(--fg); }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 56px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 34px; padding: 0 10px; background: none; border: 0; cursor: pointer; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.pw-toggle:hover { color: var(--fg); }
.progress { height: 3px; background: var(--line-soft); border-radius: 2px; overflow: hidden; margin: 14px 0 0; }
.progress i { display: block; height: 100%; width: 0; background: #fff; transition: width 0.3s var(--ease); }
.progress.is-busy i { width: 100%; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

/* Emergency kit */
.kit { border: 1px dashed var(--line-hard); border-radius: var(--radius-sm); padding: 18px; background: var(--panel); margin: 16px 0; }
.kit__key { font-family: var(--font-mono); font-size: 17px; letter-spacing: 0.05em; word-break: break-all; text-align: center; padding: 12px 0; user-select: all; }
.kit__meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; color: var(--fg-dim); }
.kit__meta b { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); align-self: center; }
.kit__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13.5px; color: var(--fg-dim); margin: 14px 0 6px; }
.check input { width: 18px; height: 18px; margin-top: 1px; accent-color: #fff; }

/* --- shell ------------------------------------------------------------------ */
.shell { display: grid; grid-template-columns: var(--rail) 1fr; grid-template-areas: "rail main"; height: 100dvh; overflow: hidden; }
.shell.has-panel { grid-template-columns: var(--rail) minmax(340px, 1fr) minmax(420px, 46%); grid-template-areas: "rail main panel"; }
.rail { grid-area: rail; background: var(--bg-1); border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; min-height: 0; }
.rail__brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 12px; font-family: var(--font-display); font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; font-size: 15px; }
.rail__brand img { width: 24px; height: 24px; }
.rail__brand .sub { margin-left: auto; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.24em; color: var(--ghost); font-weight: 400; }
.rail__scroll { flex: 1; overflow-y: auto; min-height: 0; padding-bottom: 12px; }
.rail__section { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--ghost); padding: 16px 16px 6px; display: flex; align-items: center; }
.rail__section button { margin-left: auto; }
.rail__link { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 16px 9px 13px; border: 0; border-left: 3px solid transparent; background: none; color: var(--fg-dim); font-size: 13.5px; text-align: left; cursor: pointer; transition: background var(--fast), color var(--fast); min-height: 38px; }
.rail__link:hover { background: var(--hover); color: var(--fg); }
.rail__link.is-active { background: var(--active); color: var(--fg); border-left-color: #fff; }
.rail__link svg { flex: 0 0 auto; opacity: 0.75; }
.rail__link .dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.rail__link .txt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail__link .count { font-family: var(--font-mono); font-size: 10px; color: var(--ghost); }
.rail__link .count.is-warn { color: var(--warn); }
.rail__foot { border-top: 1px solid var(--line-soft); padding: 10px; display: flex; align-items: center; gap: 8px; }
.userbtn { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 6px 8px; border-radius: var(--radius-sm); border: 0; background: none; color: var(--fg-dim); cursor: pointer; text-align: left; }
.userbtn:hover { background: var(--hover); color: var(--fg); }
.userbtn__name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userbtn__sub { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.14em; color: var(--ghost); text-transform: uppercase; display: flex; align-items: center; gap: 5px; }
.live { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.live.is-on { background: var(--ok); box-shadow: 0 0 8px rgba(34,197,94,0.7); }

.main { grid-area: main; display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg); }
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); min-height: var(--topbar); flex: 0 0 auto; }
.topbar__title { font-family: var(--font-display); font-size: 17px; white-space: nowrap; }
.topbar__count { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.14em; color: var(--ghost); }
.topbar__spacer { flex: 1; }
.search { position: relative; flex: 1; max-width: 520px; }
.search input { width: 100%; min-height: 38px; padding: 8px 12px 8px 36px; background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 999px; color: var(--fg); font-size: 14px; }
.search input:focus { outline: none; border-color: var(--line-hard); }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.filterbar { display: flex; gap: 6px; padding: 10px 18px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; scrollbar-width: none; flex: 0 0 auto; align-items: center; }
.filterbar::-webkit-scrollbar { display: none; }
.content { flex: 1; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }
.content--pad { padding: 20px 22px 60px; }
.empty { text-align: center; padding: 70px 24px; color: var(--muted); }
.empty h2 { font-size: 20px; color: var(--fg); margin: 12px 0 6px; }
.empty p { font-size: 14px; margin-bottom: 18px; max-width: 380px; margin-inline: auto; line-height: 1.55; }
.empty svg { opacity: 0.35; }

/* --- item list -------------------------------------------------------------- */
.list { display: flex; flex-direction: column; }
.list__group { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--faint); padding: 14px 18px 4px; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.row { display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: center; padding: 9px 18px; border: 0; border-bottom: 1px solid var(--line-soft); background: none; color: inherit; text-align: left; width: 100%; cursor: pointer; transition: background var(--fast); min-height: 60px; }
.row:hover { background: var(--hover); }
.row.is-active { background: var(--active); box-shadow: inset 3px 0 0 #fff; }
.row.is-focus { outline: 2px solid rgba(255,255,255,0.5); outline-offset: -2px; }
.row__main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row__name { font-size: 14.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.row__name .star { color: #fbbf24; }
.row__sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.row__sub .dot { width: 7px; height: 7px; border-radius: 2px; flex: 0 0 auto; }
.row__tags { display: flex; gap: 4px; }
.row__tags span { font-size: 10.5px; padding: 1px 6px; border-radius: 4px; background: var(--panel-3); color: var(--muted); }
.row__acts { display: flex; gap: 2px; opacity: 0; transition: opacity var(--fast); }
.row:hover .row__acts, .row.is-active .row__acts, .row:focus-within .row__acts { opacity: 1; }
.row__code { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.1em; color: var(--fg-dim); display: flex; align-items: center; gap: 8px; }
.row__code .ring { width: 14px; height: 14px; }
.row .pill { margin-left: 4px; }
@media (pointer: coarse) { .row__acts { opacity: 1; } }

/* countdown ring */
.ring { width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(var(--ring-c, #fff) calc(var(--p, 1) * 360deg), var(--line) 0); position: relative; flex: 0 0 auto; }
.ring::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--panel-2); }
.ring.is-low { --ring-c: var(--danger); }

/* --- item panel ------------------------------------------------------------- */
.panel { grid-area: panel; background: var(--panel); border-left: 1px solid var(--line-soft); display: flex; flex-direction: column; min-height: 0; min-width: 0; animation: panel-in 0.25s var(--ease); }
@keyframes panel-in { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.panel__head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); flex: 0 0 auto; }
.panel__head h2 { font-size: 18px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel__head .sub { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; margin-top: 2px; }
.panel__body { flex: 1; overflow-y: auto; padding: 16px 16px 60px; min-height: 0; }
.panel__foot { display: flex; gap: 8px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); flex: 0 0 auto; background: var(--panel); }
.panel__foot .spacer { flex: 1; }
.kv { border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--panel-2); margin-bottom: 12px; overflow: hidden; }
.kv__row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 10px 6px 10px 14px; border-bottom: 1px solid var(--line-soft); min-height: 56px; }
.kv__row:last-child { border-bottom: 0; }
.kv__row.is-click { cursor: pointer; }
.kv__row.is-click:hover { background: var(--hover); }
.kv__k { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }
.kv__v { font-size: 14.5px; word-break: break-all; min-width: 0; }
.kv__v.mono { font-family: var(--font-mono); font-size: 13.5px; letter-spacing: 0.04em; text-transform: none; }
.kv__v.hidden-v { letter-spacing: 0.2em; color: var(--fg-dim); }
.kv__v a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--line-hard); }
.kv__v pre { white-space: pre-wrap; font-family: inherit; font-size: 14px; line-height: 1.55; }
.kv__acts { display: flex; gap: 0; }
.kv__code { display: flex; align-items: center; gap: 12px; }
.kv__code .code { font-family: var(--font-mono); font-size: 24px; letter-spacing: 0.14em; }
.kv__code .next { font-family: var(--font-mono); font-size: 11px; color: var(--ghost); }
.section { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--ghost); margin: 20px 0 8px; display: flex; align-items: center; gap: 10px; }
.section::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { font-size: 12px; padding: 3px 9px; border-radius: 6px; background: var(--panel-3); color: var(--fg-dim); }
.pwbig { font-family: var(--font-mono); font-size: 34px; letter-spacing: 0.12em; word-break: break-all; text-align: center; line-height: 1.5; padding: 20px 10px; }
.pwbig .d { color: #93c5fd; } .pwbig .s { color: #fca5a5; } .pwbig .u { color: #fff; } .pwbig .l { color: var(--fg-dim); }
.pwcol .d { color: #93c5fd; } .pwcol .s { color: #fca5a5; }
.history { display: flex; flex-direction: column; gap: 6px; }
.hist { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); font-size: 13px; }
.hist .when { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); flex: 1; }
.hist .what { color: var(--fg-dim); }

/* editor */
.editor .field { margin-bottom: 12px; }
.editor .type-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.type-pick button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--panel-2); color: var(--muted); font-size: 11px; cursor: pointer; }
.type-pick button:hover { border-color: var(--line-hard); color: var(--fg); }
.type-pick button.is-on { background: #fff; color: #000; border-color: #fff; }
.urls, .fields { display: flex; flex-direction: column; gap: 6px; }
.fields .frow { display: grid; grid-template-columns: 1fr 1.5fr auto; gap: 6px; align-items: center; }
.fields .frow select { min-height: 40px; }
.urls .frow { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.frow input { min-height: 40px; padding: 8px 12px; font-size: 14px; }
.addrow { justify-self: start; }
.tagin { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-3); min-height: 44px; }
.tagin span { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; background: var(--panel); font-size: 13px; }
.tagin span button { background: none; border: 0; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.tagin input { flex: 1; min-width: 100px; background: none; border: 0; padding: 4px 6px; font-size: 14px; }
.tagin input:focus { outline: none; }
.pwfield { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; align-items: center; }
.pwfield input { font-family: var(--font-mono); font-size: 14px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 24px; height: 24px; border-radius: 7px; border: 0; cursor: pointer; transition: transform var(--fast); }
.swatch:hover { transform: scale(1.1); }
.swatch.is-on { box-shadow: 0 0 0 2px #000, 0 0 0 4px #fff; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.toggle:last-child { border-bottom: 0; }
.toggle b { font-size: 14px; font-weight: 500; display: block; }
.toggle small { font-size: 12.5px; color: var(--muted); display: block; margin-top: 2px; line-height: 1.4; }
.switch { position: relative; width: 40px; height: 22px; border-radius: 11px; background: var(--panel-3); border: 1px solid var(--line); flex: 0 0 auto; transition: background var(--fast); }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform var(--fast), background var(--fast); }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle input:checked + .switch { background: #fff; border-color: #fff; }
.toggle input:checked + .switch::after { transform: translateX(18px); background: #000; }

/* --- codes view ------------------------------------------------------------- */
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; padding: 16px 18px 80px; }
.code-card { display: grid; grid-template-columns: 38px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--panel-2); cursor: pointer; text-align: left; color: inherit; transition: border-color var(--fast), background var(--fast); }
.code-card:hover { border-color: var(--line-hard); background: var(--panel-3); }
.code-card__name { font-size: 13.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-card__acct { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-card__code { font-family: var(--font-mono); font-size: 22px; letter-spacing: 0.12em; margin-top: 4px; font-weight: 500; }
.code-card__code.is-low { color: var(--danger); }
.code-card__code.is-hidden { letter-spacing: 0.25em; color: var(--faint); }
.code-card__next { font-family: var(--font-mono); font-size: 10.5px; color: var(--ghost); }
.code-card .ring { width: 30px; height: 30px; }
.code-card .ring::after { background: var(--panel-2); }
.code-card:hover .ring::after { background: var(--panel-3); }
.code-card__hotp { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; color: var(--muted); }
.qrbox { display: grid; place-items: center; padding: 14px; background: #fff; border-radius: var(--radius-sm); margin: 14px auto; max-width: 260px; }
.qrbox svg { width: 100%; height: auto; }
.scan { position: relative; border-radius: var(--radius-sm); overflow: hidden; background: #000; aspect-ratio: 1; max-width: 360px; margin: 0 auto 12px; }
.scan video { width: 100%; height: 100%; object-fit: cover; }
.scan::after { content: ""; position: absolute; inset: 14%; border: 2px solid rgba(255,255,255,0.7); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0,0,0,0.35); }

/* --- generator -------------------------------------------------------------- */
.gen { max-width: 640px; margin: 0 auto; }
.gen__out { position: relative; font-family: var(--font-mono); font-size: 22px; letter-spacing: 0.06em; word-break: break-all; padding: 22px 60px 22px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); line-height: 1.5; min-height: 84px; }
.gen__out .refresh { position: absolute; right: 10px; top: 10px; }
.gen__out.gen__out--phrase { font-size: 20px; }
.gen__modes { display: flex; gap: 4px; background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 999px; padding: 3px; margin: 14px 0; }
.gen__modes button { flex: 1; padding: 8px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; cursor: pointer; }
.gen__modes button.is-on { background: var(--panel-3); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); }
.gen__opts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; padding: 14px 0; }
.gen__opts .toggle { padding: 9px 0; }
.range { display: flex; align-items: center; gap: 12px; padding: 12px 0; grid-column: 1 / -1; }
.range input[type=range] { flex: 1; accent-color: #fff; }
.range b { font-family: var(--font-mono); font-size: 14px; min-width: 32px; text-align: right; }
.gen__actions { display: flex; gap: 8px; margin-top: 10px; }
.gen__strength { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.gen__hist { margin-top: 26px; }
.gen__hist button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line-soft); background: none; color: var(--fg-dim); font-family: var(--font-mono); font-size: 13px; text-align: left; cursor: pointer; }
.gen__hist button:hover { background: var(--hover); color: var(--fg); }
.gen__hist button span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gen__hist button small { font-family: var(--font-body); font-size: 11px; color: var(--ghost); }

/* --- watchtower ------------------------------------------------------------- */
.wt { max-width: 900px; margin: 0 auto; }
.wt__score { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; padding: 22px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel-2); margin-bottom: 16px; }
.wt__num { font-family: var(--font-display); font-size: 56px; font-weight: 700; line-height: 1; }
.wt__num small { font-size: 18px; color: var(--muted); font-weight: 500; }
.wt__bar { height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.wt__bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--danger), var(--warn), var(--ok)); border-radius: 3px; }
.wt__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 20px; }
.wt__card { padding: 16px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--panel-2); text-align: left; color: inherit; cursor: pointer; transition: border-color var(--fast); display: flex; flex-direction: column; gap: 4px; }
.wt__card:hover { border-color: var(--line-hard); }
.wt__card.is-on { border-color: #fff; }
.wt__card b { font-family: var(--font-display); font-size: 28px; font-weight: 600; }
.wt__card b.is-bad { color: var(--danger); } .wt__card b.is-meh { color: var(--warn); } .wt__card b.is-ok { color: var(--ok); }
.wt__card span { font-size: 13px; color: var(--fg-dim); }
.wt__card small { font-size: 11.5px; color: var(--faint); line-height: 1.4; }
.wt__list .row { padding-inline: 12px; }

/* --- settings --------------------------------------------------------------- */
.settings { max-width: 720px; margin: 0 auto; }
.card { border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--panel-2); padding: 18px 20px; margin-bottom: 14px; }
.card h3 { font-size: 16px; margin-bottom: 4px; }
.card > p { font-size: 13.5px; color: var(--muted); margin-bottom: 14px; line-height: 1.5; }
.card .btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.devrow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.devrow:last-child { border-bottom: 0; }
.devrow .who { flex: 1; min-width: 0; }
.devrow .who b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.devrow .who small { color: var(--muted); font-size: 12px; }
.fp { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.04em; padding: 10px 12px; border: 1px dashed var(--line-hard); border-radius: var(--radius-xs); background: var(--panel); color: var(--fg-dim); word-break: break-word; }
.stat { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 14px; }
.stat div { padding: 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--panel); }
.stat b { font-family: var(--font-display); font-size: 22px; display: block; }
.stat span { font-size: 11.5px; color: var(--muted); }
.act { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; align-items: flex-start; }
.act:last-child { border-bottom: 0; }
.act .when { font-family: var(--font-mono); font-size: 10.5px; color: var(--ghost); white-space: nowrap; margin-left: auto; }
.act .what { color: var(--fg-dim); }
.act .what b { color: var(--fg); font-weight: 500; }

/* --- popovers, modals, toasts ------------------------------------------------ */
.pop { position: fixed; z-index: var(--z-pop); min-width: 200px; max-width: min(360px, calc(100vw - 20px)); max-height: min(70vh, 480px); overflow-y: auto; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: 5px; animation: pop-in 0.14s var(--ease); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.pop__head { padding: 7px 11px 5px; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ghost); }
.pop__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: 0; border-radius: var(--radius-xs); background: none; color: var(--fg-dim); font-size: 13.5px; text-align: left; cursor: pointer; min-height: 38px; }
.pop__item:hover { background: var(--hover); color: var(--fg); }
.pop__item.is-active { color: var(--fg); }
.pop__item.is-danger { color: #fca5a5; }
.pop__item.is-danger:hover { background: rgba(239,68,68,0.13); }
.pop__item svg:last-child { margin-left: auto; }
.pop__dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.pop__label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop__sub { color: var(--ghost); font-size: 11px; margin-left: 6px; }
.pop__sep { height: 1px; background: var(--line-soft); margin: 5px 4px; }
.modal-back { position: fixed; inset: 0; z-index: var(--z-modal); background: rgba(0,0,0,0.7); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; opacity: 0; transition: opacity 0.18s var(--ease); }
.modal-back.is-in { opacity: 1; }
.modal { width: 100%; max-width: 460px; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); transform: translateY(8px); transition: transform 0.18s var(--ease); }
.modal-back.is-in .modal { transform: none; }
.modal--wide { max-width: 640px; }
.modal__title { font-size: 19px; margin-bottom: 10px; }
.modal__body { color: var(--fg-dim); font-size: 14px; margin-bottom: 16px; line-height: 1.55; }
.modal__foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.toasts { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; padding: 10px 16px; background: #fff; color: #000; border-radius: 999px; font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-sm); opacity: 0; transform: translateY(8px); transition: opacity 0.22s var(--ease), transform 0.22s var(--ease); white-space: nowrap; }
.toast.is-in { opacity: 1; transform: none; }
.toast--error { background: var(--danger); color: #fff; }

/* --- lock banner / offline ---------------------------------------------------- */
.banner { display: flex; align-items: center; gap: 10px; padding: 8px 18px; font-size: 12.5px; background: rgba(245,158,11,0.1); color: #fcd34d; border-bottom: 1px solid rgba(245,158,11,0.25); }
.banner--info { background: rgba(59,130,246,0.1); color: #93c5fd; border-color: rgba(59,130,246,0.25); }
.banner button { margin-left: auto; }

/* --- mobile ----------------------------------------------------------------- */
.bottomnav { display: none; }
@media (max-width: 900px) {
  .shell, .shell.has-panel { grid-template-columns: 1fr; grid-template-areas: "main"; }
  .rail { display: none; }
  .shell.has-panel .main { display: none; }
  .panel { grid-area: main; border-left: 0; animation: panel-up 0.25s var(--ease); }
  @keyframes panel-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
  .main { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-panel); background: rgba(6,7,8,0.92); backdrop-filter: blur(14px); border-top: 1px solid var(--line-soft); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bottomnav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border: 0; background: none; color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; cursor: pointer; min-height: 48px; }
  .bottomnav button.is-active { color: var(--fg); }
  .bottomnav button.is-active svg { filter: drop-shadow(0 0 6px rgba(255,255,255,0.5)); }
  .shell.has-panel .bottomnav { display: none; }
  .topbar { padding: 10px 14px; flex-wrap: wrap; }
  .search { max-width: none; flex-basis: 100%; order: 10; }
  .search .kbd { display: none; }
  .row { padding: 10px 14px; }
  .row__acts .iconbtn[data-secondary] { display: none; }
  .codes { grid-template-columns: 1fr; padding: 10px 12px 90px; }
  .content--pad { padding: 16px 14px 90px; }
  .gen__opts { grid-template-columns: 1fr; }
  .editor .type-pick { grid-template-columns: repeat(4, 1fr); }
  .panel__body { padding: 14px 14px 100px; }
  .fields .frow { grid-template-columns: 1fr; }
  .fields .frow .iconbtn { justify-self: end; }
}
@media (max-width: 1180px) {
  .shell.has-panel { grid-template-columns: var(--rail) minmax(300px, 1fr) minmax(380px, 50%); }
}
@media (max-width: 900px) and (min-width: 721px) { .codes { grid-template-columns: 1fr 1fr; } }

/* --- print (Emergency Kit) -------------------------------------------------- */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .no-print { display: none !important; }
  .kit { border-color: #000; color: #000; background: #fff; }
  .kit__key { color: #000; }
}
