/* =====================================================================
   PassVault v2 — design tokens
   ===================================================================== */
:root {
  --accent: #02d0f5;
  --accent-text: #001b22;
  --accent-hi: color-mix(in srgb, var(--accent) 70%, #fff);
  --accent-lo: color-mix(in srgb, var(--accent) 72%, #1e3a8a);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 45%, transparent);
  --accent-glow: color-mix(in srgb, var(--accent) 55%, transparent);
  --accent-ink: var(--accent);
  --grad: linear-gradient(135deg, var(--accent-hi) 0%, var(--accent) 45%, var(--accent-lo) 100%);
  --logo-left: var(--text);
  --logo-accent: var(--accent);

  --font: 'Inter', system-ui, sans-serif;
  --fw: 400;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-in: cubic-bezier(.55, 0, .75, .2);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --sb-w: 264px;

  --good: #22c55e; --warn: #f59e0b; --bad: #f43f5e;
  --s0: #f43f5e; --s1: #f97316; --s2: #eab308; --s3: #84cc16; --s4: #22c55e;
}
[data-theme="dark"] {
  --bg: #05070a; --text: #eef3f8; --muted: #8e99aa; --faint: #586374;
  --panel: rgba(12, 16, 22, .7);
  --surface: rgba(255, 255, 255, .035); --surface-2: rgba(255, 255, 255, .065); --surface-3: rgba(255, 255, 255, .1);
  --border: rgba(255, 255, 255, .075); --border-2: rgba(255, 255, 255, .13);
  --solid: #0b0f15;
  --shadow: 0 40px 100px -20px rgba(0, 0, 0, .7);
  --glow-o: 1; color-scheme: dark;
}
[data-theme="light"] {
  --bg: #eef2f6; --text: #0b1015; --muted: #5a6575; --faint: #8b95a5;
  --panel: rgba(255, 255, 255, .66);
  --surface: rgba(255, 255, 255, .55); --surface-2: rgba(255, 255, 255, .8); --surface-3: #fff;
  --border: rgba(15, 25, 40, .07); --border-2: rgba(15, 25, 40, .13);
  --solid: #f7f9fb;
  --shadow: 0 40px 90px -25px rgba(20, 35, 60, .28);
  --accent-ink: color-mix(in srgb, var(--accent) 62%, #000);
  --glow-o: .55; color-scheme: light;
}
[data-palette="passvault"] { --b1: #02d0f5; --b2: #035f75; --b3: #0a2a35; }
[data-theme="dark"][data-palette="passvault"] { --bg: #020304; }
[data-palette="midnight"] { --b1: #2563eb; --b2: #7c3aed; --b3: #0ea5e9; }
[data-palette="ocean"]    { --b1: #0891b2; --b2: #1d4ed8; --b3: #14b8a6; }
[data-palette="aurora"]   { --b1: #10b981; --b2: #7c3aed; --b3: #22d3ee; }
[data-palette="ember"]    { --b1: #f97316; --b2: #be123c; --b3: #f59e0b; }
[data-palette="rose"]     { --b1: #ec4899; --b2: #9333ea; --b3: #fb7185; }
[data-palette="graphite"] { --b1: #64748b; --b2: #3f3f46; --b3: #94a3b8; }
[data-font="lato"]   { --font: 'Lato', system-ui, sans-serif; --fw: 400; }
[data-font="roboto"] { --font: 'Roboto', system-ui, sans-serif; --fw: 300; }

/* =====================================================================
   Base
   ===================================================================== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-weight: var(--fw); font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow: hidden;
  transition: background-color .4s var(--ease), color .3s var(--ease);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
[hidden] { display: none !important; }
svg { display: block; flex-shrink: 0; }
::selection { background: var(--accent-soft); }
.secret { -webkit-text-security: disc; }

/* Scrollbars: slim, rounded, accent on hover */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: color-mix(in srgb, var(--text) 13%, transparent);
  border: 3px solid transparent; background-clip: padding-box; border-radius: 10px; min-height: 40px;
}
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--accent) 65%, transparent); }
::-webkit-scrollbar-thumb:active { background-color: var(--accent); }
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text) 18%, transparent) transparent; }
}
.scroll { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

/* Static background (no animation behind glass = no lag) */
.bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.glow { position: absolute; border-radius: 50%; opacity: calc(var(--glow-o) * .5); transition: opacity .6s var(--ease); }
.g1 { width: 70vmax; height: 70vmax; left: -25vmax; top: -30vmax; background: radial-gradient(closest-side, var(--b1), transparent); opacity: calc(var(--glow-o) * .32); }
.g2 { width: 60vmax; height: 60vmax; right: -22vmax; bottom: -28vmax; background: radial-gradient(closest-side, var(--b2), transparent); }
.g3 { width: 40vmax; height: 40vmax; left: 42%; top: 35%; background: radial-gradient(closest-side, var(--b3), transparent); opacity: calc(var(--glow-o) * .35); }
.grid-fx {
  position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(color-mix(in srgb, var(--text) 9%, transparent) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 10%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 10%, transparent 70%);
}

.glass {
  background: var(--panel);
  backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--border-2); box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .05);
}

/* Ripple */
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: .18;
  transform: scale(0); animation: ripple .6s var(--ease) forwards; z-index: 0;
}
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

/* =====================================================================
   Buttons & controls
   ===================================================================== */
.btn {
  position: relative; isolation: isolate; overflow: hidden;
  height: 44px; padding: 0 20px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-weight: 600; letter-spacing: .01em; white-space: nowrap; user-select: none;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), background-color .25s, border-color .25s, color .25s, opacity .25s;
}
.btn:active { transform: scale(.97); transition-duration: .1s; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary {
  background: var(--grad); color: var(--accent-text);
  box-shadow: 0 8px 22px -8px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 -1px 0 rgba(0, 0, 0, .12);
}
.btn.primary::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(105deg, transparent 25%, rgba(255, 255, 255, .45) 50%, transparent 75%);
  transform: translateX(-110%); transition: transform .8s var(--ease);
}
@media (hover: hover) {
  .btn.primary:hover { transform: translateY(-2px); box-shadow: 0 14px 34px -8px var(--accent-glow), 0 0 0 1px var(--accent-line), inset 0 1px 0 rgba(255, 255, 255, .4); }
  .btn.primary:hover::after { transform: translateX(110%); }
  .btn.ghost:hover { background: var(--surface-3); border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
  .btn.danger:hover { background: color-mix(in srgb, var(--bad) 24%, transparent); box-shadow: 0 8px 24px -10px var(--bad); }
}
.btn.ghost { background: var(--surface-2); border: 1px solid var(--border-2); }
.btn.danger { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); }
.btn.block { width: 100%; }
.btn.lg { height: 54px; border-radius: 16px; font-size: 15px; }
.btn > *:not(.ripple) { position: relative; z-index: 1; }

.icon-btn {
  position: relative; overflow: hidden;
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--muted);
  transition: background-color .25s var(--ease), color .25s var(--ease), transform .3s var(--ease), box-shadow .3s var(--ease);
}
@media (hover: hover) {
  .icon-btn:hover { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-2); }
}
.icon-btn:active { transform: scale(.9); transition-duration: .1s; }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 10px; }
.icon-btn.on { color: #facc15; }
.icon-btn.copied { color: var(--good); }
.icon-btn svg { transition: transform .35s var(--spring); }
.icon-btn.copied svg { animation: pop .4s var(--spring); }
@keyframes pop { 0% { transform: scale(.4); } 100% { transform: scale(1); } }

.input, .textarea, .select {
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px; outline: none; color: var(--text);
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), background-color .25s var(--ease);
}
.input { height: 46px; padding: 0 14px; width: 100%; }
.textarea { width: 100%; min-height: 96px; padding: 12px 14px; resize: vertical; }
.select {
  height: 40px; padding: 0 34px 0 12px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e99aa' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.select option { background: var(--solid); color: var(--text); }
.input:hover, .textarea:hover, .select:hover { border-color: color-mix(in srgb, var(--text) 22%, transparent); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background-color: var(--surface-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.input:focus-visible, .textarea:focus-visible, .select:focus-visible, .search input:focus-visible { outline: none; }

/* Segmented controls */
.seg { position: relative; display: flex; background: var(--surface); border: 1px solid var(--border-2); border-radius: 13px; padding: 3px; gap: 2px; }
.seg button {
  position: relative; z-index: 1; height: 32px; min-width: 34px; padding: 0 10px; border-radius: 10px;
  display: grid; place-items: center; color: var(--muted); font-size: 13px; font-weight: 500;
  transition: color .3s var(--ease), background-color .3s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button.active { color: var(--accent-text); background: var(--grad); box-shadow: 0 4px 14px -4px var(--accent-glow); }
.seg.slide button.active { background: none; box-shadow: none; }
.seg.slide .thumb {
  position: absolute; top: 3px; left: 3px; width: 34px; height: 32px; border-radius: 10px;
  background: var(--grad); box-shadow: 0 4px 14px -4px var(--accent-glow); transition: transform .45s var(--ease);
}
.seg.slide button { width: 34px; padding: 0; }
.seg.slide[data-v="grid"] .thumb { transform: translateX(36px); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 8px; font-size: 12px; font-weight: 500;
  background: color-mix(in srgb, var(--c, var(--accent)) 15%, transparent);
  color: color-mix(in srgb, var(--c, var(--accent)) 75%, var(--text));
  border: 1px solid color-mix(in srgb, var(--c, var(--accent)) 25%, transparent);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex-shrink: 0; box-shadow: 0 0 10px color-mix(in srgb, var(--c) 60%, transparent); }
.kbd { font-size: 11px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--border-2); color: var(--faint); font-family: inherit; white-space: nowrap; }

/* Custom checkbox */
.check { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); cursor: pointer; user-select: none; transition: color .2s; }
.check:hover { color: var(--text); }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box {
  width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-2); display: grid; place-items: center;
  background: var(--surface); color: transparent; transition: all .3s var(--ease);
}
.check input:checked + .box { background: var(--grad); border-color: transparent; color: var(--accent-text); box-shadow: 0 0 14px -2px var(--accent-glow); }
.check input:checked + .box svg { animation: pop .35s var(--spring); }
.check input:focus-visible + .box { box-shadow: 0 0 0 4px var(--accent-soft); }

/* =====================================================================
   Welcome
   ===================================================================== */
.welcome {
  position: fixed; inset: 0; z-index: 2; display: grid; place-items: center; padding: 20px; overflow-y: auto;
  transition: opacity .5s var(--ease), transform .6s var(--ease);
}
.welcome.entering { opacity: 0; transform: scale(.97); }
.welcome.leaving { opacity: 0; transform: scale(1.04); pointer-events: none; }
.welcome-card {
  position: relative; width: min(400px, 100%); border-radius: 34px; padding: 40px 30px 28px; text-align: center;
  animation: cardIn .8s var(--ease) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.welcome-card.swap .w-body, .welcome-card.swap .w-head { animation: fadeUp .5s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }

.w-logo { position: relative; width: 84px; height: 84px; margin: 0 auto 14px; display: grid; place-items: center; }
.w-logo::before {
  content: ''; position: absolute; inset: -18px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--accent-glow), transparent); opacity: .55;
  animation: breathe 4s ease-in-out infinite;
}
.w-logo .logo { position: relative; filter: drop-shadow(0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent)); }
.w-logo.busy .logo { animation: busy 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .9; transform: scale(1.08); } }
@keyframes busy { 50% { transform: scale(.92); opacity: .7; } }
.wordmark { font-size: 26px; font-weight: 800; letter-spacing: .04em; line-height: 1; }
.wordmark span, .brand-text span { color: var(--accent-ink); }
.tagline { margin-top: 7px; font-size: 10.5px; font-weight: 600; letter-spacing: .32em; text-transform: uppercase; color: var(--faint); }
.w-head { margin: 26px 0 22px; }
.w-head h1 { margin: 0 0 5px; font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.w-head .sub { margin: 0; color: var(--muted); font-size: 13.5px; }
.fade-swap { transition: opacity .18s var(--ease), transform .18s var(--ease); }
.fade-swap.out { opacity: 0; transform: translateY(-4px); }

.pin-cells { display: flex; justify-content: center; gap: 10px; margin-bottom: 12px; }
.cell {
  position: relative; width: 44px; height: 54px; border-radius: 14px;
  background: var(--surface); border: 1.5px solid var(--border-2);
  transition: border-color .3s var(--ease), background-color .3s var(--ease), box-shadow .3s var(--ease), transform .3s var(--ease);
}
.cell::after {
  content: ''; position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 14px var(--accent-glow);
  transform: scale(0); opacity: 0; transition: transform .35s var(--spring), opacity .2s;
}
.cell.filled { border-color: var(--accent-line); background: var(--accent-soft); }
.cell.filled::after { transform: scale(1); opacity: 1; }
.cell.active { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.cell.active::before {
  content: ''; position: absolute; left: 50%; bottom: 12px; width: 14px; height: 2px; margin-left: -7px; border-radius: 2px;
  background: var(--accent); animation: caret 1.1s ease-in-out infinite;
}
@keyframes caret { 50% { opacity: 0; } }
.pin-cells.error .cell { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); box-shadow: none; }
.pin-cells.error .cell::after { background: var(--bad); box-shadow: 0 0 12px var(--bad); }
.pin-cells.error { animation: shake .45s var(--ease); }
.pin-cells.success .cell {
  border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 22px -4px var(--accent-glow);
  transform: translateY(-3px); transition-delay: calc(var(--i) * 45ms);
}
@keyframes shake { 15%, 55% { transform: translateX(-9px); } 35%, 75% { transform: translateX(9px); } 90% { transform: translateX(-3px); } }

.msg {
  min-height: 20px; margin-bottom: 14px; font-size: 13px; color: var(--muted);
  opacity: 0; transform: translateY(-4px); transition: opacity .3s var(--ease), transform .3s var(--ease), color .3s;
}
.msg.show { opacity: 1; transform: none; }
.msg.err { color: var(--bad); }

.keypad { display: grid; grid-template-columns: repeat(3, 72px); justify-content: center; gap: 14px 22px; margin: 0 auto 20px; transition: opacity .3s var(--ease); }
.keypad.disabled { opacity: .3; pointer-events: none; }
.keypad button {
  position: relative; overflow: hidden; width: 72px; height: 72px; border-radius: 50%;
  font-size: 26px; font-weight: 400; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border-2); color: var(--text);
  transition: background-color .25s var(--ease), border-color .25s var(--ease), transform .25s var(--ease), box-shadow .3s var(--ease);
}
@media (hover: hover) {
  .keypad button:hover { background: var(--surface-2); border-color: var(--accent-line); box-shadow: 0 0 24px -8px var(--accent-glow); }
}
.keypad button:active, .keypad button.pressed { transform: scale(.9); background: var(--accent-soft); border-color: var(--accent); transition-duration: .08s; }
.keypad button.plain { background: none; border-color: transparent; color: var(--muted); }
.keypad button.plain:hover { box-shadow: none; color: var(--text); }
.link { color: var(--accent-ink); font-weight: 600; margin-top: 16px; display: inline-block; transition: opacity .2s; }
.link:hover { opacity: .75; }
.mode-note { margin-top: 18px; font-size: 11.5px; color: var(--faint); display: flex; align-items: center; justify-content: center; gap: 7px; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 10px var(--good); flex-shrink: 0; }
.loader { display: flex; justify-content: center; gap: 8px; padding: 24px 0 34px; }
.loader span { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); animation: bounce 1s var(--ease) infinite; }
.loader span:nth-child(2) { animation-delay: .15s; } .loader span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* =====================================================================
   Shell
   ===================================================================== */
.shell {
  position: fixed; z-index: 1; inset: 18px; border-radius: 30px; overflow: hidden; max-width: 1560px; margin: auto;
  display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr);
  transition: opacity .5s var(--ease), transform .6s var(--ease);
}
.shell.collapsed { --sb-w: 84px; }
.shell.entering { opacity: 0; transform: scale(.985) translateY(10px); }
.shell.leaving { opacity: 0; transform: scale(.985); pointer-events: none; }

.sidebar {
  display: flex; flex-direction: column; padding: 22px 14px 16px; overflow-x: hidden; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border); min-width: 0;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 9px 24px; white-space: nowrap; }
.brand-logo { width: 36px; display: grid; place-items: center; flex-shrink: 0; }
.brand-text { font-size: 20px; font-weight: 800; letter-spacing: .04em; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 13px;
  padding: 10px 14px; border-radius: 12px; color: var(--muted); width: 100%; text-align: left; white-space: nowrap;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
.nav-item .ni { width: 20px; display: grid; place-items: center; flex-shrink: 0; transition: transform .35s var(--spring); }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item:hover .ni { transform: scale(1.1); }
.nav-item.active { background: var(--accent-soft); color: var(--text); font-weight: 500; }
.nav-item.active .ni { color: var(--accent-ink); }
.nav-item::before {
  content: ''; position: absolute; left: 0; top: 50%; width: 3px; height: 18px; margin-top: -9px; border-radius: 0 3px 3px 0;
  background: var(--accent); box-shadow: 0 0 12px var(--accent); transform: scaleY(0); transition: transform .35s var(--ease);
}
.nav-item.active::before { transform: scaleY(1); }
.nav-item .count {
  margin-left: auto; font-size: 11.5px; color: var(--faint); min-width: 22px; text-align: center;
  padding: 1px 7px; border-radius: 8px; background: var(--surface); font-variant-numeric: tabular-nums;
}
.nav-item.active .count { color: var(--accent-ink); background: var(--surface-2); }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: var(--faint); padding: 22px 14px 8px; white-space: nowrap; position: relative; }
.nav-label::after { content: ''; position: absolute; left: 18px; right: 18px; top: 50%; height: 1px; background: var(--border-2); opacity: 0; transition: opacity .3s; }
.sidebar .spacer { flex: 1; min-height: 18px; }
.sync { font-size: 11.5px; color: var(--faint); padding: 12px 14px 0; display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.sync .sync-dot { margin: 0 6px; }
.lbl, .count, .brand-text, .nav-label span { transition: opacity .3s var(--ease), transform .4s var(--ease); }
.shell.collapsed .lbl, .shell.collapsed .count, .shell.collapsed .brand-text, .shell.collapsed .nav-label span { opacity: 0; transform: translateX(-8px); pointer-events: none; }
.shell.collapsed .nav-label::after { opacity: 1; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 22px 16px; }
.search {
  flex: 1; min-width: 0; max-width: 560px; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 12px 0 16px;
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; color: var(--muted); cursor: text;
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), background-color .25s var(--ease);
}
.search:hover { border-color: color-mix(in srgb, var(--text) 22%, transparent); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface-2); color: var(--accent-ink); }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; height: 100%; color: var(--text); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.content { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 18px; padding: 0 22px 22px; }
.content.grid-mode { grid-template-columns: minmax(0, 1fr); }
.collection { min-height: 0; padding: 2px 6px 100px 2px; margin-right: -6px; scrollbar-gutter: stable; }

/* Stagger in */
.stagger > * { animation: itemIn .55s var(--ease) both; animation-delay: calc(var(--i) * 28ms); }
@keyframes itemIn { from { opacity: 0; transform: translateY(12px); } }

/* List rows */
.list { display: flex; flex-direction: column; gap: 4px; }
.row {
  position: relative; overflow: hidden; width: 100%; display: flex; align-items: center; gap: 14px;
  padding: 11px 14px; border-radius: 16px; text-align: left; border: 1px solid transparent;
  transition: background-color .25s var(--ease), border-color .25s var(--ease), box-shadow .3s var(--ease);
}
.row:hover { background: var(--surface-2); }
.row.selected {
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 18%, transparent), color-mix(in srgb, var(--accent) 5%, transparent));
  border-color: var(--accent-line); box-shadow: 0 10px 30px -14px var(--accent-glow);
}
.row .meta { min-width: 0; flex: 1; }
.row .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.row .flags { display: flex; gap: 6px; color: var(--warn); }
.row .chev { color: var(--faint); opacity: 0; transform: translateX(-6px); transition: opacity .25s, transform .35s var(--ease); }
.row:hover .chev, .row.selected .chev { opacity: 1; transform: none; }
.row.selected .chev { color: var(--accent-ink); }

.avatar {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex-shrink: 0;
  font-weight: 700; font-size: 17px; color: #fff; position: relative;
  background: linear-gradient(140deg, color-mix(in srgb, var(--c) 85%, #fff), color-mix(in srgb, var(--c) 70%, #000));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 6px 16px -8px var(--c);
}
.avatar.lg { width: 64px; height: 64px; border-radius: 19px; font-size: 26px; }
.fill { fill: currentColor; }

/* Cards: masonry columns */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.masonry { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 16px; align-items: start; }
.m-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card { position: relative; cursor: pointer; text-align: left; perspective: 1200px; touch-action: pan-y; transition: transform .5s var(--ease); }
.card.tilting { transition: transform .12s linear; }
@media (hover: hover) { .card:hover { transform: translateY(-4px); } }
.card-head { display: flex; align-items: flex-start; gap: 12px; }
.ch-main { min-width: 0; flex: 1; padding-top: 2px; }
.card-head .name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.005em; }
.card-tools { display: flex; gap: 2px; margin: -4px -6px 0 0; }
.card-line { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); min-width: 0; height: 30px; }
.card-line .v { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.card-line .icon-btn { opacity: .55; }
.card:hover .card-line .icon-btn { opacity: 1; }
.card-foot { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--faint); margin-top: auto; padding-top: 4px; }

/* Strength */
.meter { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 6px; background: var(--sc); box-shadow: 0 0 10px var(--sc); transition: width .6s var(--ease), background-color .4s; }
.s-0 { --sc: var(--s0); } .s-1 { --sc: var(--s1); } .s-2 { --sc: var(--s2); } .s-3 { --sc: var(--s3); } .s-4 { --sc: var(--s4); }
.s-label { color: var(--sc); font-weight: 600; transition: color .3s; }

/* Detail */
.detail { border-radius: 26px; background: var(--surface); border: 1px solid var(--border); min-height: 0; }
.detail-inner { padding: 28px 30px 34px; }
.detail-inner.enter { animation: detailIn .5s var(--ease) both; }
@keyframes detailIn { from { opacity: 0; transform: translateX(14px); } }
.empty { height: 100%; min-height: 260px; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 40px; animation: fadeUp .5s var(--ease) both; }
.empty .big { color: var(--faint); margin: 0 auto 14px; opacity: .7; }
.empty .logo { margin: 0 auto 16px; opacity: .85; }
.empty-title { font-weight: 600; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.d-actions { margin-left: auto; display: flex; gap: 4px; align-self: flex-start; }
.banner {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 14px; margin-bottom: 22px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--warn) 22%, transparent), color-mix(in srgb, var(--warn) 8%, transparent));
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); color: color-mix(in srgb, var(--warn) 80%, var(--text)); font-weight: 500; font-size: 13px;
}
.banner button { margin-left: auto; font-weight: 700; display: flex; gap: 6px; align-items: center; white-space: nowrap; color: inherit; transition: opacity .2s; }
.banner button:hover { opacity: .75; }
.fields { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 4px 16px; }
.field { padding: 13px 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 6px; }
.field:last-child { border-bottom: 0; }
.field .f-body { flex: 1; min-width: 0; }
.f-label { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; letter-spacing: .02em; }
.f-label .when { color: var(--faint); }
.f-value { font-size: 15px; font-weight: 500; word-break: break-all; }
.f-value.mono { font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace; letter-spacing: .05em; font-weight: 400; }
.f-value a { color: var(--accent-ink); text-decoration: none; }
.f-value a:hover { text-decoration: underline; }
.f-value.notes { white-space: pre-wrap; word-break: break-word; font-weight: var(--fw); font-size: 14px; }
.strength-box { padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); margin-top: 12px; }
.strength-box .top { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 9px; color: var(--muted); }
.strength-box ul { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.65; }
.section-title { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; margin: 28px 0 12px; }
.section-title .n { color: var(--faint); font-weight: 400; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button {
  padding: 6px 13px; border-radius: 10px; font-size: 12.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--border);
  transition: all .25s var(--ease);
}
.tabs button:hover { color: var(--text); border-color: var(--border-2); }
.tabs button.active { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent-line); font-weight: 600; }
.hist { display: flex; flex-direction: column; gap: 8px; }
.hist-row { display: flex; align-items: center; gap: 6px; padding: 10px 12px 10px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); animation: fadeUp .4s var(--ease) both; }
.hist-row .f-body { flex: 1; min-width: 0; }
.hist-row .f-value { font-size: 13.5px; }
.footnote { margin-top: 26px; font-size: 12px; color: var(--faint); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.back-btn { display: none; }

/* Overlay detail (grid mode) */
.content.grid-mode .detail {
  position: absolute; z-index: 20; top: 12px; right: 12px; bottom: 12px; width: min(520px, calc(100% - 24px));
  background: var(--solid); border-color: var(--border-2); box-shadow: -30px 0 80px -30px rgba(0, 0, 0, .55);
  transform: translateX(calc(100% + 30px)); visibility: hidden;
  transition: transform .55s var(--ease), visibility 0s linear .55s;
  will-change: transform;
}
.content.grid-mode .detail.open { transform: none; visibility: visible; transition: transform .55s var(--ease), visibility 0s; }
.content.grid-mode .back-btn { display: grid; }

/* FAB */
.fab {
  position: absolute; z-index: 15; right: 30px; bottom: 30px; width: 62px; height: 62px; border-radius: 20px;
  display: grid; place-items: center; overflow: hidden; isolation: isolate;
  background: var(--grad); color: var(--accent-text);
  box-shadow: 0 16px 34px -10px var(--accent-glow), 0 0 0 1px var(--accent-line), inset 0 1px 0 rgba(255, 255, 255, .4);
  transition: transform .45s var(--spring), box-shadow .4s var(--ease), opacity .3s;
}
.fab svg { transition: transform .5s var(--spring); position: relative; z-index: 1; }
@media (hover: hover) {
  .fab:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 22px 44px -10px var(--accent-glow), 0 0 0 6px var(--accent-soft), inset 0 1px 0 rgba(255, 255, 255, .4); }
  .fab:hover svg { transform: rotate(90deg); }
}
.fab:active { transform: scale(.94); transition-duration: .1s; }
.fab::after { content: ''; position: absolute; inset: -40%; z-index: 0; background: conic-gradient(from 0deg, transparent, rgba(255, 255, 255, .35), transparent 30%); opacity: 0; transition: opacity .4s; }
.fab:hover::after { opacity: 1; animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.content.grid-mode:has(.detail.open) ~ .fab { opacity: 0; pointer-events: none; transform: scale(.8); }

/* =====================================================================
   Modal
   ===================================================================== */
.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px;
  background: rgba(2, 4, 8, .55); opacity: 0; transition: opacity .3s var(--ease);
}
.modal.show { opacity: 1; }
.modal-card {
  width: min(580px, 100%); max-height: calc(100dvh - 40px); border-radius: 28px; padding: 26px 26px 22px;
  background: var(--solid); border: 1px solid var(--border-2); box-shadow: var(--shadow);
  transform: translateY(20px) scale(.97); opacity: 0; transition: transform .45s var(--ease), opacity .3s var(--ease);
}
.modal.show .modal-card { transform: none; opacity: 1; }
.modal-card.sm { width: min(420px, 100%); }
.modal-card h3 { margin: 0 0 20px; font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.modal-card h3 .h-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); }
.modal-card h3 .icon-btn { margin-left: auto; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form .full { grid-column: 1 / -1; }
.form label > span, .f-cap { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 7px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .input { padding-right: 84px; }
.input-wrap .tools { position: absolute; right: 5px; display: flex; gap: 2px; }
.mono-in { font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace; letter-spacing: .04em; }
.swatches { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 2px solid transparent; position: relative;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .18); transition: transform .3s var(--spring), border-color .2s, box-shadow .3s;
}
.swatch:hover { transform: scale(1.12); }
.swatch.active { border-color: var(--text); box-shadow: 0 0 0 3px var(--bg), 0 0 14px var(--c); transform: scale(1.05); }
.swatch-custom { width: 30px; height: 30px; border-radius: 50%; overflow: hidden; border: 2px dashed var(--faint); position: relative; transition: transform .3s var(--spring); }
.swatch-custom:hover { transform: scale(1.12); }
.swatch-custom input { position: absolute; inset: -6px; width: 44px; height: 44px; border: 0; cursor: pointer; opacity: 0; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.modal-body { max-height: calc(100dvh - 190px); margin: 0 -8px; padding: 0 8px; }
.set-group { padding: 16px 0; border-bottom: 1px solid var(--border); }
.set-group:last-child { border-bottom: 0; padding-bottom: 4px; }
.set-group h4 { margin: 0 0 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--faint); font-weight: 700; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 7px 0; flex-wrap: wrap; }
.set-row .lbl2 { color: var(--muted); }
.palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 9px; width: 100%; margin-top: 4px; }
.palette {
  height: 58px; border-radius: 15px; border: 2px solid transparent; font-size: 12px; font-weight: 600; color: #fff;
  display: flex; align-items: flex-end; padding: 8px 11px; text-shadow: 0 1px 4px rgba(0, 0, 0, .5);
  background: radial-gradient(120% 120% at 100% 0%, var(--p1), transparent 60%), linear-gradient(135deg, var(--p2), #000);
  transition: transform .35s var(--spring), border-color .25s, box-shadow .3s;
}
.palette:hover { transform: translateY(-2px); }
.palette.active { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.confirm-text { color: var(--muted); margin: -6px 0 4px; line-height: 1.6; }

/* Toast */
.toast {
  position: fixed; z-index: 60; left: 50%; bottom: 30px; display: flex; align-items: center; gap: 10px;
  transform: translate(-50%, 24px) scale(.96); opacity: 0; pointer-events: none;
  padding: 12px 18px 12px 14px; border-radius: 14px; background: var(--solid); color: var(--text); font-weight: 500; font-size: 13px;
  border: 1px solid var(--border-2); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .55);
  transition: transform .45s var(--spring), opacity .3s var(--ease);
}
.toast .t-ic { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); }
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

.scrim { display: none; }

/* =====================================================================
   v3 additions
   ===================================================================== */
.btn.sm { height: 34px; padding: 0 12px; border-radius: 10px; font-size: 12.5px; gap: 6px; }
.select.sm { height: 32px; font-size: 12.5px; padding: 0 28px 0 10px; background-position: right 9px center; }
.select.full-w { width: 100%; height: 46px; }
.sm-in { height: 38px; width: 220px; max-width: 100%; }
.hint { font-size: 12px; color: var(--faint); white-space: normal; }
.icon-btn.lit { color: var(--accent-ink); background: var(--accent-soft); }
.mono { font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace; letter-spacing: .04em; }
.scrub-bubble, .scrubber, .tabbar { display: none; }

/* Sync / network */
.net-pill {
  display: none; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
}
.net-pill.show { display: inline-flex; animation: fadeUp .4s var(--ease); }
.net-pill.offline { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.net-pill.syncing svg { animation: spin 1.2s linear infinite; }
.sync.offline .sync-dot { background: var(--bad); box-shadow: 0 0 10px var(--bad); }
.sync.syncing .sync-dot { background: var(--warn); box-shadow: 0 0 10px var(--warn); animation: breathe 1.2s ease-in-out infinite; }
.sync.local .sync-dot { background: var(--faint); box-shadow: none; }
.nav-item .count.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 15%, transparent); }

/* Collection header + groups */
.col-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; padding: 4px 8px 14px; }
.ch-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ch-title h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex-shrink: 0; }
.ch-count { font-size: 12px; color: var(--muted); padding: 2px 9px; border-radius: 20px; background: var(--surface-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ch-note { width: 100%; font-size: 12px; color: var(--faint); }
.grp {
  position: sticky; top: 0; z-index: 3; font-size: 11.5px; font-weight: 800; letter-spacing: .14em; color: var(--accent-ink);
  padding: 9px 14px 5px; border-radius: 10px; background: color-mix(in srgb, var(--solid) 88%, transparent);
}

/* Swipe rows */
.row-wrap { position: relative; border-radius: 16px; }
.swipe-bg {
  position: absolute; inset: 0; border-radius: 16px; display: flex; justify-content: space-between; align-items: center; padding: 0 22px;
  opacity: 0; transition: opacity .2s; font-size: 13px; pointer-events: none;
}
.row-wrap.dir-l .swipe-bg, .row-wrap.dir-r .swipe-bg { opacity: 1; }
.row-wrap.dir-l .swipe-bg { background: color-mix(in srgb, #facc15 18%, transparent); color: #facc15; }
.row-wrap.dir-r .swipe-bg { background: var(--accent-soft); color: var(--accent-ink); }
.sw-l, .sw-r { display: flex; align-items: center; gap: 8px; opacity: .45; transform: scale(.9); transition: opacity .25s, transform .3s var(--spring); }
.row-wrap.dir-l .sw-r, .row-wrap.dir-r .sw-l { visibility: hidden; }
.row-wrap.arm-l .sw-l, .row-wrap.arm-r .sw-r { opacity: 1; transform: scale(1.08); }
.row { touch-action: pan-y; transition: background-color .25s var(--ease), border-color .25s var(--ease), box-shadow .3s var(--ease), transform .45s var(--ease); }
.row.swiping { transition: none; background: var(--solid); }
.type-tag { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 5px; background: var(--surface-2); color: var(--muted); margin-right: 6px; vertical-align: 1px; }
.flag-bin { font-size: 11px; color: var(--faint); white-space: nowrap; }

/* Avatar: strength ring + website logo */
.av-wrap { position: relative; flex-shrink: 0; border-radius: 16px; }
.av-wrap.ringed { padding: 3px; }
.av-wrap.ringed::before {
  content: ''; position: absolute; inset: 0; border-radius: 16px; padding: 2px;
  background: conic-gradient(var(--sc) calc(var(--pct) * 1%), var(--surface-3) 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.av-wrap.lg, .av-wrap.lg::before { border-radius: 23px; }
.av-wrap > .fav { position: absolute; top: -5px; right: -5px; z-index: 2; color: #facc15; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .5)); }
.avatar { overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 9px; background: #fff; border-radius: inherit; animation: fadeIn .4s var(--ease); }
.avatar.lg img { padding: 13px; }
@keyframes fadeIn { from { opacity: 0; } }

/* Grid card flip */
.card-inner { position: relative; height: 100%; transition: transform .75s var(--ease); transform-style: preserve-3d; }
.card.flipped .card-inner { transform: rotateY(180deg); }
.face {
  position: relative; height: 100%; border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 12px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border-2); backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: border-color .3s var(--ease), box-shadow .45s var(--ease), background-color .3s var(--ease);
}
.front::before {
  content: ''; position: absolute; inset: 0 0 auto; height: 110px; pointer-events: none;
  background: radial-gradient(120% 100% at 0% 0%, color-mix(in srgb, var(--c) 26%, transparent), transparent 70%);
}
.face > * { position: relative; }
.back { position: absolute; inset: 0; transform: rotateY(180deg); gap: 10px; background: linear-gradient(160deg, color-mix(in srgb, var(--c) 16%, var(--solid)), var(--solid)); }
@media (hover: hover) {
  .card:hover .face { border-color: var(--accent-line); box-shadow: 0 22px 44px -22px var(--accent-glow), 0 0 0 1px var(--accent-soft); }
  .card:hover .front { background-color: var(--surface-2); }
}
.card.selected .face { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.flip-btn { align-self: flex-start; opacity: .55; }
.card:hover .flip-btn { opacity: 1; }
.card-chips { margin-top: 5px; display: flex; gap: 6px; }
.card-note { font-size: 13px; color: var(--muted); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.back-head { display: flex; align-items: center; justify-content: space-between; }
.back-title { display: flex; gap: 7px; align-items: center; font-weight: 600; font-size: 13px; color: var(--muted); min-width: 0; }
.back-field .f-label { margin-bottom: 2px; }
.back-row { display: flex; align-items: center; gap: 2px; }
.back-row .v { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.back-st { display: flex; align-items: center; gap: 10px; margin-top: auto; font-size: 12px; }
.back-st .meter { flex: 1; }

/* Skeleton */
.sk { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 40%, var(--surface-2) 80%); background-size: 300% 100%; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.sk-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; }
.sk.av { width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.sk.l1 { height: 12px; width: 45%; } .sk.l2 { height: 10px; width: 70%; opacity: .7; } .sk.l3 { height: 12px; width: 85%; } .sk.l4 { height: 6px; width: 100%; }
.sk-card { border-radius: 22px; padding: 18px; border: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 14px; }
.sk-card .sk-row { padding: 0; }

/* Illustrated empty state */
.empty.big-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; min-height: 440px; }
.illus { position: relative; width: 210px; height: 170px; margin-bottom: 18px; }
.illus-core {
  position: absolute; left: 50%; top: 50%; width: 112px; height: 112px; margin: -56px 0 0 -56px; border-radius: 34px; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 25%, var(--surface-3), var(--surface)); border: 1px solid var(--border-2); box-shadow: 0 24px 50px -20px var(--accent-glow);
}
.illus-core::before { content: ''; position: absolute; inset: -34px; border-radius: 50%; background: radial-gradient(closest-side, var(--accent-soft), transparent); z-index: -1; animation: breathe 4s ease-in-out infinite; }
.fl { position: absolute; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: var(--accent-ink); background: var(--surface-2); border: 1px solid var(--border-2); animation: float 5s ease-in-out infinite; }
.f1 { left: 2px; top: 22px; rotate: -10deg; } .f2 { right: 8px; top: 4px; rotate: 8deg; animation-delay: -1.2s; }
.f3 { left: 20px; bottom: 2px; rotate: 6deg; animation-delay: -2.4s; } .f4 { right: 0; bottom: 22px; rotate: -6deg; animation-delay: -3.6s; }
@keyframes float { 50% { translate: 0 -9px; } }
.empty-sub { max-width: 380px; color: var(--muted); line-height: 1.55; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.kbd-hint { margin-top: 16px; font-size: 12px; color: var(--faint); display: flex; gap: 5px; align-items: center; justify-content: center; }

/* Detail additions */
.d-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.d-chips .chip svg { display: inline-block; }
.d-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--border-2); transition: all .2s var(--ease); }
.tag-chip:hover { color: var(--accent-ink); border-color: var(--accent-line); }
.note-body { position: relative; white-space: pre-wrap; word-break: break-word; line-height: 1.65; padding: 18px 54px 18px 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); margin-bottom: 12px; font-size: 14.5px; }
.note-body .icon-btn { position: absolute; top: 10px; right: 10px; }
.rot-line { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border-2); display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.rot-line b { color: var(--warn); }
.banner.bin { background: color-mix(in srgb, var(--bad) 10%, transparent); border-color: color-mix(in srgb, var(--bad) 30%, transparent); color: color-mix(in srgb, var(--bad) 75%, var(--text)); }
.bin-actions { display: flex; gap: 10px; margin: -8px 0 22px; flex-wrap: wrap; }

/* Editor additions */
.type-picker { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 14px; margin: 0 -2px 4px; scrollbar-width: none; }
.type-picker::-webkit-scrollbar { display: none; }
.type-picker button {
  display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 12px; font-size: 12.5px; font-weight: 500; white-space: nowrap; flex-shrink: 0;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border-2); transition: all .25s var(--ease);
}
.type-picker button:hover { color: var(--text); border-color: var(--accent-line); }
.type-picker button.active { color: var(--accent-text); background: var(--grad); border-color: transparent; box-shadow: 0 6px 16px -6px var(--accent-glow); }
.input-wrap .input { padding-right: 46px; }
.input-wrap.two .input { padding-right: 84px; }
.textarea.tall { min-height: 200px; }
.input.flash { animation: flash 1s var(--ease); }
@keyframes flash { 0%, 30% { border-color: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); background-color: var(--accent-soft); } }
.input.flash-bad { animation: shake .45s var(--ease); border-color: var(--bad); }
.gen-panel { display: grid; grid-template-rows: 0fr; opacity: 0; margin-top: -14px; transition: grid-template-rows .45s var(--ease), opacity .3s var(--ease), margin-top .45s var(--ease); }
.gen-panel.open { grid-template-rows: 1fr; opacity: 1; margin-top: 0; }
.gen-inner { overflow: hidden; min-height: 0; }
.gen-body { padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--accent-line); display: flex; flex-direction: column; gap: 12px; }
.gen-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.gen-row { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.gen-row b { min-width: 26px; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
input[type="range"].range { flex: 1; -webkit-appearance: none; appearance: none; background: transparent; height: 20px; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--accent-line), var(--surface-3)); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--grad); margin-top: -6px; box-shadow: 0 0 0 4px var(--accent-soft), 0 2px 6px rgba(0, 0, 0, .3); transition: transform .25s var(--spring); }
.range:active::-webkit-slider-thumb { transform: scale(1.25); }
.range::-moz-range-track { height: 6px; border-radius: 6px; background: var(--surface-3); }
.range::-moz-range-thumb { width: 18px; height: 18px; border: 0; border-radius: 50%; background: var(--accent); }
.gen-checks { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.check.sm { font-size: 12.5px; gap: 8px; }
.check.sm .box { width: 18px; height: 18px; border-radius: 5px; }
.sep-pick { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.tag-input {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 46px; padding: 6px 8px; border-radius: 12px; cursor: text;
  background: var(--surface); border: 1px solid var(--border-2); transition: border-color .25s var(--ease), box-shadow .25s var(--ease);
}
.tag-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.tag-input input { flex: 1; min-width: 140px; border: 0; background: none; outline: none; height: 32px; color: var(--text); }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 10px; border-radius: 20px; font-size: 12.5px; background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--accent-line); animation: pop .3s var(--spring); }
.tag button { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: inherit; opacity: .7; transition: opacity .2s, background-color .2s; }
.tag button:hover { opacity: 1; background: var(--surface-3); }
.discard {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; max-height: 0; opacity: 0; overflow: hidden; padding: 0 14px; border-radius: 14px;
  background: color-mix(in srgb, var(--warn) 12%, transparent); border: 1px solid transparent; font-size: 13px; color: color-mix(in srgb, var(--warn) 80%, var(--text));
  transition: max-height .4s var(--ease), opacity .3s, margin .4s var(--ease), padding .4s var(--ease);
}
.discard > span { display: flex; align-items: center; gap: 8px; margin-right: auto; }
.discard.show { max-height: 90px; opacity: 1; margin-top: 16px; padding: 10px 14px; border-color: color-mix(in srgb, var(--warn) 35%, transparent); animation: shake .45s var(--ease); }
.form.one { grid-template-columns: 1fr; }
.pin-in { font-size: 20px; letter-spacing: .5em; text-align: center; font-family: ui-monospace, Consolas, monospace; }
.h-ic.danger { background: color-mix(in srgb, var(--bad) 15%, transparent) !important; color: var(--bad) !important; }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; color: var(--muted); user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .sw { width: 42px; height: 24px; border-radius: 20px; background: var(--surface-3); border: 1px solid var(--border-2); position: relative; transition: background .3s var(--ease), box-shadow .3s; flex-shrink: 0; }
.switch .sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: transform .4s var(--spring); }
.switch input:checked + .sw { background: var(--grad); border-color: transparent; box-shadow: 0 0 12px -2px var(--accent-glow); }
.switch input:checked + .sw::after { transform: translateX(18px); }
.switch input:focus-visible + .sw { box-shadow: 0 0 0 4px var(--accent-soft); }
.set-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }

/* Security dashboard */
.dash { display: grid; gap: 16px; padding: 0 2px 20px; max-width: 1000px; }
.dash-hero {
  display: flex; align-items: center; gap: 26px; padding: 24px; border-radius: 24px; border: 1px solid var(--border-2);
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--sc) 16%, transparent), transparent 60%), var(--surface);
}
.ring-wrap { position: relative; width: 128px; height: 128px; flex-shrink: 0; }
.score-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-ring circle { fill: none; stroke-width: 10; }
.score-ring .track { stroke: var(--surface-3); }
.score-ring .bar { stroke: var(--sc); stroke-linecap: round; transition: stroke-dashoffset 1.5s var(--ease); filter: drop-shadow(0 0 6px var(--sc)); }
.ring-val { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-val b { font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.ring-val span { font-size: 11px; color: var(--faint); margin-top: 3px; }
.hero-grade { font-size: 24px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 4px; }
.hero-sub { color: var(--muted); font-size: 13.5px; }
.hero-sub.faint { color: var(--faint); font-size: 12.5px; margin-top: 4px; }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile {
  position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 16px; border-radius: 18px; text-align: left;
  background: var(--surface); border: 1px solid var(--border-2); --tc: var(--muted);
  transition: transform .35s var(--ease), border-color .3s var(--ease), box-shadow .35s var(--ease);
}
.tile.bad { --tc: var(--bad); } .tile.warn { --tc: var(--warn); } .tile.info { --tc: var(--accent); } .tile.good { --tc: var(--good); }
.tile:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--tc) 45%, transparent); box-shadow: 0 16px 34px -18px var(--tc); }
.tile .t-ic, .backup-tile .t-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--tc, var(--accent)) 15%, transparent); color: var(--tc, var(--accent-ink)); margin-bottom: 6px; }
.t-n { font-size: 28px; font-weight: 800; line-height: 1; }
.t-l { font-size: 12.5px; color: var(--muted); }
.backup-tile { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border-2); flex-wrap: wrap; }
.backup-tile .t-ic { margin: 0; flex-shrink: 0; }
.backup-tile > div { flex: 1; min-width: 160px; display: flex; flex-direction: column; }
.backup-tile > div span { font-size: 12.5px; color: var(--muted); }
.issues { padding: 18px; border-radius: 22px; background: var(--surface); border: 1px solid var(--border-2); }
.issues h3 { margin: 0 0 8px; font-size: 15px; font-weight: 700; }
.issue-row { display: flex; align-items: center; gap: 14px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.issue-row:last-child { border-bottom: 0; }
.issue-row .meta { flex: 1; min-width: 0; }
.issue-row .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.itags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.itag { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.itag.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.itag.warn { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.itag.info { background: var(--accent-soft); color: var(--accent-ink); }
.all-clear { display: flex; align-items: center; gap: 14px; color: var(--good); padding: 10px 4px; }
.all-clear div { color: var(--muted); }

/* Activity */
.act-seg { margin-bottom: 12px; width: max-content; max-width: 100%; }
.act-list { max-height: calc(100dvh - 240px); min-height: 200px; }
.act-day { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); padding: 14px 4px 6px; }
.act-row { display: flex; gap: 12px; padding: 8px 4px; border-radius: 12px; animation: fadeUp .35s var(--ease) both; }
.a-ic { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex-shrink: 0; }
.a-copied .a-ic { color: var(--accent-ink); background: var(--accent-soft); }
.a-binned .a-ic, .a-purged .a-ic { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.a-created .a-ic, .a-restored .a-ic, .a-imported .a-ic { color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.a-unlocked .a-ic, .a-pin .a-ic, .a-exported .a-ic { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.a-body { font-size: 13.5px; min-width: 0; }
.a-meta { font-size: 11.5px; color: var(--faint); margin-top: 2px; }

/* Import / export */
.drop {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 30px 20px; border-radius: 20px; cursor: pointer;
  border: 2px dashed var(--border-2); background: var(--surface); color: var(--muted); font-size: 13px; transition: all .3s var(--ease);
}
.drop b { color: var(--text); font-size: 15px; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop.over { transform: scale(1.015); }
.drop.done { padding: 14px; }
.drop.done .d-ic { display: none; }
.d-ic { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); margin-bottom: 6px; }
.imp-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; animation: fadeUp .4s var(--ease); }
.imp-stat { padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border-2); text-align: center; }
.imp-stat b { display: block; font-size: 22px; font-weight: 800; }
.imp-stat span { font-size: 12px; color: var(--muted); }
.imp-stat.good b { color: var(--good); }
.imp-src { display: flex; align-items: center; gap: 7px; margin: 12px 0 8px; font-size: 12.5px; color: var(--good); }
.imp-list { display: flex; flex-direction: column; gap: 2px; max-height: 230px; overflow-y: auto; }
.imp-item { display: flex; align-items: center; gap: 12px; padding: 6px 4px; }
.imp-item .meta { min-width: 0; }
.imp-item .name { font-weight: 600; }
.how { margin-top: 14px; font-size: 13px; color: var(--muted); }
.how summary { cursor: pointer; color: var(--accent-ink); font-weight: 600; }
.how p { line-height: 1.7; }
.export-opts { display: grid; gap: 10px; }
.opt {
  display: grid; grid-template-columns: auto 1fr; column-gap: 14px; row-gap: 2px; text-align: left; padding: 16px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border-2); transition: all .3s var(--ease);
}
.opt .o-ic { grid-row: span 2; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); }
.opt b { font-size: 14.5px; }
.opt > span:last-child { font-size: 12.5px; color: var(--muted); }
.opt:hover { border-color: var(--accent-line); transform: translateY(-2px); box-shadow: 0 14px 30px -18px var(--accent-glow); }
.warn-box {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 12px 14px; border-radius: 14px; font-size: 12.5px; line-height: 1.55;
  background: color-mix(in srgb, var(--warn) 10%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); color: color-mix(in srgb, var(--warn) 70%, var(--text));
}
.warn-box svg { flex-shrink: 0; margin-top: 1px; }

/* Shortcuts */
.keys { display: flex; flex-direction: column; }
.key-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.key-row:last-child { border: 0; }
.key-row i { font-size: 11px; color: var(--faint); font-style: normal; margin: 0 2px; }
.key-row .kbd { font-size: 11.5px; padding: 3px 8px; }

/* Command palette */
.palette-ov { position: fixed; inset: 0; z-index: 70; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; background: rgba(2, 4, 8, .5); opacity: 0; transition: opacity .25s var(--ease); }
.palette-ov.show { opacity: 1; }
.pal-box { width: min(620px, 100%); border-radius: 22px; overflow: hidden; background: var(--solid); border: 1px solid var(--border-2); box-shadow: var(--shadow), 0 0 0 1px var(--accent-soft); transform: translateY(-12px) scale(.98); transition: transform .4s var(--ease); }
.palette-ov.show .pal-box { transform: none; }
.pal-search { display: flex; align-items: center; gap: 12px; padding: 0 18px; height: 60px; border-bottom: 1px solid var(--border); color: var(--accent-ink); }
.pal-search input { flex: 1; background: none; border: 0; outline: none; font-size: 16px; color: var(--text); height: 100%; }
.pal-list { max-height: min(56vh, 460px); overflow-y: auto; padding: 6px 8px 10px; }
.pal-sec { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); padding: 12px 10px 6px; }
.pal-item { position: relative; overflow: hidden; width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; text-align: left; transition: background-color .15s; }
.pal-item.on { background: var(--accent-soft); }
.pal-item .avatar { width: 34px; height: 34px; border-radius: 10px; font-size: 14px; }
.pal-item .avatar img { padding: 7px; }
.pal-item .av-wrap.ringed { padding: 2px; }
.p-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); flex-shrink: 0; transition: color .15s; }
.pal-item.on .p-ic { color: var(--accent-ink); }
.p-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.p-main b { font-weight: 600; font-size: 14px; }
.p-main span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-hint { font-size: 11px; color: var(--faint); opacity: 0; transition: opacity .15s; white-space: nowrap; }
.pal-item.on .p-hint { opacity: 1; }
.pal-empty { padding: 30px; text-align: center; color: var(--muted); }
.pal-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--faint); }
.pal-foot .kbd { margin-right: 4px; }

/* Context menu */
.ctx { position: fixed; z-index: 80; min-width: 214px; padding: 6px; border-radius: 16px; background: var(--solid); border: 1px solid var(--border-2); box-shadow: 0 24px 60px -16px rgba(0, 0, 0, .6); opacity: 0; transform: scale(.92); transition: opacity .18s var(--ease), transform .28s var(--ease); }
.ctx.show { opacity: 1; transform: none; }
.ctx-head { font-size: 11.5px; font-weight: 700; color: var(--faint); padding: 6px 10px; max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-item { position: relative; overflow: hidden; width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; font-size: 13.5px; color: var(--text); text-align: left; transition: background-color .15s; }
.ctx-item svg { color: var(--muted); transition: color .15s; }
.ctx-item:hover { background: var(--surface-2); }
.ctx-item:hover svg { color: var(--accent-ink); }
.ctx-item.danger, .ctx-item.danger svg { color: var(--bad); }
.ctx-item.danger:hover { background: color-mix(in srgb, var(--bad) 12%, transparent); }
.ctx-sep { height: 1px; background: var(--border-2); margin: 5px 6px; }

/* Lock warning */
.lock-warn {
  position: fixed; z-index: 75; left: 50%; top: 20px; display: flex; align-items: center; gap: 14px; padding: 12px 12px 12px 14px; border-radius: 18px;
  background: var(--solid); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
  box-shadow: 0 20px 50px -14px rgba(0, 0, 0, .6), 0 0 0 4px color-mix(in srgb, var(--warn) 10%, transparent);
  transform: translate(-50%, -150%); opacity: 0; pointer-events: none; transition: transform .55s var(--spring), opacity .3s;
}
.lock-warn.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.lw-ring { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--warn); position: relative; flex-shrink: 0; background: conic-gradient(var(--warn) calc(var(--p, 1) * 360deg), var(--surface-3) 0); }
.lw-ring::before, .clip-ring::before { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--solid); }
.lw-ring svg, .clip-ring svg { position: relative; }
.lw-text { display: flex; flex-direction: column; font-size: 12.5px; color: var(--muted); }
.lw-text b { color: var(--text); font-size: 14px; }

/* Clipboard timer */
.clip-pill {
  position: fixed; z-index: 55; left: 24px; bottom: 26px; display: flex; align-items: center; gap: 10px; padding: 7px 14px 7px 7px; border-radius: 30px; cursor: pointer;
  background: var(--solid); border: 1px solid var(--border-2); box-shadow: 0 14px 34px -12px rgba(0, 0, 0, .55); font-size: 12.5px; color: var(--muted);
  transform: translateY(160%); opacity: 0; transition: transform .5s var(--spring), opacity .3s, border-color .2s;
}
.clip-pill.show { transform: none; opacity: 1; }
.clip-pill:hover { border-color: var(--accent-line); }
.clip-ring { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--accent-ink); position: relative; background: conic-gradient(var(--accent) calc(var(--p, 1) * 360deg), var(--surface-3) 0); }
.clip-pill b { color: var(--text); font-variant-numeric: tabular-nums; }
.clip-pill .clr { color: var(--accent-ink); font-weight: 600; margin-left: 2px; }

/* Toast action */
.toast.show { pointer-events: auto; }
.toast-act { display: inline-flex; align-items: center; gap: 6px; margin-left: 6px; padding: 6px 10px; border-radius: 9px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); transition: filter .2s, transform .2s; }
.toast-act:hover { filter: brightness(1.2); }
.toast-act:active { transform: scale(.95); }

/* Compact density */
.shell.compact .row { padding: 7px 12px; gap: 12px; }
.shell.compact .row .avatar, .shell.compact .sk.av { width: 36px; height: 36px; border-radius: 11px; font-size: 15px; }
.shell.compact .row .avatar img { padding: 7px; }
.shell.compact .sub { font-size: 12px; margin-top: 0; }
.shell.compact .list { gap: 1px; }
.shell.compact .face { padding: 14px; gap: 9px; }
.shell.compact .grid { gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

/* Light PassVault polish */
[data-theme="light"][data-palette="passvault"] { --bg: #eef4f7; --b1: #02d0f5; --b2: #8be6f8; --b3: #c9f3fb; --panel: rgba(255, 255, 255, .72); }
[data-theme="light"] .avatar img { box-shadow: inset 0 0 0 1px var(--border-2); }
[data-theme="light"] .modal { background: rgba(20, 30, 45, .28); }
[data-theme="light"] .palette-ov { background: rgba(20, 30, 45, .25); }
[data-theme="light"] .score-ring .bar { filter: none; }
[data-theme="light"] .back { background: linear-gradient(160deg, color-mix(in srgb, var(--c) 12%, #fff), #fff); }
[data-theme="light"] .grp { background: color-mix(in srgb, #fff 90%, transparent); }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1100px) {
  #sort, .kbd { display: none; }
}
@media (max-width: 820px) {
  .shell, .shell.collapsed { inset: 0; border-radius: 0; border: 0; grid-template-columns: minmax(0, 1fr); padding-top: env(safe-area-inset-top); }
  .shell.collapsed .lbl, .shell.collapsed .count, .shell.collapsed .brand-text, .shell.collapsed .nav-label span { opacity: 1; transform: none; pointer-events: auto; }
  .shell.collapsed .nav-label::after { opacity: 0; }
  .sidebar {
    position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: 286px;
    background: var(--solid); border-right: 1px solid var(--border-2); box-shadow: 30px 0 80px -30px rgba(0, 0, 0, .6);
    padding-top: calc(22px + env(safe-area-inset-top)); padding-bottom: calc(16px + env(safe-area-inset-bottom));
    transform: translateX(-105%); transition: transform .5s var(--ease); will-change: transform;
  }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .4s var(--ease); }
  .sidebar.open + .scrim { opacity: 1; pointer-events: auto; }
  .topbar { padding: 12px 14px; gap: 8px; }
  .search { height: 44px; }
  .top-actions { gap: 4px; }
  .top-actions #settingsBtn { display: none; }
  .content, .content.grid-mode { grid-template-columns: minmax(0, 1fr); padding: 0 12px 0; }
  .collection { padding-bottom: 110px; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .detail, .content.grid-mode .detail {
    position: fixed; z-index: 30; inset: 0; width: auto; border-radius: 0; border: 0; background: var(--solid);
    padding-top: env(safe-area-inset-top);
    transform: translateX(100%); visibility: hidden; transition: transform .5s var(--ease), visibility 0s linear .5s; will-change: transform;
  }
  .detail.open, .content.grid-mode .detail.open { transform: none; visibility: visible; transition: transform .5s var(--ease), visibility 0s; }
  .back-btn, .content.grid-mode .back-btn { display: grid; }
  .detail-inner { padding: 16px 18px 40px; }
  .fab { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); }
  .content:has(.detail.open) ~ .fab { opacity: 0; pointer-events: none; transform: scale(.8); }
  .form { grid-template-columns: 1fr; }
  .modal { padding: 0; place-items: end stretch; }
  .modal-card { width: 100% !important; border-radius: 28px 28px 0 0; max-height: 94dvh; padding-bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateY(100%); opacity: 1; }
  .modal-body { max-height: calc(94dvh - 170px); }
  .welcome { padding: 14px; }
  .welcome-card { padding: 32px 20px 24px; }
  .keypad { grid-template-columns: repeat(3, 70px); gap: 12px 20px; }
  .keypad button { width: 70px; height: 70px; }
}
@media (max-width: 380px) {
  .seg.slide { display: none; }
  .cell { width: 40px; height: 50px; }
  .keypad { gap: 10px 16px; }
}
@media (max-height: 820px) {
  .welcome-card { padding-top: 28px; padding-bottom: 20px; }
  .w-logo { width: 64px; height: 64px; margin-bottom: 10px; }
  .w-logo .logo { width: 62px; height: 62px; }
  .w-head { margin: 18px 0 16px; }
  .keypad { grid-template-columns: repeat(3, 62px); gap: 10px 20px; margin-bottom: 14px; }
  .keypad button { width: 62px; height: 62px; font-size: 23px; }
  .cell { height: 50px; }
  .mode-note { margin-top: 12px; }
}
/* Mobile: bottom tab bar, scrubber, gestures */
@media (max-width: 820px) {
  .fab { display: none; }
  .tabbar {
    display: flex; position: fixed; z-index: 28; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); height: 64px; padding: 0 6px;
    border-radius: 22px; justify-content: space-around; align-items: center;
    background: color-mix(in srgb, var(--solid) 90%, transparent); backdrop-filter: blur(20px) saturate(150%); -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid var(--border-2); box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .6);
    transition: transform .45s var(--ease), opacity .3s;
  }
  .tab {
    position: relative; overflow: hidden; flex: 1; height: 52px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; font-size: 10.5px; font-weight: 600; color: var(--faint); transition: color .25s;
  }
  .tab.active { color: var(--accent-ink); }
  .tab.active svg { animation: pop .4s var(--spring); }
  .tab::after { content: ''; position: absolute; top: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); transform: scale(0); transition: transform .35s var(--spring); }
  .tab.active::after { transform: scale(1); }
  .tab.new { flex: 0 0 auto; width: 58px; height: 58px; margin-top: -28px; border-radius: 20px; background: var(--grad); color: var(--accent-text); box-shadow: 0 12px 26px -8px var(--accent-glow), 0 0 0 5px var(--bg); }
  .tab.new::after { display: none; }
  .content:has(.detail.open) ~ .tabbar { transform: translateY(160%); opacity: 0; }
  .collection { padding-bottom: calc(110px + env(safe-area-inset-bottom)); }
  .scrubber.show { display: flex; position: absolute; right: 0; top: 120px; bottom: 96px; z-index: 6; flex-direction: column; justify-content: center; padding: 4px 3px; touch-action: none; user-select: none; }
  .scrubber span { font-size: 10px; font-weight: 800; color: var(--accent-ink); padding: 1px 6px; text-align: center; line-height: 1.35; }
  .scrub-bubble {
    display: grid; position: fixed; right: 44px; width: 58px; height: 58px; margin-top: -29px; border-radius: 18px; place-items: center; font-size: 26px; font-weight: 800;
    background: var(--grad); color: var(--accent-text); box-shadow: 0 12px 30px -8px var(--accent-glow); opacity: 0; transform: scale(.6); pointer-events: none; z-index: 60;
    transition: opacity .15s, transform .25s var(--spring);
  }
  .scrub-bubble.show { opacity: 1; transform: none; }
  .clip-pill { left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translate(-50%, 160%); }
  .clip-pill.show { transform: translate(-50%, 0); }
  .toast { bottom: calc(140px + env(safe-area-inset-bottom)); width: calc(100% - 32px); }
  .toast #toastText { flex: 1; }
  .toast-act { white-space: nowrap; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .dash-hero { flex-direction: column; text-align: center; gap: 14px; }
  .lock-warn { width: calc(100% - 24px); top: calc(10px + env(safe-area-inset-top)); }
  .lw-text { flex: 1; }
  .palette-ov { padding-top: calc(12px + env(safe-area-inset-top)); }
  .p-hint, .pal-foot, .kbd-hint, #palBtn { display: none !important; }
  .row .chev { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* =====================================================================
   v4 — fixes, editor, settings, organiser, detail header, polish
   ===================================================================== */
/* Hidden floating elements must never catch taps */
.clip-pill:not(.show), .lock-warn:not(.show), .toast:not(.show) { pointer-events: none; }

/* Settings-driven classes */
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
html.no-fx .glow, html.no-fx .grid-fx { display: none; }
html.no-blur .glass, html.no-blur .tabbar { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; background: var(--solid); }
html.no-rings .av-wrap.ringed { padding: 0; }
html.no-rings .av-wrap.ringed::before { display: none; }
html.no-counts .nav-item .count { display: none; }

/* Circular theme reveal */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: vtReveal .7s cubic-bezier(.22, 1, .36, 1); }
@keyframes vtReveal { from { clip-path: circle(0 at var(--vt-x, 50%) var(--vt-y, 50%)); } to { clip-path: circle(150vmax at var(--vt-x, 50%) var(--vt-y, 50%)); } }

/* Animated menu toggle (hamburger ↔ arrow / close) */
.burger-btn { position: relative; width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: var(--muted); background: var(--surface); border: 1px solid var(--border-2); transition: background-color .25s var(--ease), border-color .25s, box-shadow .3s var(--ease), color .2s; overflow: hidden; }
@media (hover: hover) { .burger-btn:hover { color: var(--accent-ink); border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft), 0 6px 18px -8px var(--accent-glow); } }
.burger-btn:active { transform: scale(.92); }
.burger { position: relative; width: 18px; height: 14px; display: block; }
.burger i { position: absolute; left: 0; height: 2px; border-radius: 2px; background: currentColor; transition: transform .45s var(--spring), width .4s var(--ease), opacity .25s, top .4s var(--ease); }
.burger i:nth-child(1) { top: 0; width: 18px; }
.burger i:nth-child(2) { top: 6px; width: 12px; }
.burger i:nth-child(3) { top: 12px; width: 15px; }
.burger-btn:hover .burger i { width: 18px; }
/* Desktop, sidebar expanded: arrow pointing left */
@media (min-width: 821px) {
  .shell:not(.collapsed) .burger i:nth-child(1) { width: 10px; transform: translate(-1px, 3px) rotate(-40deg); }
  .shell:not(.collapsed) .burger i:nth-child(2) { width: 18px; }
  .shell:not(.collapsed) .burger i:nth-child(3) { width: 10px; transform: translate(-1px, -3px) rotate(40deg); }
}
/* Mobile, drawer open: X */
.shell.drawer-open .burger i:nth-child(1) { width: 18px; top: 6px; transform: rotate(45deg); }
.shell.drawer-open .burger i:nth-child(2) { opacity: 0; transform: translateX(-8px); }
.shell.drawer-open .burger i:nth-child(3) { width: 18px; top: 6px; transform: rotate(-45deg); }

/* Logo glow + shine */
.logo { overflow: visible; }
.brand-logo .logo { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 45%, transparent)); }
.w-logo .logo { animation: logoGlow 3.2s ease-in-out infinite; }
@keyframes logoGlow { 0%, 100% { filter: drop-shadow(0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent)); } 50% { filter: drop-shadow(0 0 26px color-mix(in srgb, var(--accent) 75%, transparent)); } }
.w-ring { position: absolute; inset: -10px; border-radius: 50%; background: conic-gradient(from 0deg, transparent 0 60%, var(--accent) 80%, transparent 100%); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px)); animation: spin 3.6s linear infinite; opacity: .85; }
.w-logo.opening .logo { animation: openPulse .5s var(--ease) forwards; }
@keyframes openPulse { 40% { transform: scale(.88); } 100% { transform: scale(1.18); filter: drop-shadow(0 0 40px var(--accent)); opacity: .2; } }
.btn.shine::before { content: ''; position: absolute; inset: 0; z-index: 0; background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, .5) 50%, transparent 70%); transform: translateX(-120%); animation: btnShine 4s var(--ease) 1.2s infinite; pointer-events: none; }
@keyframes btnShine { 0%, 60% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }

/* Sidebar collapsible sections */
.nav-sec .nav-label { display: flex; align-items: center; padding: 18px 8px 6px 14px; }
.sec-toggle { flex: 1; display: flex; align-items: center; gap: 6px; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; text-align: left; padding: 2px 0; transition: color .2s; }
.sec-toggle:hover { color: var(--text); }
.sec-chev { transition: transform .4s var(--spring); transform: rotate(0deg); }
.nav-sec.open .sec-chev { transform: rotate(90deg); }
.sec-manage { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: var(--faint); opacity: 0; transition: opacity .2s, background-color .2s, color .2s, transform .4s var(--spring); }
.nav-sec:hover .sec-manage, .sec-manage:focus-visible { opacity: 1; }
.sec-manage:hover { background: var(--surface-2); color: var(--accent-ink); transform: rotate(60deg); }
.sec-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .45s var(--ease), opacity .3s; opacity: 0; }
.nav-sec.open .sec-body { grid-template-rows: 1fr; opacity: 1; }
.sec-inner { overflow: hidden; min-height: 0; }
.sec-empty { font-size: 12px; color: var(--faint); padding: 4px 14px 8px; }
.more-link .lbl { color: var(--accent-ink); font-weight: 500; }
.shell.collapsed .sec-body { grid-template-rows: 1fr; opacity: 1; }
.shell.collapsed .sec-toggle span, .shell.collapsed .sec-chev, .shell.collapsed .sec-manage, .shell.collapsed .sec-empty, .shell.collapsed .more-link { opacity: 0; pointer-events: none; }
.shell.collapsed .nav-sec .nav-label { padding: 12px 8px 6px; }
@media (hover: none) { .sec-manage { opacity: .7; } }

/* Shared bits */
.chip { white-space: nowrap; }
.tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tiles .tile:last-child { grid-column: 1 / -1; } }
.card-chips { flex-wrap: wrap; }
.ghost-chip { --c: var(--muted); background: var(--surface-2); color: var(--muted); border-color: var(--border-2); }
.chip svg { display: inline-block; vertical-align: -1px; }
button.chip { cursor: pointer; transition: filter .2s, transform .2s var(--spring); }
button.chip:hover { filter: brightness(1.2); transform: translateY(-1px); }
.reuse-note { color: var(--warn); font-weight: 600; }
.row-cat { width: 4px; height: 26px; border-radius: 4px; background: var(--c); opacity: .85; box-shadow: 0 0 10px var(--c); flex-shrink: 0; }
.danger-ic:hover { color: var(--bad) !important; background: color-mix(in srgb, var(--bad) 12%, transparent) !important; }
.btn.confirming, .icon-btn.confirming { width: auto !important; padding: 0 10px; background: var(--bad) !important; color: #fff !important; font-size: 12px; font-weight: 700; animation: pop .3s var(--spring); }
.req { color: var(--accent-ink); font-style: normal; }
.field-cap { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; letter-spacing: .02em; }
.spin-once { animation: spin .5s var(--ease); }
.avatar.xl { width: 84px; height: 84px; border-radius: 26px; font-size: 34px; }
.avatar.xl img { padding: 16px; }
.av-wrap.xl, .av-wrap.xl::before { border-radius: 30px; }
.card-wrap { border-radius: 22px; }
.card-wrap .swipe-bg { border-radius: 22px; }
.card.swiping { transition: none; }
.card-lines { display: flex; flex-direction: column; }

/* Switch rows */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; cursor: pointer; }
.sr-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sr-text b { font-weight: 500; font-size: 13.5px; color: var(--text); }
.sr-text span { font-size: 12px; color: var(--faint); line-height: 1.45; }
.switch-row .switch { flex-shrink: 0; }

/* Modal tweaks */
.modal-card { min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.modal-card > .modal-body { flex: 1; min-height: 0; overflow-y: auto; }
.m-head { flex-shrink: 0; }
.m-head.has-back .h-ic { display: none; }
.m-head .m-back { margin-right: 2px; }
.m-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-head .m-close { margin-left: auto; }
.modal-card .modal-foot { flex-shrink: 0; }

/* ---------- Editor ---------- */
.modal-card.editor { width: min(960px, 100%); height: min(780px, calc(100dvh - 40px)); max-height: none; padding: 0; }
.editor-root { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.ed-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.ed-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ed-title b { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.ed-title span { font-size: 12px; color: var(--accent-ink); font-weight: 600; transition: opacity .2s; }
.ed-save-top { display: none; }
.ed-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 290px minmax(0, 1fr); }
.ed-side { padding: 20px; border-right: 1px solid var(--border); overflow-y: auto; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 5%, transparent), transparent 60%); }
.ed-main { padding: 20px 22px 26px; overflow-y: auto; transition: opacity .14s var(--ease), transform .14s var(--ease); }
.ed-main.swapping { opacity: 0; transform: translateY(6px); }
.ed-main.swapped .ed-sec { animation: fadeUp .45s var(--ease) both; animation-delay: calc(var(--i) * 45ms); }
.ed-preview { margin-bottom: 18px; }
.pv-card {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 22px 16px 18px; border-radius: 22px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border-2);
}
.pv-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 120px; background: radial-gradient(100% 100% at 50% 0%, color-mix(in srgb, var(--c) 30%, transparent), transparent 70%); pointer-events: none; transition: background .4s; }
.pv-card > * { position: relative; }
.pv-name { font-size: 17px; font-weight: 700; word-break: break-word; max-width: 100%; }
.pv-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pv-st { width: 100%; display: flex; align-items: center; gap: 10px; font-size: 12px; }
.pv-st .meter { flex: 1; }
.ed-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--faint); margin: 0 2px 10px; }
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type-tile {
  position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px 6px; border-radius: 14px;
  font-size: 11.5px; font-weight: 600; text-align: center; line-height: 1.2; color: var(--muted); background: var(--surface); border: 1px solid var(--border-2);
  transition: color .25s, background-color .25s, border-color .25s, transform .3s var(--spring), box-shadow .3s;
}
.type-tile:hover { color: var(--text); border-color: var(--accent-line); transform: translateY(-2px); }
.type-tile.active { color: var(--accent-text); background: var(--grad); border-color: transparent; box-shadow: 0 8px 20px -8px var(--accent-glow); }
.type-tile.active svg { animation: pop .4s var(--spring); }
.ed-sec { padding: 18px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); margin-bottom: 14px; animation: fadeUp .5s var(--ease) both; animation-delay: calc(var(--i) * 50ms); }
.ed-sec h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 13px; font-weight: 700; color: var(--text); }
.ed-sec h4 svg { color: var(--accent-ink); }
.ed-sec .strength-box { margin-top: 0; }
.name-in { font-size: 16px; font-weight: 600; height: 50px; }
.cat-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-chip {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 20px; font-size: 12.5px; font-weight: 500;
  color: var(--muted); background: var(--surface); border: 1px solid var(--border-2); transition: all .25s var(--ease);
}
.cat-chip .dot { width: 9px; height: 9px; }
.cat-chip:hover { color: var(--text); border-color: color-mix(in srgb, var(--c, var(--accent)) 50%, transparent); }
.cat-chip.active { color: var(--text); background: color-mix(in srgb, var(--c, var(--accent)) 20%, transparent); border-color: var(--c, var(--accent)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--accent)) 15%, transparent); }
.cat-chip.add { border-style: dashed; color: var(--accent-ink); }
.cat-new { margin-top: 12px; padding: 14px; border-radius: 16px; border: 1px dashed var(--accent-line); background: var(--accent-soft); display: flex; flex-direction: column; gap: 12px; animation: fadeUp .35s var(--ease); }
.cat-new-actions { display: flex; justify-content: flex-end; gap: 8px; }
.swatches.mini { gap: 7px; }
.swatches.mini .swatch { width: 24px; height: 24px; }
.tag-sugg { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sugg { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; font-size: 12px; color: var(--muted); border: 1px dashed var(--border-2); transition: all .2s var(--ease); }
.sugg:hover { color: var(--accent-ink); border-color: var(--accent-line); background: var(--accent-soft); }
.org-switches { margin-top: 10px; border-top: 1px solid var(--border); }
.ed-foot { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); flex-shrink: 0; }
.ed-hint { margin-right: auto; font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 4px; }
.editor-root .discard { margin: 0 18px; }
.editor-root .discard.show { margin: 0 18px 12px; }

/* ---------- Settings ---------- */
.modal-card.settings-modal { width: min(860px, 100%); height: min(700px, calc(100dvh - 40px)); max-height: none; }
.set-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px; }
.set-nav { display: flex; flex-direction: column; gap: 4px; }
.set-nav button {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 12px; font-size: 13.5px; font-weight: 500;
  color: var(--muted); text-align: left; transition: background-color .25s, color .25s;
}
.set-nav button:hover { background: var(--surface-2); color: var(--text); }
.set-nav button.active { background: var(--accent-soft); color: var(--text); }
.set-nav button.active svg { color: var(--accent-ink); }
.set-pane { min-height: 0; overflow-y: auto; padding-right: 6px; }
.set-content.enter { animation: fadeUp .4s var(--ease) both; }
.set-group { padding: 4px 0 18px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.set-group:last-child { border-bottom: 0; margin-bottom: 0; }
.set-row { padding: 9px 0; }
.set-row .select { min-width: 170px; }
.palette { justify-content: space-between; align-items: flex-end; }
.palette svg { margin-bottom: 1px; }
.org-card {
  position: relative; overflow: hidden; width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 10px; border-radius: 18px; text-align: left;
  background: var(--surface); border: 1px solid var(--border-2); transition: transform .3s var(--ease), border-color .25s, box-shadow .3s;
}
.org-card:hover { transform: translateY(-2px); border-color: var(--accent-line); box-shadow: 0 14px 30px -18px var(--accent-glow); }
.org-card .o-ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex-shrink: 0; }
.oc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.oc-text b { font-size: 14.5px; } .oc-text span { font-size: 12px; color: var(--muted); }
.oc-n { font-size: 13px; font-weight: 700; color: var(--accent-ink); padding: 3px 10px; border-radius: 20px; background: var(--accent-soft); }
.about-hero { display: flex; align-items: center; gap: 18px; padding: 8px 0 14px; }

/* ---------- Organise ---------- */
.modal-card.organise-modal { width: min(640px, 100%); height: min(720px, calc(100dvh - 40px)); max-height: none; }
.org-tabs { width: 100%; margin-bottom: 14px; flex-shrink: 0; }
.org-tabs button { flex: 1; }
.org-add { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px dashed var(--border-2); margin-bottom: 14px; }
.org-add .input { flex: 1; min-width: 160px; height: 40px; }
.org-add .swatches { width: 100%; order: 3; }
.org-list { display: flex; flex-direction: column; gap: 6px; }
.org-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 8px 8px 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); transition: opacity .3s, border-color .25s; animation: fadeUp .35s var(--ease) both; }
.org-row:hover { border-color: var(--border-2); }
.org-row.is-hidden { opacity: .55; }
.org-row .org-name { flex: 1; min-width: 100px; height: 36px; background: transparent; border-color: transparent; font-weight: 500; }
.org-row .org-name:hover { border-color: var(--border-2); }
.org-row .org-name:focus { background: var(--surface-2); border-color: var(--accent); }
.org-color { width: 28px; height: 28px; border-radius: 9px; background: var(--c); flex-shrink: 0; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .2), 0 0 12px -2px var(--c); transition: transform .3s var(--spring); }
.org-color:hover { transform: scale(1.12); }
.org-color.icon-pick { background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; box-shadow: none; }
.org-ic { width: 28px; display: grid; place-items: center; color: var(--muted); }
.org-count { font-size: 12px; color: var(--faint); min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; }
.org-lock { width: 34px; display: grid; place-items: center; color: var(--faint); opacity: .6; }
.org-colors { width: 100%; display: none; flex-wrap: wrap; gap: 7px; padding: 8px 2px 4px; }
.org-row.picking .org-colors { display: flex; animation: fadeUp .3s var(--ease); }
.org-colors .swatch { width: 26px; height: 26px; }
.icon-grid, .org-colors.icons { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-choice { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: var(--muted); background: var(--surface); border: 1px solid var(--border-2); transition: all .2s var(--ease); }
.icon-choice:hover { color: var(--text); border-color: var(--accent-line); }
.icon-choice.active { color: var(--accent-text); background: var(--grad); border-color: transparent; }
.tb-fields { display: flex; flex-direction: column; gap: 8px; }
.tb-field { display: grid; grid-template-columns: minmax(0, 1fr) 150px auto; gap: 8px; align-items: center; animation: fadeUp .3s var(--ease); }
.tb-field .input, .tb-field .select { height: 40px; }

/* ---------- Detail header ---------- */
.detail-inner { padding-top: 14px; }
.d-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; margin: -14px -30px 6px; padding: 12px 22px 12px 26px; transition: background-color .3s, box-shadow .3s, border-color .3s; border-bottom: 1px solid transparent; }
.detail.scrolled .d-top { background: color-mix(in srgb, var(--solid) 92%, transparent); border-bottom-color: var(--border); box-shadow: 0 10px 30px -20px rgba(0, 0, 0, .5); }
.d-top-title { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transform: translateY(6px); transition: opacity .3s var(--ease), transform .35s var(--ease); }
.detail.scrolled .d-top-title { opacity: 1; transform: none; }
.d-top .d-actions { margin-left: auto; display: flex; gap: 4px; }
.d-hero { display: flex; align-items: center; gap: 20px; margin-bottom: 22px; position: relative; }
.d-hero::before { content: ''; position: absolute; left: -30px; right: -30px; top: -70px; height: 190px; background: radial-gradient(60% 100% at 20% 0%, color-mix(in srgb, var(--c) 22%, transparent), transparent 70%); pointer-events: none; z-index: -1; }
.d-hero-text { min-width: 0; flex: 1; }
.d-hero h2 { margin: 0 0 8px; font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; word-break: break-word; }
.d-meta { font-size: 12px; color: var(--faint); margin-top: 8px; }
.detail-inner.enter .d-hero > * { animation: fadeUp .5s var(--ease) both; }
.detail-inner.enter .d-hero-text { animation-delay: .06s; }
.detail-inner.enter .field { animation: fadeUp .45s var(--ease) both; animation-delay: calc(.1s + var(--i) * 35ms); }
.f-group { margin-bottom: 12px; }
.f-sec { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--faint); margin: 16px 4px 8px; }
.detail .back-btn { display: none; }
.content.grid-mode .detail .back-btn { display: grid; }

/* Mobile v4 */
@media (max-width: 820px) {
  .topbar .burger-btn { width: 44px; height: 44px; }
  /* Editor: full-screen sheet, single scroll */
  .modal-card.editor, .modal-card.settings-modal, .modal-card.organise-modal { height: 100dvh; max-height: 100dvh; border-radius: 0; padding-top: env(safe-area-inset-top); }
  .modal-card.settings-modal, .modal-card.organise-modal { padding-left: 16px; padding-right: 16px; }
  .ed-head { padding: 12px 12px 12px 8px; position: sticky; top: 0; background: var(--solid); z-index: 3; }
  .ed-save-top { display: inline-flex; }
  .ed-foot { display: none; }
  .ed-body { display: block; overflow-y: auto; overscroll-behavior: contain; }
  .ed-side { border-right: 0; padding: 14px 14px 4px; overflow: visible; }
  .ed-main { padding: 6px 14px calc(30px + env(safe-area-inset-bottom)); overflow: visible; }
  .pv-card { flex-direction: row; text-align: left; padding: 14px; gap: 14px; align-items: center; flex-wrap: wrap; }
  .pv-card .av-wrap.xl .avatar { width: 58px; height: 58px; border-radius: 18px; font-size: 24px; }
  .pv-card .av-wrap.xl, .pv-card .av-wrap.xl::before { border-radius: 21px; }
  .pv-name { flex: 1; font-size: 16px; }
  .pv-chips { width: 100%; justify-content: flex-start; }
  .ed-preview { margin-bottom: 14px; }
  .type-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .type-tile { padding: 10px 2px; font-size: 10.5px; border-radius: 12px; }
  .type-tile span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .ed-sec { padding: 14px; border-radius: 18px; }
  .editor-root .discard.show { margin: 0 12px 12px; }
  /* Settings: tab grid on top */
  .set-layout { display: flex; flex-direction: column; gap: 12px; }
  .set-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; flex-shrink: 0; }
  .set-nav button { flex-direction: column; gap: 5px; padding: 10px 4px; font-size: 11px; text-align: center; justify-content: center; background: var(--surface); border: 1px solid var(--border); }
  .set-nav button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .set-pane { flex: 1; padding-right: 0; padding-bottom: env(safe-area-inset-bottom); }
  .set-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .set-row .seg { width: 100%; }
  .set-row .seg button { flex: 1; padding: 0 6px; }
  .set-row .select, .sm-in { width: 100%; }
  .palettes { grid-template-columns: repeat(2, 1fr); }
  .tb-field { grid-template-columns: minmax(0, 1fr) 110px auto; }
  /* Detail header: roomy, centred hero */
  .d-top { margin: 0 -18px 4px; padding: calc(8px + env(safe-area-inset-top)) 12px 8px 8px; background: color-mix(in srgb, var(--solid) 94%, transparent); }
  .detail-inner { padding-top: 0; }
  .d-top .icon-btn.sm { width: 40px; height: 40px; border-radius: 12px; }
  .d-hero { flex-direction: column; text-align: center; gap: 14px; padding: 10px 6px 4px; margin-bottom: 20px; }
  .d-hero::before { left: -18px; right: -18px; top: -40px; height: 220px; background: radial-gradient(70% 100% at 50% 0%, color-mix(in srgb, var(--c) 26%, transparent), transparent 70%); }
  .d-hero h2 { font-size: 23px; }
  .d-chips { justify-content: center; }
  .detail .back-btn { display: grid; }
}
@media (max-width: 380px) {
  .type-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* =====================================================================
   v5 — home, masonry, smooth collapse, banners, backgrounds, extras
   ===================================================================== */
/* Smooth desktop collapse: sidebar is clipped (no reflow), main slides via FLIP in JS */
@media (min-width: 821px) {
  .sidebar { position: relative; z-index: 3; width: 264px; border-right: 0; clip-path: inset(0 calc(264px - var(--sb-w)) 0 0); transition: clip-path .46s cubic-bezier(.22, 1, .36, 1); }
  .main { position: relative; z-index: 1; border-left: 1px solid var(--border); }
}

/* Rows are now div[role=button] */
.row { cursor: pointer; user-select: none; -webkit-user-select: none; }
.open-btn { opacity: .55; }
.row:hover .open-btn, .card:hover .open-btn { opacity: 1; }

/* Cards */
.masonry.stagger > .m-col { animation: none; }
.masonry.stagger .row-wrap { animation: itemIn .55s var(--ease) both; animation-delay: calc(var(--i) * 28ms); }
.front::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .35s var(--ease); background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--c) 22%, transparent), transparent 60%); }
.card.tilting .front::after { opacity: 1; }
.card.tilting .face { border-color: color-mix(in srgb, var(--c) 45%, transparent); box-shadow: 0 26px 50px -26px var(--c); }
.card-memo { display: flex; gap: 7px; align-items: center; font-size: 12.5px; color: var(--muted); padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); min-width: 0; }
.card-memo span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.card-tags span { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--surface-2); color: var(--muted); }
.drag-src { opacity: .4; }

/* Category icons */
.cat-ic { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); flex-shrink: 0; }
.cat-chip .cat-ic { width: 16px; height: 16px; background: none; }
.org-color { display: grid; place-items: center; color: #fff; }
.oc-sub { width: 100%; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); margin-top: 4px; }

/* Page mode (Home / Security) */
.content.page-mode .collection { padding-right: 8px; }

/* ---------- Home ---------- */
.home { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; padding: 2px 2px 30px; max-width: 1440px; }
.home.stagger > * { animation: itemIn .65s var(--ease) both; animation-delay: calc(var(--i) * 60ms); }
.h-hero {
  grid-column: span 8; position: relative; overflow: hidden; isolation: isolate; border-radius: 28px; padding: 28px 30px 22px; min-height: 290px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 22px; border: 1px solid var(--accent-line);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--solid)), var(--solid) 72%);
}
.h-hero-fx span { position: absolute; border-radius: 50%; filter: blur(42px); z-index: -1; will-change: transform; }
.hb1 { width: 330px; height: 330px; background: var(--accent); top: -150px; right: -70px; opacity: .5; animation: heroFloat 14s ease-in-out infinite alternate; }
.hb2 { width: 250px; height: 250px; background: #7c3aed; bottom: -130px; left: 32%; opacity: .32; animation: heroFloat 18s ease-in-out infinite alternate-reverse; }
.hb3 { width: 190px; height: 190px; background: #10b981; top: 30%; left: -70px; opacity: .22; animation: heroFloat 16s ease-in-out infinite alternate; }
@keyframes heroFloat { to { transform: translate(40px, 30px) scale(1.12); } }
.h-hero-logo { position: absolute; right: -36px; bottom: -60px; opacity: .08; transform: rotate(-12deg); z-index: -1; pointer-events: none; }
.h-date { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-ink); }
.h-hero h1 {
  margin: 6px 0 8px; font-size: clamp(28px, 3.2vw, 42px); font-weight: 800; letter-spacing: -.03em; line-height: 1.05;
  background: linear-gradient(90deg, var(--text), color-mix(in srgb, var(--text) 55%, var(--accent))); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.h-hero p { margin: 0; color: var(--muted); font-size: 14.5px; max-width: 520px; }
.h-hero p b { color: var(--text); }
.h-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.btn.glassy { background: color-mix(in srgb, var(--text) 8%, transparent); border: 1px solid var(--border-2); }
@media (hover: hover) { .btn.glassy:hover { background: color-mix(in srgb, var(--text) 13%, transparent); border-color: var(--accent-line); transform: translateY(-1px); } }
.h-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.h-stat { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; border-radius: 16px; text-align: left; min-width: 0; background: color-mix(in srgb, var(--solid) 55%, transparent); border: 1px solid var(--border); transition: transform .35s var(--spring), border-color .25s; }
.h-stat[data-goto]:hover { transform: translateY(-2px); border-color: var(--accent-line); }
.h-stat b { font-size: 20px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; font-variant-numeric: tabular-nums; }
.h-stat > span:last-child { font-size: 11.5px; color: var(--muted); }
.hs-ic { color: var(--accent-ink); margin-bottom: 4px; }
.h-card { grid-column: span 4; min-width: 0; display: flex; flex-direction: column; border-radius: 24px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--border-2); }
.hc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.hc-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 700; }
.hc-head h3 svg { color: var(--accent-ink); }
.hc-n { font-size: 12px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); padding: 2px 9px; border-radius: 20px; }
.hc-actions { display: flex; gap: 14px; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--accent-ink); transition: gap .25s var(--ease), opacity .2s; }
.link-btn:hover { gap: 7px; }
.h-health .hh-top { display: flex; align-items: center; gap: 18px; margin-bottom: 14px; }
.ring-wrap.sm { width: 92px; height: 92px; }
.ring-wrap.sm .ring-val b { font-size: 26px; }
.h-issues { display: grid; gap: 6px; }
.h-issue { --tc: var(--good); display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; font-size: 13px; background: var(--surface); border: 1px solid var(--border); transition: border-color .25s, transform .3s var(--ease); }
.h-issue.bad { --tc: var(--bad); } .h-issue.warn { --tc: var(--warn); } .h-issue.info { --tc: var(--accent); }
.h-issue:hover { border-color: color-mix(in srgb, var(--tc) 45%, transparent); transform: translateX(3px); }
.hi-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tc); box-shadow: 0 0 8px var(--tc); }
.hi-l { flex: 1; text-align: left; color: var(--muted); }
.h-issue b { font-variant-numeric: tabular-nums; }
.h-issue.ok b { color: var(--good); }
.h-issue svg { color: var(--faint); }
.h-alerts { grid-column: span 12; }
.ha-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.ha-row { --tc: var(--accent); display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--tc); }
.ha-row.bad { --tc: var(--bad); } .ha-row.warn { --tc: var(--warn); }
.ha-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--tc) 15%, transparent); color: var(--tc); flex-shrink: 0; }
.ha-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ha-text b { font-size: 13px; font-weight: 600; }
.ha-text span { font-size: 12px; color: var(--muted); }
.h-favs { grid-column: span 8; }
.fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.fav-tile { position: relative; overflow: hidden; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; cursor: pointer; background: var(--surface); border: 1px solid var(--border); transition: transform .35s var(--spring), border-color .25s, box-shadow .35s; }
.fav-tile::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(120% 120% at 0 0, color-mix(in srgb, var(--c) 18%, transparent), transparent 60%); }
.fav-tile:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--c) 50%, transparent); box-shadow: 0 14px 30px -18px var(--c); }
.ft-text, .hr-text, .tl-text { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ft-text b, .hr-text b, .tl-text b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ft-text span, .hr-text span, .tl-text span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fav-tile .avatar, .h-row .avatar { width: 38px; height: 38px; border-radius: 12px; font-size: 15px; }
.fav-tile .avatar img, .h-row .avatar img { padding: 7px; }
.fav-tile .icon-btn { position: relative; opacity: .6; }
.fav-tile:hover .icon-btn { opacity: 1; }
.h-recent { grid-column: span 4; }
.h-list { display: flex; flex-direction: column; gap: 2px; }
.h-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; cursor: pointer; transition: background-color .2s; }
.h-row:hover { background: var(--surface-2); }
.h-row .icon-btn { opacity: 0; transition: opacity .2s; }
.h-row:hover .icon-btn { opacity: 1; }
@media (hover: none) { .h-row .icon-btn { opacity: .8; } }
.h-break { grid-column: span 6; }
.hb-bar { display: flex; height: 14px; gap: 3px; transform: scaleX(0); transform-origin: left; transition: transform 1.1s var(--ease); }
.hb-bar.grown { transform: none; }
.hb-bar span { min-width: 6px; border-radius: 5px; background: var(--c); box-shadow: 0 0 12px -2px var(--c); }
.hb-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 14px 0 16px; }
.hb-key { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); transition: color .2s; }
.hb-key b { color: var(--text); font-weight: 700; }
.hb-key:hover { color: var(--text); }
.hb-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; margin-top: auto; }
.hb-type { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; border-radius: 14px; color: var(--accent-ink); background: var(--surface); border: 1px solid var(--border); transition: transform .3s var(--spring), border-color .25s; }
.hb-type:hover { transform: translateY(-2px); border-color: var(--accent-line); }
.hb-type b { font-size: 20px; font-weight: 800; color: var(--text); margin-top: 6px; }
.hb-type span { font-size: 11.5px; color: var(--muted); text-align: left; }
.h-updated { grid-column: span 6; }
.timeline { position: relative; display: flex; flex-direction: column; }
.timeline::before { content: ''; position: absolute; left: 13px; top: 14px; bottom: 14px; width: 2px; background: linear-gradient(var(--accent-line), transparent); }
.tl-row { position: relative; display: flex; align-items: center; gap: 14px; padding: 9px 8px 9px 6px; border-radius: 12px; cursor: pointer; transition: background-color .2s; }
.tl-row:hover { background: var(--surface-2); }
.tl-dot { position: relative; z-index: 1; width: 16px; height: 16px; border-radius: 50%; background: var(--solid); border: 3px solid var(--c); box-shadow: 0 0 10px -2px var(--c); flex-shrink: 0; }
.tl-when { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.h-tip { grid-column: span 12; flex-direction: row; align-items: center; gap: 14px; background: linear-gradient(90deg, var(--accent-soft), transparent 70%), var(--surface); }
.tip-ic { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--grad); color: var(--accent-text); flex-shrink: 0; }
.h-tip div { display: flex; flex-direction: column; gap: 2px; }
.h-tip b { font-size: 13px; }
.h-tip span { font-size: 13px; color: var(--muted); }
.h-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; color: var(--faint); padding: 18px; font-size: 13px; min-height: 130px; }
.h-empty span { max-width: 260px; color: var(--muted); }
@media (max-width: 1200px) {
  .h-hero, .h-favs, .h-alerts { grid-column: span 12; }
  .h-health, .h-recent, .h-break, .h-updated { grid-column: span 6; }
}

/* ---------- Floating banner ---------- */
.float-banner {
  position: fixed; z-index: 65; left: 50%; top: 18px; width: min(580px, calc(100% - 24px)); display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px;
  border-radius: 18px; background: var(--solid); border: 1px solid var(--accent-line); box-shadow: 0 24px 60px -16px rgba(0, 0, 0, .6), 0 0 0 4px var(--accent-soft);
  transform: translate(-50%, -170%); opacity: 0; pointer-events: none; transition: transform .6s var(--spring), opacity .3s;
}
.float-banner.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.float-banner.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); box-shadow: 0 24px 60px -16px rgba(0, 0, 0, .6), 0 0 0 4px color-mix(in srgb, var(--warn) 12%, transparent); }
.float-banner.warn .fb-ic { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.fb-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); flex-shrink: 0; }
.fb-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--muted); }
.fb-text b { font-size: 14px; color: var(--text); }
.fb-text svg { display: inline; vertical-align: -2px; }
.fb-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ---------- Pull to refresh ---------- */
.pull-ind {
  position: absolute; z-index: 7; left: 50%; top: 60px; width: 40px; height: 40px; margin-top: -44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--solid); border: 1px solid var(--accent-line); color: var(--accent-ink); box-shadow: 0 10px 24px -8px var(--accent-glow);
  transform: translate(-50%, 0); opacity: 0; pointer-events: none; transition: transform .45s var(--spring), opacity .3s, background-color .2s, color .2s;
}
.pull-ind.pulling { transition: background-color .2s, color .2s; }
.pull-ind.armed, .pull-ind.spinning { background: var(--grad); color: var(--accent-text); }
.pull-ind.spinning { opacity: 1; }
.pull-ind.spinning svg { animation: spin .8s linear infinite; }

/* ---------- Drag & drop ---------- */
.drag-ghost { position: fixed; top: -200px; left: -200px; display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 12px; background: var(--grad); color: var(--accent-text); font-weight: 600; font-size: 13px; white-space: nowrap; }
.nav-item { transition: background-color .25s var(--ease), color .25s var(--ease), transform .3s var(--spring), box-shadow .25s; }
body.dragging .nav-item:is([data-f^="cat:"], [data-f^="tag:"], [data-f="fav"], [data-f="bin"]) { box-shadow: inset 0 0 0 1px var(--accent-line); }
body.dragging .nav-sec .sec-body { grid-template-rows: 1fr; opacity: 1; }
.nav-item.drop-hot { background: var(--accent-soft) !important; color: var(--text); transform: translateX(4px); box-shadow: inset 0 0 0 2px var(--accent) !important; }
.nav-item.drop-done { animation: pop .5s var(--spring); }

/* ---------- Favourites reorder ---------- */
.reorder-hint { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); padding: 10px 14px; margin-bottom: 10px; border-radius: 14px; background: var(--accent-soft); border: 1px dashed var(--accent-line); }
.reorder-list { display: flex; flex-direction: column; gap: 6px; max-width: 760px; }
.ro-row { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 6px; border-radius: 16px; cursor: grab; user-select: none; background: var(--surface); border: 1px solid var(--border-2); animation: fadeUp .4s var(--ease) both; animation-delay: calc(var(--i) * 25ms); }
.ro-row .meta { flex: 1; min-width: 0; }
.ro-row .name { font-weight: 600; }
.ro-grip { width: 26px; display: grid; place-items: center; color: var(--faint); }
.ro-row.dragging-row { opacity: .5; border-style: dashed; border-color: var(--accent); }

/* ---------- Wi-Fi QR ---------- */
.qr-btn { margin: 4px 0 12px; }
.qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 4px 0; }
.qr-card { width: min(280px, 72vw); padding: 12px; border-radius: 24px; background: #fff; box-shadow: 0 0 0 6px var(--accent-soft), 0 20px 50px -20px var(--accent-glow); animation: pop .5s var(--spring); }
.qr-svg { display: block; width: 100%; height: auto; }
.qr-info { display: flex; flex-direction: column; gap: 4px; text-align: center; }
.qr-info b { font-size: 17px; }
.qr-info span { font-size: 12.5px; color: var(--muted); }

/* ---------- Editor conflict ---------- */
.conflict { display: none; align-items: center; gap: 10px; flex-wrap: wrap; margin: 12px 18px 0; padding: 10px 14px; border-radius: 14px; font-size: 13px; background: color-mix(in srgb, var(--warn) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); color: color-mix(in srgb, var(--warn) 80%, var(--text)); }
.conflict.show { display: flex; animation: fadeUp .35s var(--ease); }
.conflict > span { display: flex; align-items: center; gap: 8px; margin-right: auto; }

/* ---------- Backgrounds & wallpaper ---------- */
.bg-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 9px; }
.bg-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px; border-radius: 16px; text-align: left; background: var(--surface); border: 2px solid transparent; transition: border-color .25s, transform .3s var(--spring), box-shadow .3s; }
.bg-pick:hover { transform: translateY(-2px); }
.bg-pick.active { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.bg-pick b { font-size: 12.5px; margin-top: 6px; }
.bg-pick > span:last-child { font-size: 11px; color: var(--faint); }
.bgp-prev { width: 100%; height: 54px; border-radius: 11px; background: #05080b; }
.bgp-glow .bgp-prev { background: radial-gradient(circle at 20% 20%, var(--accent), transparent 55%), radial-gradient(circle at 90% 90%, #7c3aed, transparent 50%), #05080b; }
.bgp-aurora .bgp-prev { background: linear-gradient(120deg, #05080b, color-mix(in srgb, var(--accent) 60%, #05080b), #4c1d95, #065f46, #05080b); background-size: 300% 100%; animation: auroraPrev 6s ease-in-out infinite alternate; }
@keyframes auroraPrev { to { background-position: 100% 0; } }
.bgp-stars .bgp-prev { background: radial-gradient(1px 1px at 20% 30%, #fff, transparent), radial-gradient(1px 1px at 60% 20%, #fff, transparent), radial-gradient(1.5px 1.5px at 80% 60%, #fff, transparent), radial-gradient(1px 1px at 35% 75%, #fff, transparent), radial-gradient(1px 1px at 70% 85%, #fff, transparent), radial-gradient(1px 1px at 90% 15%, #fff, transparent), #05080b; }
.bgp-seasonal .bgp-prev { background: linear-gradient(135deg, #1e3a5f 0 25%, #be185d 25% 50%, #ca8a04 50% 75%, #9a3412 75%); }
.bgp-none .bgp-prev { background: var(--bg); border: 1px solid var(--border-2); }
.wp-ctl { display: flex; flex-wrap: wrap; gap: 8px; }
.wp-ctl label.btn { cursor: pointer; }
.fx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
html.has-wp .bg { background-size: cover; background-position: center; }
html.has-wp .bg::after { content: ''; position: absolute; inset: 0; background: rgba(2, 3, 4, var(--wp-dim, .45)); }
html[data-theme="light"].has-wp .bg::after { background: rgba(238, 243, 247, var(--wp-dim, .45)); }
html.has-wp .glow, html.has-wp .grid-fx { display: none; }
html.anim-bg .glow { opacity: .12; }
html.anim-bg .glass { backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%); }

/* Mobile v5 */
@media (max-width: 820px) {
  .home { gap: 12px; padding-bottom: 20px; }
  .home > * { grid-column: span 12 !important; }
  .h-hero { padding: 22px 18px 16px; min-height: 0; border-radius: 24px; }
  .h-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .h-card { padding: 16px; border-radius: 20px; }
  .fav-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .fav-tile { flex-direction: column; align-items: flex-start; gap: 8px; }
  .fav-tile .icon-btn { position: absolute; top: 8px; right: 8px; }
  .ft-text { width: 100%; }
  .ha-list { grid-template-columns: 1fr; }
  .float-banner { flex-wrap: wrap; top: calc(10px + env(safe-area-inset-top)); }
  .fb-actions { width: 100%; justify-content: flex-end; }
  .masonry { gap: 12px; }
  .m-col { gap: 12px; }
}
