/* =========================================================================
   MediaVault v3 — "Gallery" design system
   Calm graphite surfaces, iris accent, content-first layout.
   ========================================================================= */

:root {
  --bg: #0b0c10;
  --bg-elev: #0f1115;
  --surface: #15171c;
  --surface-2: #1b1e24;
  --surface-3: #22262d;
  --hover: rgba(255, 255, 255, .045);
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .12);
  --text: #f1f2f4;
  --text-2: #a3a8b3;
  --text-3: #6c717d;
  --brand: #7b6bff;
  --brand-2: #c069ff;
  --brand-text: #a99eff;
  --brand-soft: rgba(123, 107, 255, .14);
  --brand-glow: rgba(123, 107, 255, .45);
  --on-brand: #ffffff;
  --grad: linear-gradient(135deg, var(--brand), var(--brand-2));
  --pdf: #ff5d7d;
  --pdf-soft: rgba(255, 93, 125, .13);
  --img: #3cc2ff;
  --img-soft: rgba(60, 194, 255, .13);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, .13);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .13);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, .13);
  --tile-bg: #191c22;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6), 0 0 0 1px var(--line);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .75), 0 0 0 1px var(--line-2);
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  --font: "Segoe UI Variable Text", "Segoe UI Variable", -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Segoe UI Variable Display", -apple-system, BlinkMacSystemFont, "SF Pro Display", Inter, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --side-w: 260px;
  --drawer-w: 400px;
  --top-h: 68px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f5f6f8;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f3f6;
  --surface-3: #e9ebef;
  --hover: rgba(16, 20, 32, .045);
  --line: rgba(16, 20, 32, .08);
  --line-2: rgba(16, 20, 32, .14);
  --text: #11141b;
  --text-2: #565c69;
  --text-3: #8b909c;
  --brand: #5d4bf2;
  --brand-2: #a24dff;
  --brand-text: #5340e8;
  --brand-soft: rgba(93, 75, 242, .1);
  --brand-glow: rgba(93, 75, 242, .35);
  --pdf: #e5254f;
  --pdf-soft: rgba(229, 37, 79, .09);
  --img: #0a8fd1;
  --img-soft: rgba(10, 143, 209, .1);
  --ok: #059669;
  --ok-soft: rgba(5, 150, 105, .1);
  --warn: #c27c00;
  --warn-soft: rgba(194, 124, 0, .1);
  --danger: #dc2f2f;
  --danger-soft: rgba(220, 47, 47, .09);
  --tile-bg: #eceef2;
  --shadow-sm: 0 1px 2px rgba(16, 20, 32, .06);
  --shadow: 0 10px 30px -14px rgba(16, 20, 32, .18), 0 0 0 1px var(--line);
  --shadow-lg: 0 30px 80px -24px rgba(16, 20, 32, .3), 0 0 0 1px var(--line);
  color-scheme: light;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { display: block; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; }
::selection { background: var(--brand); color: #fff; }
:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; border-radius: 8px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); }

.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
kbd { font: 600 10.5px/1 var(--mono); padding: 4px 6px; border-radius: 6px; color: var(--text-3); background: var(--surface-2); border: 1px solid var(--line); }
.muted { color: var(--text-2); }
.eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--brand-text); letter-spacing: .02em; }
code { font: 12.5px var(--mono); padding: 1px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }

/* theme icon swap */
.ic-sun { display: none; }
:root[data-theme="light"] .ic-sun { display: block; }
:root[data-theme="light"] .ic-moon { display: none; }

/* ------------------------------------------------------------------ brand */
.brand { display: flex; align-items: center; gap: 10px; font: 700 16px/1 var(--display); letter-spacing: -.02em; }
.mark {
  width: 34px; height: 34px; border-radius: 11px; background: var(--grad); display: grid; place-items: center; flex: none;
  box-shadow: 0 8px 22px -8px var(--brand-glow), inset 0 1px 0 rgba(255,255,255,.25);
}
.mark svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--surface); font-weight: 600; font-size: 13.5px; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .2s, transform .12s, filter .15s; box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--grad); color: var(--on-brand); border-color: transparent; box-shadow: 0 8px 24px -10px var(--brand-glow), inset 0 1px 0 rgba(255,255,255,.2); }
.btn-primary:hover { background: var(--grad); filter: brightness(1.08); box-shadow: 0 10px 30px -8px var(--brand-glow), inset 0 1px 0 rgba(255,255,255,.2); }
.btn-soft { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; box-shadow: none; }
.btn-soft:hover { background: var(--brand-soft); filter: brightness(1.15); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--hover); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; box-shadow: none; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; height: 48px; font-size: 15px; border-radius: 14px; }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 11px; flex: none; border: 0; background: transparent;
  color: var(--text-2); transition: background .15s, color .15s;
}
.icon-btn:hover { color: var(--text); background: var(--hover); }
.icon-btn:disabled { opacity: .35; pointer-events: none; }
.link-btn { background: none; border: 0; color: var(--text-2); padding: 6px 0; font-size: 13px; }
.link-btn:hover { color: var(--text); }

/* ------------------------------------------------------------------ forms */
.form { display: grid; gap: 16px; }
.form-inline { margin: 14px 0 0; text-align: center; }
.field { display: grid; gap: 7px; }
.field > span { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field em.caps { font-style: normal; color: var(--warn); font-size: 11.5px; }
.input-wrap {
  position: relative; display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line); transition: border-color .15s, box-shadow .15s, background .15s;
}
.input-wrap:hover { border-color: var(--line-2); }
.input-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); background: var(--surface); }
.input-wrap > .i { color: var(--text-3); }
.input-wrap input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 14.5px; }
.reveal { background: none; border: 0; padding: 6px; margin-right: -6px; color: var(--text-3); display: grid; }
.reveal:hover, .reveal.on { color: var(--text); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; margin-bottom: 18px; font-size: 13.5px; }
.alert .i { margin-top: 1px; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-info { background: var(--brand-soft); color: var(--brand-text); }

.strength { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 5px; align-items: center; }
.strength i { height: 4px; border-radius: 4px; background: var(--line-2); transition: background .2s; }
.strength em { font-size: 11.5px; font-weight: 600; color: var(--text-3); font-style: normal; min-width: 52px; text-align: right; }
.strength[data-s="1"] i:nth-child(-n+1) { background: var(--danger); }
.strength[data-s="2"] i:nth-child(-n+2) { background: var(--warn); }
.strength[data-s="3"] i:nth-child(-n+3) { background: var(--brand); }
.strength[data-s="4"] i:nth-child(-n+4) { background: var(--ok); }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { display: inline-grid; place-items: center; height: 30px; min-width: 32px; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: var(--text-3); transition: .15s; }
.seg button:hover { color: var(--text); }
.seg button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.seg .i { width: 16px; height: 16px; }

/* =================================================================== AUTH */
.auth-body { overflow-x: hidden; min-height: 100vh; }
.aurora { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.aurora i { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5; animation: drift 22s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { width: 560px; height: 560px; left: -140px; top: -180px; background: var(--brand); opacity: .35; }
.aurora i:nth-child(2) { width: 480px; height: 480px; right: -160px; top: 20%; background: var(--brand-2); opacity: .25; animation-delay: -6s; }
.aurora i:nth-child(3) { width: 420px; height: 420px; left: 30%; bottom: -220px; background: var(--img); opacity: .18; animation-delay: -12s; }
@keyframes drift { to { transform: translate(60px, 40px) scale(1.08); } }
.mosaic {
  position: fixed; inset: -40px; z-index: 0; display: grid; grid-template-columns: repeat(8, 1fr); gap: 14px; padding: 14px;
  opacity: .5; transform: rotate(-8deg) scale(1.15); pointer-events: none;
  -webkit-mask-image: radial-gradient(60% 60% at 50% 50%, transparent 30%, #000 85%); mask-image: radial-gradient(60% 60% at 50% 50%, transparent 30%, #000 85%);
}
.mosaic span { border-radius: 14px; background: var(--surface); border: 1px solid var(--line); aspect-ratio: 3 / 4; }
.mosaic span:nth-child(3n) { aspect-ratio: 4 / 3; background: linear-gradient(160deg, var(--img-soft), var(--surface)); }
.mosaic span:nth-child(4n+1) { background: linear-gradient(160deg, var(--pdf-soft), var(--surface)); }
.mosaic span:nth-child(5n) { background: linear-gradient(160deg, var(--brand-soft), var(--surface)); }
.auth-wrap { position: relative; z-index: 1; min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 22px; padding: 40px 16px; }
.auth-card {
  width: 100%; max-width: 400px; padding: 34px 32px 28px; border-radius: 26px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: var(--shadow-lg); animation: rise .5s var(--ease) both;
}
.auth-card .brand { margin-bottom: 30px; }
.auth-card h1 { font: 700 28px/1.15 var(--display); letter-spacing: -.03em; margin: 0 0 6px; }
.auth-card .sub { color: var(--text-2); margin: 0 0 26px; }
.auth-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; }
.auth-foot span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 30px; font-size: 12px; color: var(--text-2);
  background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--line); backdrop-filter: blur(10px); }
.auth-foot .i { width: 14px; height: 14px; color: var(--brand-text); }
.theme-toggle { position: fixed; top: 18px; right: 18px; z-index: 2; background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(10px); box-shadow: 0 0 0 1px var(--line); }
.secure-note { display: flex; gap: 7px; align-items: center; justify-content: center; margin: 22px 0 0; font-size: 12px; color: var(--text-3); }
.secure-note .i { width: 15px; height: 15px; color: var(--ok); }
.otp { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.otp input {
  height: 58px; text-align: center; font: 700 24px var(--mono); border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2);
  outline: 0; min-width: 0; transition: .15s; caret-color: var(--brand);
}
.otp input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); background: var(--surface); }
.otp input.filled { border-color: var(--line-2); background: var(--surface); }
.otp.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { translate: -6px; } 40%, 80% { translate: 6px; } }
.backup summary { cursor: pointer; color: var(--text-2); font-size: 13px; list-style: none; }
.backup summary::-webkit-details-marker { display: none; }
.backup summary:hover { color: var(--brand-text); }
.backup[open] summary { margin-bottom: 12px; }
@keyframes rise { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* =================================================================== APP SHELL */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; transition: padding-right .3s var(--ease); }
.shell.has-drawer { padding-right: var(--drawer-w); }

/* ----- sidebar */
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 18px 14px 14px;
  background: var(--bg-elev); border-right: 1px solid var(--line); overflow-y: auto;
}
.side-brand { padding: 2px 6px 18px; }
.side-upload { width: 100%; height: 44px; margin-bottom: 14px; border-radius: 13px; justify-content: flex-start; padding: 0 14px; }
.side-upload kbd { margin-left: auto; background: rgba(255,255,255,.18); border-color: transparent; color: #fff; }
.nav { display: grid; gap: 2px; }
.nav-label { margin: 14px 10px 6px; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 10px; border-radius: 10px; border: 0; background: none;
  color: var(--text-2); font-weight: 550; text-align: left; transition: background .15s, color .15s;
}
.nav-item span { flex: 1; }
.nav-item .i { width: 18px; height: 18px; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.is-active { background: var(--brand-soft); color: var(--text); }
.nav-item.is-active .i { color: var(--brand-text); }
.nav-item b { font: 600 11.5px var(--font); color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav-item.is-active b { color: var(--brand-text); }
.nav-item .ni-pdf { color: var(--pdf); } .nav-item .ni-img { color: var(--img); }
.nav-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.nav-dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

.storage { margin-top: auto; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.storage-top { display: flex; align-items: center; gap: 12px; }
.ring { position: relative; width: 44px; height: 44px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring .track { stroke: var(--surface-3); }
.ring .bar { stroke: url(#gradRing); stroke-linecap: round; stroke-dasharray: 113.1; stroke-dashoffset: 113.1; transition: stroke-dashoffset .8s var(--ease); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; }
.storage-top div { min-width: 0; }
.storage-top strong { display: block; font-size: 14px; font-weight: 650; }
.storage-top small { display: block; color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.typebar { display: flex; height: 6px; border-radius: 6px; overflow: hidden; background: var(--surface-3); margin: 14px 0 8px; gap: 2px; }
.typebar i { display: block; height: 100%; transition: width .6s var(--ease); }
.typebar .tb-pdf { background: var(--pdf); } .typebar .tb-img { background: var(--img); }
.legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 3px; display: inline-block; flex: none; }
.dot-pdf { background: var(--pdf); } .dot-img { background: var(--img); }

.side-user { display: flex; align-items: center; gap: 10px; padding: 12px 6px 2px; }
.side-user > div { flex: 1; min-width: 0; display: grid; }
.side-user b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user small { font-size: 11.5px; color: var(--text-3); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff; font-weight: 700; flex: none; font-size: 14px; }
.side-user form { margin: 0; }

/* ----- main + topbar */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border-bottom: 1px solid transparent; transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.brand-mobile { display: none; }
.search {
  flex: 1; max-width: 560px; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 8px 0 14px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid transparent; transition: .15s;
}
.search:hover { border-color: var(--line); }
.search:focus-within { background: var(--surface); border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.search .i { color: var(--text-3); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 14.5px; }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear { width: 28px; height: 28px; }
.top-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.top-upload { display: none; }

/* selection bar replaces topbar content */
.selbar {
  position: absolute; inset: 0; display: flex; align-items: center; gap: 10px; padding: 0 24px 0 20px; background: var(--brand); color: #fff;
  animation: slideDown .25s var(--ease);
}
.selbar .icon-btn { color: #fff; }
.selbar .icon-btn:hover { background: rgba(255,255,255,.15); }
.selbar b { font: 650 16px var(--display); flex: 1; }
.selbar .btn { background: rgba(255,255,255,.16); border-color: transparent; color: #fff; box-shadow: none; }
.selbar .btn:hover { background: rgba(255,255,255,.26); }
.selbar .btn-del:hover { background: #fff; color: var(--danger); }
@keyframes slideDown { from { transform: translateY(-100%); } }

.content { padding: 4px 32px 120px; flex: 1; }

/* ----- page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 18px 0 20px; flex-wrap: wrap; }
.greet { margin: 0 0 4px; font-size: 13.5px; color: var(--text-2); }
.page-head h1 { margin: 0; font: 700 32px/1.1 var(--display); letter-spacing: -.035em; }
.page-meta { margin: 6px 0 0; color: var(--text-3); font-size: 13px; }
.tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sorter { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px 0 12px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-3); }
.sorter select { appearance: none; border: 0; background: none; outline: 0; color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; padding-right: 2px; }
.sorter select option { background: var(--surface); }
.sorter .i { width: 16px; height: 16px; }
.sizer { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-3); }
.sizer .i { width: 14px; height: 14px; }
.sizer .i + input + .i { width: 18px; height: 18px; }
.sizer input { width: 92px; accent-color: var(--brand); cursor: pointer; }
#selectBtn.is-active { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; }

.col-chips { display: none; gap: 8px; overflow-x: auto; margin: -4px -16px 16px; padding: 2px 16px; scrollbar-width: none; }
.col-chips::-webkit-scrollbar { display: none; }
.col-chips button { flex: none; height: 34px; padding: 0 14px; border-radius: 30px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13px; color: var(--text-2); }
.col-chips button.is-active { background: var(--text); color: var(--bg); border-color: transparent; }

.drop-hint {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; margin-bottom: 22px; border-radius: 14px; border: 1px dashed var(--line-2);
  color: var(--text-2); font-size: 13px; transition: .2s;
}
.drop-hint .i { color: var(--brand-text); }
.drop-hint b { color: var(--text); font-weight: 600; }
.drop-hint .chips { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.chip { font: 700 10px/1 var(--mono); letter-spacing: .04em; padding: 5px 7px; border-radius: 6px; }
.chip-pdf { color: var(--pdf); background: var(--pdf-soft); } .chip-img { color: var(--img); background: var(--img-soft); }
.drop-hint.over { border-color: var(--brand); background: var(--brand-soft); }

/* ----- sections */
.sec { margin-bottom: 26px; }
.sec-h { position: sticky; top: var(--top-h); z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 0; margin-bottom: 4px; background: var(--bg); }
.sec-h h3 { margin: 0; font: 650 15px var(--display); letter-spacing: -.01em; }
.sec-h span { font-size: 12.5px; color: var(--text-3); }
.sec-h button { margin-left: auto; opacity: 0; transition: opacity .15s; }
.sec:hover .sec-h button, .selecting .sec-h button { opacity: 1; }

/* ----- justified gallery */
.gallery { display: flex; flex-wrap: wrap; gap: 8px; }
.tile {
  position: relative; margin: 0; flex: none; width: 200px; height: 200px; border-radius: var(--r); overflow: hidden; background: var(--tile-bg); cursor: pointer; outline: 0;
  transition: transform .25s var(--ease), box-shadow .2s, border-radius .25s;
}
.tile.enter { animation: tileIn .45s var(--ease) both; }
@keyframes tileIn { from { opacity: 0; transform: scale(.96); } }
.tile:focus-visible { box-shadow: 0 0 0 3px var(--brand); }
.tile-media { position: absolute; inset: 0; }
.tile-media img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .35s, transform .6s var(--ease); }
.tile-media img.loaded { opacity: 1; }
.tile:hover .tile-media img { transform: scale(1.035); }
.tile-media img.page { object-fit: cover; object-position: top; background: #fff; }
.tile-media > .i { position: absolute; inset: 0; margin: auto; width: 34px; height: 34px; color: var(--text-3); }

/* PDF designed cover */
.cover {
  position: absolute; inset: 0; display: flex; flex-direction: column; padding: 44px 12% 12%;
  background: linear-gradient(165deg, color-mix(in srgb, var(--pdf) 20%, var(--surface)) 0%, var(--surface) 55%);
}
.cover::before { content: ""; position: absolute; top: 0; right: 0; width: 22%; aspect-ratio: 1; background: linear-gradient(225deg, var(--bg) 50%, color-mix(in srgb, var(--pdf) 30%, var(--surface-3)) 50%); border-bottom-left-radius: 8px; }
.cover-tag { align-self: flex-start; font: 800 10px/1 var(--mono); letter-spacing: .1em; color: #fff; background: var(--pdf); padding: 5px 7px; border-radius: 6px; }
.cover-title {
  margin-top: auto; font: 700 clamp(12px, 1.25vw, 19px)/1.2 var(--display); letter-spacing: -.02em; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; hyphens: auto;
}
.cover-lines { display: grid; gap: 5px; margin-top: 10px; }
.cover-lines i { height: 3px; border-radius: 3px; background: var(--line-2); }
.cover-lines i:nth-child(2) { width: 70%; } .cover-lines i:nth-child(3) { width: 45%; }

.tile-shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.65), transparent 45%), linear-gradient(to bottom, rgba(0,0,0,.35), transparent 30%); opacity: 0; transition: opacity .2s; pointer-events: none; }
.tile:hover .tile-shade, .tile.is-sel .tile-shade, .selecting .tile .tile-shade { opacity: 1; }
.tile-check {
  position: absolute; left: 10px; top: 10px; z-index: 2; width: 24px; height: 24px; padding: 0; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid rgba(255,255,255,.9); background: rgba(0,0,0,.18); color: transparent; opacity: 0; transform: scale(.85); transition: .18s var(--ease);
}
.tile-check .i { width: 14px; height: 14px; stroke-width: 3; }
.tile:hover .tile-check, .selecting .tile-check { opacity: 1; transform: none; }
.tile-check:hover { background: rgba(255,255,255,.25); }
.tile-quick { position: absolute; right: 8px; top: 8px; z-index: 2; display: flex; gap: 4px; opacity: 0; transform: translateY(-4px); transition: .18s var(--ease); }
.tile:hover .tile-quick { opacity: 1; transform: none; }
.selecting .tile-quick { display: none; }
.tile-quick button {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; border: 0; color: #fff;
  background: rgba(20,20,24,.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: .15s;
}
.tile-quick button:hover { background: rgba(20,20,24,.8); }
.tile-quick button.done { background: var(--ok); }
.tile-quick .i { width: 16px; height: 16px; }
.tile-cap {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 10px 12px; color: #fff; display: grid; gap: 1px;
  opacity: 0; transform: translateY(6px); transition: .2s var(--ease); pointer-events: none;
}
.tile:hover .tile-cap { opacity: 1; transform: none; }
.tile-cap b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.tile-cap small { font-size: 11.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-badge { position: absolute; left: 10px; bottom: 10px; z-index: 1; font: 700 9.5px/1 var(--mono); letter-spacing: .06em; padding: 4px 6px; border-radius: 6px; color: #fff; background: rgba(20,20,24,.55); backdrop-filter: blur(8px); transition: opacity .2s; }
.tile:hover .tile-badge { opacity: 0; }
.tile-pdf .tile-badge { display: none; }

.tile.is-sel { border-radius: 18px; transform: scale(.92); box-shadow: 0 0 0 3px var(--brand); }
.tile.is-sel .tile-check { opacity: 1; transform: none; background: var(--brand); border-color: #fff; color: #fff; }
.tile.is-active { box-shadow: 0 0 0 3px var(--brand), 0 12px 30px -10px var(--brand-glow); }
.tile.is-new::after { content: "New"; position: absolute; right: 10px; bottom: 10px; z-index: 1; font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 20px; background: var(--ok); color: #fff; }

/* uploading ghost tile */
.tile.ghost { cursor: default; }
.ghost-bg { position: absolute; inset: 0; background-size: cover; background-position: center; filter: blur(6px) brightness(.6); transform: scale(1.1); }
.ghost-ui { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 8px; color: #fff; z-index: 1; }
.ghost-ui small { font-size: 11.5px; opacity: .85; max-width: 90%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px; }
.gring { position: relative; width: 52px; height: 52px; }
.gring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.gring circle { fill: none; stroke-width: 4; }
.gring .track { stroke: rgba(255,255,255,.2); }
.gring .bar { stroke: #fff; stroke-linecap: round; stroke-dasharray: 138.2; stroke-dashoffset: 138.2; transition: stroke-dashoffset .2s; }
.gring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.ghost.no-prev .ghost-bg { background: linear-gradient(135deg, var(--brand), var(--brand-2)); filter: none; opacity: .6; }
.ghost.ghost-err .ghost-bg { background: var(--danger); filter: none; opacity: .5; }

/* ----- list view */
.list { border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.lrow { display: grid; grid-template-columns: 36px minmax(0, 1fr) 80px 90px 120px 110px 116px; align-items: center; gap: 12px; padding: 8px 14px; border-top: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.lrow:first-child { border-top: 0; }
.lrow:hover { background: var(--hover); }
.lrow.is-sel { background: var(--brand-soft); }
.lrow.is-active { box-shadow: inset 3px 0 0 var(--brand); background: var(--hover); }
.lhead { cursor: default; font-size: 12px; font-weight: 600; color: var(--text-3); padding-top: 11px; padding-bottom: 11px; background: var(--surface-2); }
.lhead:hover { background: var(--surface-2); }
.lhead button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.lhead button:hover, .lhead button.on { color: var(--text); }
.lcheck { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line-2); background: none; display: grid; place-items: center; padding: 0; color: transparent; }
.lcheck .i { width: 13px; height: 13px; stroke-width: 3; }
.is-sel .lcheck { background: var(--brand); border-color: var(--brand); color: #fff; }
.lname { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lthumb { width: 44px; height: 44px; border-radius: 10px; flex: none; overflow: hidden; background: var(--tile-bg); display: grid; place-items: center; }
.lthumb img { width: 100%; height: 100%; object-fit: cover; }
.lthumb.pdf { background: var(--pdf-soft); color: var(--pdf); }
.lname b { display: block; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lname small { display: block; color: var(--text-3); font-size: 12px; }
.lname > div { min-width: 0; }
.lcell { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.lacts { display: flex; gap: 2px; justify-content: flex-end; opacity: .0; transition: opacity .15s; }
.lrow:hover .lacts, .lrow.is-active .lacts { opacity: 1; }
.lacts .icon-btn { width: 34px; height: 34px; }
.type-pill { display: inline-flex; font: 700 10px/1 var(--mono); padding: 5px 7px; border-radius: 6px; letter-spacing: .04em; }
.type-pill.pdf { background: var(--pdf-soft); color: var(--pdf); } .type-pill.img { background: var(--img-soft); color: var(--img); }

/* ----- empty state (also a big drop target) */
.empty {
  display: grid; justify-items: center; text-align: center; padding: 70px 24px; border-radius: 26px; border: 2px dashed var(--line-2);
  background: radial-gradient(60% 80% at 50% 0%, var(--brand-soft), transparent 70%); cursor: pointer; transition: .2s;
}
.empty:hover { border-color: var(--brand); }
.empty-art { position: relative; width: 150px; height: 110px; margin-bottom: 22px; }
.empty-art span { position: absolute; width: 76px; height: 96px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; }
.empty-art span:nth-child(1) { left: 0; top: 12px; transform: rotate(-12deg); color: var(--pdf); }
.empty-art span:nth-child(2) { right: 0; top: 12px; transform: rotate(12deg); color: var(--img); }
.empty-art span:nth-child(3) { left: 37px; top: 0; background: var(--grad); color: #fff; box-shadow: 0 16px 36px -12px var(--brand-glow); }
.empty-art .i { width: 28px; height: 28px; }
.empty b { font: 700 20px var(--display); letter-spacing: -.02em; }
.empty p { margin: 6px 0 20px; color: var(--text-2); max-width: 380px; }
.empty.search-empty { border: 0; background: none; cursor: default; }

/* =================================================================== DRAWER */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; width: var(--drawer-w); display: flex; flex-direction: column;
  background: var(--bg-elev); border-left: 1px solid var(--line); animation: drawerIn .3s var(--ease);
}
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; gap: 4px; height: var(--top-h); padding: 0 12px 0 20px; flex: none; }
.drawer-head h4 { margin: 0; flex: 1; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.drawer-body { flex: 1; overflow-y: auto; padding: 0 20px 24px; display: flex; flex-direction: column; gap: 18px; }
.dpreview {
  position: relative; border-radius: 16px; overflow: hidden; background: var(--tile-bg); display: grid; place-items: center; min-height: 180px; max-height: 300px; cursor: zoom-in;
  background-image: linear-gradient(45deg, var(--line) 25%, transparent 25%, transparent 75%, var(--line) 75%), linear-gradient(45deg, var(--line) 25%, transparent 25%, transparent 75%, var(--line) 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px;
}
.dpreview img { max-width: 100%; max-height: 300px; object-fit: contain; }
.dpreview .cover { position: relative; width: 62%; aspect-ratio: .74; inset: auto; border-radius: 10px; margin: 22px 0; box-shadow: var(--shadow); }
.dpreview img.page { max-height: 260px; margin: 20px 0; border-radius: 6px; box-shadow: var(--shadow); background: #fff; }
.dpreview .expand {
  position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 9px;
  background: rgba(20,20,24,.6); color: #fff; font-size: 12px; font-weight: 600; backdrop-filter: blur(8px); opacity: 0; transition: .2s;
}
.dpreview:hover .expand { opacity: 1; }
.dpreview .expand .i { width: 14px; height: 14px; }
.dname-row { display: flex; align-items: flex-start; gap: 6px; }
.dname { flex: 1; margin: 0; font: 700 19px/1.3 var(--display); letter-spacing: -.02em; word-break: break-word; cursor: text; border-radius: 8px; padding: 2px 4px; margin-left: -4px; }
.dname:hover { background: var(--hover); }
.dname-input { flex: 1; font: 700 17px var(--display); padding: 6px 10px; border-radius: 10px; border: 1px solid var(--brand); background: var(--surface); outline: 0; box-shadow: 0 0 0 4px var(--brand-soft); min-width: 0; }
.dsub { margin: -12px 0 0; color: var(--text-3); font-size: 13px; }
.dbox { padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.dbox-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.share-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); margin-bottom: 10px; }
.share-tabs button { flex: 1; height: 28px; border: 0; border-radius: 8px; background: none; font-size: 12px; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.share-tabs button:hover { color: var(--text); }
.share-tabs button.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.share-field { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.share-field code { flex: 1; min-width: 0; padding: 0; border: 0; background: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); font-size: 12px; }
.share-field .btn { flex: none; }
.share-field .btn.done { background: var(--ok); }
.qr-row { display: flex; gap: 14px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.qr-mini { width: 84px; height: 84px; padding: 6px; border-radius: 10px; background: #fff; flex: none; }
.qr-mini svg { width: 100%; height: 100%; display: block; }
.qr-row b { display: block; font-size: 13px; }
.qr-row small { display: block; color: var(--text-3); font-size: 12px; margin: 2px 0 6px; }
.qr-row .link-btn { color: var(--brand-text); font-weight: 600; padding: 0; }
.info { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; font-size: 13px; }
.info dt { color: var(--text-3); }
.info dd { margin: 0; text-align: right; word-break: break-all; }
.info dd.mono { font: 12px var(--mono); }
.drawer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); flex: none; }
.drawer-actions .btn-danger { grid-column: 1 / -1; }

/* =================================================================== LIGHTBOX */
.lightbox { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; background: rgba(6, 7, 9, .97); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); color: #fff; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.lb-bar { display: flex; align-items: center; gap: 8px; height: 64px; padding: 0 12px 0 22px; flex: none; }
.lb-title { flex: 1; min-width: 0; }
.lb-title b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-title small { color: rgba(255,255,255,.55); font-size: 12px; }
.lightbox .icon-btn { color: rgba(255,255,255,.75); }
.lightbox .icon-btn:hover { color: #fff; background: rgba(255,255,255,.1); }
.lb-stage { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 72px 24px; overflow: hidden; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; animation: zoomIn .3s var(--ease); cursor: zoom-in; transition: transform .25s var(--ease); }
.lb-stage img.zoomed { transform: scale(2); cursor: zoom-out; }
@keyframes zoomIn { from { opacity: 0; transform: scale(.97); } }
.lb-stage iframe { width: min(1000px, 100%); height: 100%; border: 0; border-radius: 10px; background: #fff; }
.lb-nav { position: absolute; top: 50%; translate: 0 -50%; z-index: 2; width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center; color: #fff; background: rgba(255,255,255,.08); transition: .15s; }
.lb-nav:hover { background: rgba(255,255,255,.18); }
.lb-nav:disabled { opacity: 0; pointer-events: none; }
.lb-prev { left: 14px; } .lb-next { right: 14px; }
.lb-count { position: absolute; left: 50%; bottom: 14px; translate: -50% 0; font-size: 12px; color: rgba(255,255,255,.6); font-variant-numeric: tabular-nums; }

/* =================================================================== MENUS, PALETTE, ISLAND, TOASTS, MODAL */
.ctx {
  position: fixed; z-index: 80; min-width: 220px; padding: 6px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg);
  animation: pop .14s var(--ease); transform-origin: top left;
}
@keyframes pop { from { opacity: 0; transform: scale(.95); } }
.ctx button { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: 9px; background: none; font-size: 13.5px; text-align: left; }
.ctx button:hover, .ctx button:focus-visible { background: var(--hover); outline: 0; }
.ctx button .i { width: 16px; height: 16px; color: var(--text-3); }
.ctx button kbd { margin-left: auto; }
.ctx hr { border: 0; height: 1px; background: var(--line); margin: 5px 4px; }
.ctx .danger { color: var(--danger); } .ctx .danger .i { color: var(--danger); }

dialog { color: var(--text); padding: 0; border: 0; }
dialog::backdrop { background: rgba(6, 7, 10, .55); backdrop-filter: blur(4px); }
.palette { width: min(620px, calc(100vw - 24px)); margin-top: 12vh; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; }
.palette[open] { animation: pop .18s var(--ease); }
.pal-in { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 18px; border-bottom: 1px solid var(--line); }
.pal-in .i { color: var(--text-3); width: 20px; height: 20px; }
.pal-in input { flex: 1; border: 0; outline: 0; background: none; font-size: 16px; }
.pal-list { max-height: 380px; overflow-y: auto; padding: 8px; }
.pal-group { padding: 8px 10px 4px; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.pal-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: none; text-align: left; }
.pal-item.on { background: var(--brand-soft); }
.pal-item .pi { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; overflow: hidden; }
.pal-item .pi img { width: 100%; height: 100%; object-fit: cover; }
.pal-item .pi.pdf { background: var(--pdf-soft); color: var(--pdf); }
.pal-item.on .pi { color: var(--brand-text); }
.pal-item div { flex: 1; min-width: 0; }
.pal-item b { display: block; font-weight: 550; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item small { color: var(--text-3); font-size: 12px; }
.pal-item kbd { flex: none; }
.pal-empty { padding: 30px; text-align: center; color: var(--text-3); }
.palette footer { display: flex; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }
.palette footer span { display: inline-flex; gap: 6px; align-items: center; }

.island { position: fixed; left: 50%; bottom: 22px; translate: -50% 0; z-index: 60; width: min(420px, calc(100vw - 24px)); display: flex; flex-direction: column-reverse; gap: 8px; }
.island-pill {
  display: flex; align-items: center; gap: 12px; width: 100%; height: 56px; padding: 0 16px 0 10px; border: 0; border-radius: 30px; text-align: left;
  background: #121318; color: #fff; box-shadow: 0 20px 50px -14px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.08); animation: islandIn .4s var(--spring);
}
:root[data-theme="light"] .island-pill { background: #15171d; }
@keyframes islandIn { from { transform: translateY(30px) scale(.9); opacity: 0; } }
.island-pill > div { flex: 1; min-width: 0; }
.island-pill b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.island-pill small { display: block; font-size: 12px; color: rgba(255,255,255,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.island-pill .chev { color: rgba(255,255,255,.6); transition: transform .2s; }
.island.open .chev { transform: rotate(180deg); }
.iring { position: relative; width: 38px; height: 38px; flex: none; }
.iring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.iring circle { fill: none; stroke-width: 4; }
.iring .track { stroke: rgba(255,255,255,.14); }
.iring .bar { stroke: url(#gradRing); stroke-linecap: round; stroke-dasharray: 100.5; stroke-dashoffset: 100.5; transition: stroke-dashoffset .25s; }
.iring .i { position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; }
.island.done .iring .bar { stroke: var(--ok); }
.island.err .iring .bar { stroke: var(--danger); }
.island-act { flex: none; height: 32px; padding: 0 12px; border-radius: 20px; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 12.5px; font-weight: 600; }
.island-act:hover { background: rgba(255,255,255,.2); }
.island-panel { max-height: 50vh; overflow-y: auto; padding: 6px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-lg); animation: pop .18s var(--ease); }
.island-panel ul { list-style: none; margin: 0; padding: 0; }
.q { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; }
.q:hover { background: var(--hover); }
.q-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--img-soft); color: var(--img); overflow: hidden; }
.q-ic.pdf { background: var(--pdf-soft); color: var(--pdf); }
.q-ic img { width: 100%; height: 100%; object-fit: cover; }
.q-ic .i { width: 16px; height: 16px; }
.q-b { min-width: 0; display: grid; gap: 4px; }
.q-n { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-s { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-s.err { color: var(--danger); } .q-s.ok { color: var(--ok); }
.q-bar { height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.q-bar span { display: block; height: 100%; width: 0; background: var(--grad); transition: width .15s; }
.q .icon-btn { width: 32px; height: 32px; }

.toasts { position: fixed; left: 50%; bottom: 90px; translate: -50% 0; z-index: 90; display: grid; justify-items: center; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; min-height: 46px; border-radius: 14px; background: #15171d; color: #fff;
  box-shadow: 0 16px 40px -14px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.08); font-size: 13.5px; pointer-events: auto; animation: toastIn .35s var(--spring); max-width: 100%;
}
.toast > span { flex: 1; padding-right: 4px; }
.toast .i { flex: none; }
.toast.ok > .i { color: var(--ok); } .toast.err > .i { color: #ff8a8a; } .toast.info > .i { color: #b4a9ff; }
.toast button { flex: none; height: 30px; padding: 0 12px; border-radius: 9px; border: 0; background: rgba(255,255,255,.12); color: #fff; font-weight: 650; font-size: 13px; }
.toast button:hover { background: rgba(255,255,255,.22); }
.toast.out { opacity: 0; transform: translateY(8px); transition: .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.95); } }

.modal { width: min(440px, calc(100vw - 32px)); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-lg); }
.modal[open] { animation: pop .2s var(--ease); }
.modal-body { margin: 0; padding: 24px; display: grid; gap: 14px; }
.modal h3 { margin: 0; font: 700 19px var(--display); letter-spacing: -.02em; }
#mText { color: var(--text-2); display: grid; gap: 12px; }
#mText p { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px dashed var(--line-2); }
.codes code { font: 600 14px var(--mono); color: var(--text); text-align: center; letter-spacing: .06em; border: 0; background: none; }

.dragveil { position: fixed; inset: 0; z-index: 85; display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .2s; background: color-mix(in srgb, var(--bg) 65%, transparent); backdrop-filter: blur(10px); }
.dragveil.on { opacity: 1; }
.dragveil > div {
  display: grid; justify-items: center; gap: 8px; padding: 60px 90px; border-radius: 32px; border: 2px dashed var(--brand);
  background: color-mix(in srgb, var(--surface) 85%, transparent); box-shadow: 0 30px 80px -30px var(--brand-glow); transform: scale(.94); transition: transform .3s var(--spring);
}
.dragveil.on > div { transform: none; }
.dv-ic { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; background: var(--grad); color: #fff; margin-bottom: 10px; animation: bob 1s ease-in-out infinite; }
.dv-ic .i { width: 32px; height: 32px; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.dragveil b { font: 700 24px var(--display); letter-spacing: -.03em; }
.dragveil span { color: var(--text-2); }

/* =================================================================== SECURITY */
.sec-hero { display: flex; align-items: center; gap: 26px; padding: 24px 28px; margin-bottom: 16px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); position: relative; overflow: hidden; }
.sec-hero::before { content: ""; position: absolute; width: 320px; height: 320px; left: -100px; top: -160px; border-radius: 50%; background: var(--brand); opacity: .12; filter: blur(60px); }
.sec-hero h2 { margin: 0 0 12px; font: 700 22px var(--display); letter-spacing: -.03em; }
.score { position: relative; width: 116px; height: 116px; flex: none; display: grid; place-items: center; align-content: center; }
.score svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.score circle { fill: none; stroke-width: 9; }
.score .track { stroke: var(--surface-3); }
.score .bar { stroke-linecap: round; stroke-dasharray: 327; stroke-dashoffset: 327; transition: stroke-dashoffset 1.1s var(--ease), stroke .3s; }
.score b { font: 700 34px/1 var(--display); letter-spacing: -.05em; }
.score small { color: var(--text-3); font-size: 11px; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.checks li { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 20px; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; font-weight: 550; }
.checks li::before { content: "!"; font-weight: 800; font-size: 11px; }
.checks li.on { background: var(--ok-soft); color: var(--ok); }
.checks li.on::before { content: "✓"; }
.sec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { padding: 22px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 18px; }
.card-wide { grid-column: 1 / -1; }
.card header { display: flex; gap: 14px; align-items: flex-start; }
.card header > div { flex: 1; }
.card h3 { margin: 0 0 3px; font: 650 16px var(--display); letter-spacing: -.01em; }
.card header p { margin: 0; color: var(--text-2); font-size: 13px; }
.card-ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-text); flex: none; }
.card .info dd { text-align: left; }
.card > .btn { align-self: flex-start; }
.twofa-state { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface-2); }
.twofa-state b { display: block; font-size: 14px; }
.twofa-state small { color: var(--text-2); }
.twofa-state .pill { margin-left: auto; }
.pill { font-size: 11.5px; font-weight: 700; padding: 5px 10px; border-radius: 20px; background: var(--danger-soft); color: var(--danger); white-space: nowrap; }
.pill.on { background: var(--ok-soft); color: var(--ok); }
.qr-wrap { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.qr { width: 164px; height: 164px; padding: 10px; border-radius: 16px; background: #fff; }
.qr svg { width: 100%; height: 100%; display: block; }
.secret { font: 600 12.5px var(--mono); word-break: break-all; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line-2); letter-spacing: .06em; }
.steps { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 13px; display: grid; gap: 4px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.log { display: grid; max-height: 460px; overflow: auto; margin: 0 -8px; }
.log-day { position: sticky; top: 0; padding: 8px 8px 6px; font-size: 12px; font-weight: 600; color: var(--text-3); background: var(--surface); z-index: 1; }
.ev { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 8px; border-radius: 12px; }
.ev:hover { background: var(--hover); }
.ev-ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.ev-ic .i { width: 15px; height: 15px; }
.ev.good .ev-ic { color: var(--ok); background: var(--ok-soft); }
.ev.bad .ev-ic { color: var(--danger); background: var(--danger-soft); }
.ev.warn .ev-ic { color: var(--warn); background: var(--warn-soft); }
.ev b { font-size: 13.5px; font-weight: 600; }
.ev small { display: block; color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev time { font-size: 12px; color: var(--text-3); white-space: nowrap; }

/* =================================================================== MOBILE TAB BAR */
.tabbar { display: none; }

/* =================================================================== RESPONSIVE */
@media (max-width: 1360px) { :root { --drawer-w: 360px; } }
@media (max-width: 1024px) {
  .shell.has-drawer { padding-right: 0; }
  .drawer { box-shadow: var(--shadow-lg); }
}
@media (max-width: 1100px) {
  :root { --side-w: 228px; }
  .content, .topbar { padding-left: 24px; padding-right: 24px; }
  .sizer { display: none; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .brand-mobile { display: flex; }
  .brand-mobile .mark { width: 32px; height: 32px; }
  .topbar { padding: 0 16px; gap: 10px; }
  .search { height: 42px; }
  .search kbd { display: none; }
  .content { padding: 0 16px 120px; }
  .page-head { margin: 12px 0 16px; }
  .page-head h1 { font-size: 26px; }
  .col-chips { display: flex; }
  .drop-hint { display: none; }
  .sec-h { top: var(--top-h); }
  .gallery { gap: 4px; }
  .tile { border-radius: 10px; }
  .tile-quick, .tile-cap { display: none; }
  .tile-check { opacity: 0; }
  .selecting .tile-check { opacity: 1; }
  .lrow { grid-template-columns: 32px minmax(0, 1fr) 76px; }
  .lrow > :nth-child(4), .lrow > :nth-child(5), .lrow > :nth-child(6), .lrow > :nth-child(7) { display: none; }
  .sec-grid { grid-template-columns: 1fr; }
  .drawer {
    top: auto; left: 0; width: auto; max-height: 90vh; border-left: 0; border-radius: 24px 24px 0 0; animation: sheetIn .35s var(--ease);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .drawer::before { content: ""; position: absolute; top: 8px; left: 50%; translate: -50% 0; width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); }
  @keyframes sheetIn { from { transform: translateY(60px); opacity: 0; } }
  .drawer-head { height: 56px; }
  .tabbar {
    position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 35; display: flex; align-items: center; justify-content: space-around;
    height: 64px; padding: 0 8px; border-radius: 22px; background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4); box-shadow: var(--shadow-lg);
  }
  .tabbar button { display: grid; justify-items: center; gap: 2px; border: 0; background: none; color: var(--text-3); font-size: 11px; font-weight: 600; width: 72px; }
  .tabbar button.is-active { color: var(--brand-text); }
  .tabbar .fab { width: 52px; height: 52px; border-radius: 18px; place-items: center; background: var(--grad); color: #fff; box-shadow: 0 10px 24px -8px var(--brand-glow); margin-top: -26px; }
  .tabbar .fab .i { width: 24px; height: 24px; }
  .tabbar form { margin: 0; }
  .island { bottom: 92px; }
  .toasts { bottom: 160px; }
  .selbar { padding: 0 10px; gap: 4px; }
  .selbar .btn span { display: none; }
  .selbar .btn { padding: 0 10px; }
  .lb-stage { padding: 0 0 16px; }
  .lb-nav { display: none; }
  .sec-hero { flex-direction: column; align-items: flex-start; padding: 20px; }
}
@media (max-width: 560px) {
  .tools { width: 100%; }
  .sorter { flex: 1; }
  .qr-wrap { grid-template-columns: 1fr; justify-items: start; }
  .auth-card { padding: 28px 22px 22px; }
  .mosaic { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* =================================================================== SETUP */
.setup-body { min-height: 100vh; }
.setup { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: 24px 16px 60px; }
.setup-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 44px; }
.ver { font: 600 11px var(--mono); color: var(--text-3); margin-left: 4px; }
.setup-intro { margin-bottom: 26px; }
.setup-intro h1, .setup-done h1 { font: 700 clamp(28px, 4.4vw, 40px)/1.08 var(--display); letter-spacing: -.04em; margin: 0 0 10px; }
.setup-intro .sub, .setup-done .sub { color: var(--text-2); font-size: 15px; margin: 0; }
.setup-card { padding: 26px; margin-bottom: 16px; border-radius: 24px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(20px); box-shadow: var(--shadow); }
.setup-card.form { gap: 18px; }
.setup-card .sec-h { position: static; background: none; display: flex; align-items: center; gap: 12px; margin: 10px 0 0; padding: 0; font: 650 16px var(--display); letter-spacing: -.02em; }
.setup-card .sec-h:first-of-type { margin-top: 0; }
.setup-card > .sec-h:first-child { margin-bottom: 18px; }
.setup-card .sec-h span { font: 700 11px var(--mono); color: #fff; background: var(--grad); padding: 4px 7px; border-radius: 7px; }
.reqs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.reqs li { display: flex; gap: 11px; align-items: flex-start; padding: 11px 13px; border-radius: 14px; background: var(--surface-2); border: 1px solid transparent; }
.reqs i { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; }
.reqs b { display: block; font-size: 13px; }
.reqs small { color: var(--text-2); font-size: 12px; }
.req-ok i { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.req-warn i { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.req-fail { border-color: var(--danger) !important; }
.req-fail i { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.setup-card .alert { margin: 16px 0 0; }
.setup-card.form > .alert:first-of-type { margin: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hint { font-style: normal; font-weight: 500; color: var(--text-3); font-size: 11.5px; }
.hint-p { margin: -6px 0 0; font-size: 12.5px; color: var(--text-2); }
.hint-p.warn { color: var(--warn); }
.plain-select { flex: 1; height: 100%; border: 0; outline: 0; background: transparent; appearance: none; cursor: pointer; }
.plain-select option { background: var(--surface); }
.types { display: flex; flex-wrap: wrap; gap: 8px; }
.type input { position: absolute; opacity: 0; pointer-events: none; }
.type span { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--line-2); font: 700 12px var(--mono); letter-spacing: .04em; color: var(--text-2); cursor: pointer; transition: .15s; background: var(--surface-2); }
.type span::before { content: ""; width: 14px; height: 14px; border-radius: 5px; border: 1.5px solid var(--text-3); transition: .15s; }
.type.t-pdf input:checked + span { color: var(--pdf); border-color: var(--pdf); background: var(--pdf-soft); }
.type.t-img input:checked + span { color: var(--img); border-color: var(--img); background: var(--img-soft); }
.type input:checked + span::before { background: currentColor; border-color: currentColor; }
.type input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.toggles { display: grid; gap: 8px; }
.tgl { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); cursor: pointer; }
.tgl input { position: absolute; opacity: 0; pointer-events: none; }
.tgl i { position: relative; width: 42px; height: 25px; border-radius: 25px; background: var(--surface-3); flex: none; transition: .2s; box-shadow: inset 0 0 0 1px var(--line); }
.tgl i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: .25s var(--spring); }
.tgl input:checked + i { background: var(--grad); }
.tgl input:checked + i::after { translate: 17px; }
.tgl input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 2px; }
.tgl b { display: block; font-size: 13.5px; }
.tgl small { color: var(--text-2); font-size: 12px; }
.setup-done { text-align: center; display: grid; justify-items: center; gap: 4px; padding: 44px 32px; }
.setup-done .alert { text-align: left; margin: 20px 0 4px; width: 100%; }
.setup-done .small { font-size: 13px; margin-top: 10px; }
.done-ic { width: 66px; height: 66px; border-radius: 22px; display: grid; place-items: center; background: var(--grad); color: #fff; margin-bottom: 18px; box-shadow: 0 16px 40px -14px var(--brand-glow); }
.done-ic .i { width: 32px; height: 32px; stroke-width: 2.4; }
.done-ic.lock { background: var(--surface-2); color: var(--brand-text); box-shadow: none; }
.next { text-align: left; margin: 14px 0 24px; padding-left: 20px; color: var(--text-2); display: grid; gap: 6px; width: 100%; }
.next b { color: var(--text); }
.mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.mode-tabs a {
  display: grid; gap: 3px; padding: 16px 18px; border-radius: 18px; text-decoration: none; border: 1.5px solid var(--line-2);
  background: color-mix(in srgb, var(--surface) 80%, transparent); backdrop-filter: blur(16px); transition: .15s;
}
.mode-tabs a:hover { border-color: var(--text-3); }
.mode-tabs a.is-active { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 4px var(--brand-soft); }
.mode-tabs b { font: 650 15px var(--display); }
.mode-tabs small { color: var(--text-2); font-size: 12.5px; }
.keybox { display: grid; gap: 10px; padding: 16px 18px; border-radius: 16px; background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.keybox > b { font-size: 14px; }
.keybox p { margin: 0; font-size: 13px; color: var(--text-2); }
.keybox ol { margin: 0; padding-left: 20px; font-size: 13px; color: var(--text-2); display: grid; gap: 3px; }
.keybox .input-wrap { background: var(--surface); }
.keybox .input-wrap input { font: 600 16px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.tgl-danger input:checked + i { background: var(--danger); }
@media (max-width: 640px) { .mode-tabs { grid-template-columns: 1fr; } }
.tgl-danger b { color: var(--danger); }
.setup-foot { text-align: center; color: var(--text-3); font-size: 12px; margin-top: 24px; }
@media (max-width: 640px) {
  .reqs, .cols { grid-template-columns: 1fr; }
  .setup-card { padding: 20px; }
}
