/* Citadel — design system */
:root {
  --bg: #070b14;
  --bg-2: #0b111d;
  --surface: #0f1726;
  --surface-2: #131d30;
  --surface-3: #1a263d;
  --elev: rgba(255, 255, 255, 0.035);
  --border: rgba(148, 163, 184, 0.12);
  --border-strong: rgba(148, 163, 184, 0.22);
  --text: #e6edf7;
  --text-2: #a5b1c4;
  --text-3: #6b7a92;
  --accent: #10b981;
  --accent-2: #34d399;
  --accent-3: #5eead4;
  --accent-ink: #022c22;
  --accent-soft: rgba(16, 185, 129, 0.12);
  --accent-glow: rgba(16, 185, 129, 0.35);
  --gold: #f5c35b;
  --danger: #f43f5e;
  --danger-soft: rgba(244, 63, 94, 0.12);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.12);
  --info: #38bdf8;
  --pw-digit: #7dd3fc;
  --pw-symbol: #fbbf24;
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.75);
  --radius: 14px;
  --radius-sm: 10px;
  --font: 'Inter', 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Mono', 'SF Mono', Consolas, ui-monospace, monospace;
  --hero: radial-gradient(1200px 600px at 10% -10%, rgba(16, 185, 129, 0.16), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(56, 189, 248, 0.09), transparent 60%);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    --bg: #f3f6fa; --bg-2: #eef2f7; --surface: #ffffff; --surface-2: #f7f9fc; --surface-3: #edf1f7;
    --elev: rgba(15, 23, 42, 0.03); --border: rgba(15, 23, 42, 0.09); --border-strong: rgba(15, 23, 42, 0.16);
    --text: #0f172a; --text-2: #475569; --text-3: #8391a7; --accent: #059669; --accent-2: #10b981; --accent-3: #0d9488;
    --accent-ink: #ffffff; --accent-soft: rgba(5, 150, 105, 0.1); --accent-glow: rgba(5, 150, 105, 0.25);
    --pw-digit: #0369a1; --pw-symbol: #b45309;
    --shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 30px 80px -20px rgba(15, 23, 42, 0.3);
    --hero: radial-gradient(1200px 600px at 10% -10%, rgba(16, 185, 129, 0.12), transparent 60%), radial-gradient(900px 500px at 110% 10%, rgba(56, 189, 248, 0.08), transparent 60%);
    color-scheme: light;
  }
}
:root[data-theme='light'] {
  --bg: #f3f6fa; --bg-2: #eef2f7; --surface: #ffffff; --surface-2: #f7f9fc; --surface-3: #edf1f7;
  --elev: rgba(15, 23, 42, 0.03); --border: rgba(15, 23, 42, 0.09); --border-strong: rgba(15, 23, 42, 0.16);
  --text: #0f172a; --text-2: #475569; --text-3: #8391a7; --accent: #059669; --accent-2: #10b981; --accent-3: #0d9488;
  --accent-ink: #ffffff; --accent-soft: rgba(5, 150, 105, 0.1); --accent-glow: rgba(5, 150, 105, 0.25);
  --pw-digit: #0369a1; --pw-symbol: #b45309;
  --shadow: 0 10px 30px -12px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 30px 80px -20px rgba(15, 23, 42, 0.3);
  --hero: radial-gradient(1200px 600px at 10% -10%, rgba(16, 185, 129, 0.12), transparent 60%), radial-gradient(900px 500px at 110% 10%, rgba(56, 189, 248, 0.08), transparent 60%);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent-glow); }
.ic { flex: none; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font-weight: 560; letter-spacing: 0.01em; transition: background 0.15s, border-color 0.15s, transform 0.08s, box-shadow 0.2s; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary {
  border: 0; color: var(--accent-ink);
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  box-shadow: 0 6px 18px -6px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn.primary:hover { filter: brightness(1.06); box-shadow: 0 10px 26px -8px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--elev); color: var(--text); }
.btn.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn.danger:hover { background: rgba(244, 63, 94, 0.2); }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent;
  color: var(--text-2); transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--elev); color: var(--text); }
.icon-btn.on { color: var(--gold); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 7px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-size: 12px; font-weight: 600; color: var(--text-2); letter-spacing: 0.02em; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input, select.input, textarea.input {
  width: 100%; height: 42px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--bg-2); color: var(--text); outline: none; transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
textarea.input { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface); }
.input.mono { font-family: var(--mono); letter-spacing: 0.02em; }
.input-wrap .input { padding-right: 84px; }
.input-actions { position: absolute; right: 4px; display: flex; gap: 2px; }
.input.lg { height: 50px; font-size: 16px; border-radius: 12px; }
.hint { font-size: 12px; color: var(--text-3); }
.error-text { color: var(--danger); font-size: 12.5px; min-height: 18px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

.switch { position: relative; width: 40px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 99px; transition: 0.2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 17px; height: 17px; left: 2px; top: 2px; border-radius: 50%; background: #fff; transition: 0.2s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(17px); }

input[type='range'] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 99px; background: var(--surface-3); outline: none; }
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 4px solid var(--accent); cursor: pointer; box-shadow: 0 2px 8px var(--accent-glow); }
input[type='range']::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 4px solid var(--accent); cursor: pointer; }
input[type='range']::-moz-range-progress { background: var(--accent); height: 6px; border-radius: 99px; }

/* ---------- strength meter ---------- */
.strength { display: flex; align-items: center; gap: 10px; }
.strength-track { display: flex; gap: 4px; flex: 1; }
.strength-track i { height: 5px; flex: 1; border-radius: 9px; background: var(--surface-3); transition: background 0.3s; }
.strength[data-score='0'] i.on { background: var(--danger); }
.strength[data-score='1'] i.on { background: #fb7185; }
.strength[data-score='2'] i.on { background: var(--warn); }
.strength[data-score='3'] i.on { background: var(--accent-2); }
.strength[data-score='4'] i.on { background: linear-gradient(90deg, var(--accent-2), var(--accent-3)); }
.strength-label { font-size: 12px; font-weight: 600; color: var(--text-2); min-width: 64px; text-align: right; }

.pw-color { font-family: var(--mono); word-break: break-all; }
.pw-color .d { color: var(--pw-digit); }
.pw-color .s { color: var(--pw-symbol); }

/* ---------- auth screens ---------- */
.auth { position: fixed; inset: 0; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--bg); }
.auth-art {
  position: relative; overflow: hidden; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  background: var(--hero), linear-gradient(160deg, #04140f 0%, #071a22 50%, #050912 100%); color: #e6edf7; border-right: 1px solid var(--border);
}
:root[data-theme='light'] .auth-art { color: #e6edf7; }
.auth-art .grid-bg {
  position: absolute; inset: 0; opacity: 0.35;
  background-image: linear-gradient(rgba(94, 234, 212, 0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(94, 234, 212, 0.07) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 70%);
}
.auth-art .orb { position: absolute; width: 520px; height: 520px; border-radius: 50%; right: -160px; bottom: -160px; background: radial-gradient(circle, rgba(16, 185, 129, 0.35), transparent 65%); filter: blur(20px); animation: float 12s ease-in-out infinite; }
@keyframes float { 50% { transform: translate(-30px, -40px) scale(1.06); } }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 750; font-size: 20px; letter-spacing: -0.01em; position: relative; }
.brand small { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--accent-3); }
.auth-art h1 { font-size: 44px; line-height: 1.08; letter-spacing: -0.03em; margin: 0 0 18px; font-weight: 760; position: relative; max-width: 520px; }
.auth-art h1 em { font-style: normal; background: linear-gradient(90deg, #5eead4, #34d399, #a7f3d0); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-art p { color: #9fb0c6; font-size: 16px; max-width: 480px; position: relative; }
.feature-list { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; position: relative; }
.feature-list li { display: flex; gap: 12px; align-items: flex-start; color: #c9d5e3; }
.feature-list li .ic { color: #34d399; margin-top: 2px; }
.feature-list b { color: #fff; font-weight: 620; }
.auth-foot { font-size: 12px; color: #6b7a92; position: relative; display: flex; gap: 18px; }
.auth-panel { display: grid; place-items: center; padding: 32px; overflow: auto; background: var(--hero), var(--bg); }
.auth-card { width: 100%; max-width: 420px; animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.auth-card h2 { font-size: 28px; letter-spacing: -0.02em; margin: 18px 0 6px; font-weight: 730; }
.auth-card .sub { color: var(--text-2); margin: 0 0 26px; }
.lock-badge { width: 76px; height: 76px; border-radius: 22px; display: grid; place-items: center; background: linear-gradient(160deg, var(--surface-3), var(--surface)); border: 1px solid var(--border-strong); box-shadow: var(--shadow), 0 0 0 8px var(--accent-soft); }
.steps { display: flex; gap: 6px; margin-bottom: 8px; }
.steps i { height: 4px; width: 28px; border-radius: 9px; background: var(--surface-3); }
.steps i.on { background: var(--accent); }
.recovery-code {
  font-family: var(--mono); font-size: 17px; letter-spacing: 0.06em; padding: 18px; border-radius: 12px; text-align: center; line-height: 1.9;
  background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 10px, var(--surface) 10px, var(--surface) 20px);
  border: 1px dashed var(--accent); color: var(--text); user-select: all;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px 10px;
}
.recovery-code span { white-space: nowrap; }
.check-row { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); margin: 18px 0; cursor: pointer; }
.check-row input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }
.link-btn { background: none; border: 0; color: var(--accent-2); padding: 0; font-weight: 560; }
.link-btn:hover { text-decoration: underline; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ---------- app shell ---------- */
.shell { position: fixed; inset: 0; display: grid; grid-template-columns: 248px 1fr; background: var(--bg); }
.sidebar { display: flex; flex-direction: column; padding: 18px 12px; background: var(--bg-2); border-right: 1px solid var(--border); overflow-y: auto; }
.sidebar .brand { padding: 4px 10px 20px; font-size: 18px; }
.nav-group { margin-bottom: 18px; }
.nav-title { font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); padding: 0 12px 8px; }
.nav-item {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; border: 0; background: transparent;
  color: var(--text-2); font-weight: 530; text-align: left; transition: background 0.12s, color 0.12s; position: relative;
}
.nav-item:hover { background: var(--elev); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--text); }
.nav-item.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-2); }
.nav-item.active .ic { color: var(--accent-2); }
.nav-item .count { margin-left: auto; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav-item .pill { margin-left: auto; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-2); }
.nav-item .pill.bad { background: var(--danger-soft); color: var(--danger); }
.nav-item .pill.mid { background: var(--warn-soft); color: var(--warn); }
.sidebar-foot { margin-top: auto; padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.sidebar-foot .meta { flex: 1; min-width: 0; font-size: 12px; color: var(--text-3); }
.sidebar-foot .meta b { display: block; color: var(--text); font-size: 13px; font-weight: 600; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 3px var(--accent-soft); margin-right: 6px; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--hero), var(--bg); }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--border); }
.search { position: relative; flex: 1; max-width: 560px; }
.search .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search input { width: 100%; height: 40px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); padding: 0 60px 0 40px; outline: none; color: var(--text); }
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--text-3); border: 1px solid var(--border-strong); border-radius: 6px; padding: 1px 6px; font-family: var(--mono); }
.topbar .spacer { flex: 1; }
.new-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; padding: 6px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); z-index: 50; animation: pop 0.14s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.menu button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; color: var(--text); }
.menu button:hover { background: var(--elev); }
.menu button .ic { color: var(--accent-2); }

.content { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 380px) 1fr; }
.content.single { grid-template-columns: 1fr; overflow-y: auto; }
.list-pane { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.list-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; }
.list-head h3 { margin: 0; font-size: 15px; font-weight: 680; }
.list-head .muted { color: var(--text-3); font-weight: 500; margin-left: 6px; }
.sort { background: transparent; border: 0; color: var(--text-3); font-size: 12px; display: flex; align-items: center; gap: 4px; }
.list { overflow-y: auto; padding: 0 10px 18px; flex: 1; }
.list-section { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); padding: 14px 10px 6px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; cursor: pointer; transition: background 0.12s; border: 1px solid transparent; }
.list-item:hover { background: var(--elev); }
.list-item.active { background: var(--surface-2); border-color: var(--border-strong); box-shadow: var(--shadow); }
.list-item .txt { min-width: 0; flex: 1; }
.list-item .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .s { color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .star { color: var(--gold); }
.list-item .flag { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); flex: none; }
.avatar { flex: none; border-radius: 11px; display: grid; place-items: center; color: #fff; font-weight: 750; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 4px 10px -4px rgba(0, 0, 0, 0.5); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }

.empty { display: grid; place-items: center; text-align: center; padding: 48px 24px; color: var(--text-3); height: 100%; }
.empty .art { width: 84px; height: 84px; border-radius: 26px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); margin: 0 auto 18px; }
.empty h4 { color: var(--text); font-size: 17px; margin: 0 0 6px; }
.empty p { margin: 0 0 18px; max-width: 320px; }

/* ---------- detail ---------- */
.detail { overflow-y: auto; padding: 28px 34px 48px; min-width: 0; }
.detail-head { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }
.detail-head .txt { flex: 1; min-width: 0; }
.detail-head h2 { margin: 0; font-size: 24px; font-weight: 720; letter-spacing: -0.02em; overflow-wrap: break-word; }
.detail-head .sub { color: var(--text-3); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.tools { display: flex; gap: 4px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.fields { overflow: hidden; }
.frow { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); min-height: 64px; }
.frow:last-child { border-bottom: 0; }
.frow .fl { flex: 1; min-width: 0; }
.frow .k { font-size: 11.5px; font-weight: 600; color: var(--text-3); letter-spacing: 0.03em; margin-bottom: 3px; }
.frow .v { font-size: 15px; overflow-wrap: anywhere; }
.frow .v.mono { font-family: var(--mono); font-size: 14.5px; }
.frow .v.masked { letter-spacing: 0.18em; color: var(--text-2); }
.frow .acts { display: flex; gap: 2px; opacity: 0.6; transition: opacity 0.15s; }
.frow:hover .acts { opacity: 1; }
.frow .strength { margin-top: 8px; max-width: 300px; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); margin: 26px 0 10px; display: flex; align-items: center; gap: 8px; }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.meta-grid .m { padding: 12px 14px; }
.meta-grid .m .k { font-size: 11px; color: var(--text-3); font-weight: 600; }
.meta-grid .m .v { font-size: 13px; margin-top: 2px; }
.notes { white-space: pre-wrap; overflow-wrap: anywhere; padding: 16px; line-height: 1.6; }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; font-size: 13px; }
.banner.bad { background: var(--danger-soft); color: #fda4af; }
:root[data-theme='light'] .banner.bad { color: #be123c; }
.banner.mid { background: var(--warn-soft); color: #fcd34d; }
:root[data-theme='light'] .banner.mid { color: #b45309; }
.banner.good { background: var(--accent-soft); color: var(--accent-2); }
.banner b { color: inherit; }

/* TOTP */
.totp { display: flex; align-items: center; gap: 12px; }
.totp .code { font-family: var(--mono); font-size: 22px; font-weight: 650; letter-spacing: 0.12em; color: var(--accent-2); }
.ring { width: 26px; height: 26px; flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3; }
.ring .bg { stroke: var(--surface-3); }
.ring .fg { stroke: var(--accent-2); stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke 0.3s; }
.ring.low .fg { stroke: var(--danger); }
.auth-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; padding: 24px; }
.otp-tile { padding: 16px; display: flex; flex-direction: column; gap: 14px; cursor: pointer; transition: transform 0.15s, border-color 0.15s; }
.otp-tile:hover { transform: translateY(-2px); border-color: var(--accent); }
.otp-tile .top { display: flex; gap: 12px; align-items: center; }
.otp-tile .code { font-family: var(--mono); font-size: 30px; font-weight: 650; letter-spacing: 0.14em; color: var(--text); }
.otp-tile .bottom { display: flex; align-items: center; justify-content: space-between; }

/* ---------- pages (health, generator, settings) ---------- */
.page { padding: 30px 36px 60px; max-width: 1100px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 28px; letter-spacing: -0.025em; font-weight: 740; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.health-hero { display: grid; grid-template-columns: 280px 1fr; gap: 18px; margin-bottom: 18px; }
.gauge-card { padding: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; position: relative; overflow: hidden; }
.gauge-card::before { content: ''; position: absolute; inset: -40% -40% auto; height: 220px; background: radial-gradient(circle, var(--accent-soft), transparent 70%); }
.gauge { position: relative; width: 190px; height: 190px; }
.gauge svg { width: 100%; height: 100%; transform: rotate(135deg); }
.gauge circle { fill: none; stroke-width: 14; stroke-linecap: round; }
.gauge .bg { stroke: var(--surface-3); }
.gauge .fg { transition: stroke-dashoffset 1.2s cubic-bezier(0.2, 0.8, 0.2, 1); }
.gauge .num { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; }
.gauge .num b { font-size: 52px; font-weight: 760; letter-spacing: -0.04em; line-height: 1; }
.gauge .num span { color: var(--text-3); font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; margin-top: 6px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.stat { padding: 18px; display: flex; gap: 14px; align-items: center; cursor: pointer; transition: border-color 0.15s, transform 0.15s; }
.stat:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.stat.sel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.stat .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; }
.stat .ico.bad { background: var(--danger-soft); color: var(--danger); }
.stat .ico.mid { background: var(--warn-soft); color: var(--warn); }
.stat .ico.info { background: rgba(56, 189, 248, 0.12); color: var(--info); }
.stat .ico.good { background: var(--accent-soft); color: var(--accent-2); }
.stat b { font-size: 26px; font-weight: 740; letter-spacing: -0.02em; display: block; line-height: 1.1; }
.stat span { color: var(--text-3); font-size: 12.5px; }
.issue-list .list-item { cursor: pointer; }
.tag { display: inline-flex; align-items: center; font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 99px; margin-left: 6px; }
.tag.bad { background: var(--danger-soft); color: var(--danger); }
.tag.mid { background: var(--warn-soft); color: var(--warn); }
.tag.info { background: rgba(56, 189, 248, 0.12); color: var(--info); }

.gen-hero { padding: 26px; position: relative; overflow: hidden; }
.gen-out { font-size: 26px; min-height: 76px; display: flex; align-items: center; padding: 18px 20px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--border); margin-bottom: 16px; line-height: 1.35; }
.gen-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.seg { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border); gap: 4px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; color: var(--text-2); font-weight: 600; }
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow); }
.opt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 26px; margin-top: 20px; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.slider-row { display: flex; align-items: center; gap: 16px; margin-top: 20px; }
.slider-row .val { font-family: var(--mono); font-size: 18px; font-weight: 700; min-width: 40px; text-align: right; }
.entropy { display: flex; gap: 22px; margin-top: 14px; color: var(--text-3); font-size: 12.5px; flex-wrap: wrap; }
.entropy b { color: var(--text); }

.settings { display: grid; gap: 18px; }
.set-card { padding: 6px 0; }
.set-card h3 { margin: 0; padding: 16px 20px 6px; font-size: 15px; display: flex; gap: 10px; align-items: center; }
.set-card h3 .ic { color: var(--accent-2); }
.set-row { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-top: 1px solid var(--border); }
.set-card h3 + .set-row { border-top: 0; }
.set-row .txt { flex: 1; min-width: 0; }
.set-row .txt b { font-weight: 600; display: block; }
.set-row .txt span { color: var(--text-3); font-size: 12.5px; }
.set-row select.input { width: auto; min-width: 150px; height: 36px; }

/* ---------- sync ---------- */
.or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; margin: 16px 0; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--border-strong); }
.qr { display: grid; place-items: center; padding: 14px; border-radius: 16px; background: #fff; width: max-content; margin: 16px auto 0; box-shadow: 0 0 0 6px var(--accent-soft); }
.qr img { display: block; image-rendering: pixelated; width: 220px; height: 220px; }
.sync-code { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border); font-size: 11.5px; word-break: break-all; color: var(--text-2); max-height: 80px; overflow: auto; }
.steps-list { margin: 0; padding-left: 20px; color: var(--text-2); display: grid; gap: 6px; }
.steps-list b { color: var(--text); }
.tag.good { background: var(--accent-soft); color: var(--accent-2); }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(2, 6, 14, 0.62); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 100; padding: 20px; animation: fade 0.15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px; box-shadow: var(--shadow-lg); animation: rise 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }
.modal.sm { max-width: 420px; }
.modal-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 17px; flex: 1; }
.modal-body { padding: 20px 22px 6px; overflow-y: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 22px 18px; border-top: 1px solid var(--border); }
.modal-foot .left { margin-right: auto; }
.gen-inline { margin-top: -8px; margin-bottom: 16px; padding: 12px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border); }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 12px; background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); font-weight: 560; opacity: 0; transform: translateY(10px); transition: 0.25s; }
.toast.show { opacity: 1; transform: none; }
.toast.ok .ic { color: var(--accent-2); }
.toast.err .ic { color: var(--danger); }

/* ---------- compact desktop (small windows / tablets) ---------- */
@media (min-width: 861px) and (max-width: 1150px) {
  .shell { grid-template-columns: 72px 1fr; }
  .sidebar { padding: 18px 10px; align-items: center; }
  .sidebar .brand { padding: 4px 0 20px; }
  .sidebar .brand > div, .nav-title, .nav-item .count, .nav-item .pill, .sidebar-foot .meta { display: none; }
  .nav-group { width: 100%; margin-bottom: 10px; }
  .nav-item { font-size: 0; justify-content: center; padding: 11px 0; }
  .nav-item.active::before { left: -10px; }
  .sidebar-foot { padding: 6px; justify-content: center; }
  .content { grid-template-columns: minmax(260px, 320px) 1fr; }
  .detail { padding: 24px 24px 40px; }
}

/* ---------- mobile ---------- */
.mobile-only { display: none !important; }
.tabbar { display: none; }
@media (max-width: 860px) {
  body { font-size: 15px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-panel { padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); place-items: start center; padding-top: calc(48px + env(safe-area-inset-top)); }
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .sidebar { display: none; }
  .mobile-only { display: inherit !important; }
  .desktop-only { display: none !important; }
  .topbar { padding: calc(12px + env(safe-area-inset-top)) 16px 12px; }
  .search { max-width: none; }
  .kbd { display: none; }
  .content { grid-template-columns: 1fr; position: relative; }
  .content .detail { position: absolute; inset: 0; background: var(--bg); z-index: 5; padding: 18px 18px 40px; transform: translateX(100%); transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1); }
  .content.show-detail .detail { transform: none; }
  .list-pane { border-right: 0; }
  .list-item { padding: 12px 10px; }
  .page { padding: 20px 16px 40px; }
  .page-head h1 { font-size: 24px; }
  .health-hero { grid-template-columns: 1fr; }
  .opt-grid { grid-template-columns: 1fr; }
  .auth-grid { padding: 16px; grid-template-columns: 1fr; }
  .tabbar { display: flex; justify-content: space-around; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--bg-2); border-top: 1px solid var(--border); }
  .tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; border: 0; background: transparent; color: var(--text-3); font-size: 10.5px; font-weight: 600; padding: 6px 0; border-radius: 10px; }
  .tabbar button.active { color: var(--accent-2); }
  .fab { position: fixed; right: 18px; bottom: calc(78px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 18px; border: 0; color: var(--accent-ink); background: linear-gradient(180deg, var(--accent-2), var(--accent)); box-shadow: 0 12px 30px -8px var(--accent-glow); display: grid; place-items: center; z-index: 20; }
  .modal { max-height: calc(100vh - 20px); border-radius: 20px; }
  .overlay { padding: 10px; align-items: end; }
  .frow .acts { opacity: 1; }
  .detail-head h2 { font-size: 21px; }
  .set-row { flex-wrap: wrap; padding: 14px 16px; }
  .set-row .txt { flex: 1 1 55%; }
  .set-row select.input { flex: 1 1 100%; width: 100%; }
  .fab.hidden { display: none; }
}
@media (min-width: 861px) { .fab { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
