/* Flowtrix Drive — neutral surfaces, one accent (Flowtrix green). Night mode is the default palette. */
/* Neutral black / white surfaces. Green only for brand accents, from the Flowtrix 2026 style guide:
   solid green #0fd375, gradient #0fd375 → #a9f187, minty #17ea81, text green #108e52. */
:root {
  --bg-rail: #0a0a0a;
  --bg-panel: #0a0a0a;
  --bg-main: #0a0a0a;
  --elev: #141414;
  --hover: #171717;
  --active: #222222;
  --line: #1f1f1f;
  --line-2: #2c2c2c;
  --text: #f2f2f2;
  --muted: #9a9a9a;
  --faint: #636363;
  --accent: #0fd375;
  --accent-grad: linear-gradient(135deg, #0fd375 0%, #a9f187 100%);
  --accent-hover: #17ea81;
  --on-accent: #0a0a0a;
  --accent-text: #17ea81;
  --accent-soft: rgba(15, 211, 117, 0.13);
  --folder-back: #0aa862;
  --folder-front: #0fd375;
  --danger: #f26b6b;
  --danger-soft: rgba(242, 107, 107, 0.12);
  --warn: #f2b84b;
  --scrim: rgba(0, 0, 0, 0.6);
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg-rail: #f5f5f5;
  --bg-panel: #fafafa;
  --bg-main: #ffffff;
  --elev: #ffffff;
  --hover: #f3f3f3;
  --active: #ebebeb;
  --line: #ebebeb;
  --line-2: #dcdcdc;
  --text: #111111;
  --muted: #666666;
  --faint: #a3a3a3;
  --accent-text: #108e52;
  --accent-soft: rgba(15, 211, 117, 0.13);
  --folder-back: #0bb86b;
  --folder-front: #0fd375;
  --danger: #d93a3a;
  --danger-soft: rgba(217, 58, 58, 0.08);
  --warn: #a86a00;
  --scrim: rgba(0, 0, 0, 0.28);
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body, #root { margin: 0; height: 100%; }
body { background: var(--bg-main); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
::selection { background: rgba(15, 211, 117, 0.3); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
svg.i { width: 18px; height: 18px; flex: none; display: block; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(0.985); } }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2);
  font-weight: 500; white-space: nowrap; transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg.i { width: 16px; height: 16px; }
.btn.primary { background: var(--accent-grad); border-color: transparent; color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-grad); filter: brightness(1.06); }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn.solid-danger { background: var(--danger); border-color: transparent; color: #fff; font-weight: 600; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.icon { width: 36px; padding: 0; }
.btn.sm.icon { width: 30px; }
.btn.block { width: 100%; }

.input, .select {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--bg-main); outline: none; transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select {
  appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 16px, calc(100% - 13px) 16px; background-size: 5px 5px; background-repeat: no-repeat;
}
.field { display: grid; gap: 6px; }
.label { font-size: 12px; font-weight: 500; color: var(--muted); }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.error-text { color: var(--danger); font-size: 13px; margin: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stack { display: grid; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--active); color: var(--muted); white-space: nowrap; }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badge.warn { background: rgba(242, 184, 75, 0.16); color: var(--warn); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.range { width: 100%; accent-color: var(--accent); }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: 64px auto minmax(0, 1fr); grid-template-rows: 56px minmax(0, 1fr); height: 100%; }

.rail { grid-row: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0 14px; background: var(--bg-rail); border-right: 1px solid var(--line); }
.logo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 12px; flex: none; color: var(--accent); transition: background 0.12s; }
.logo:hover { background: var(--hover); }
.logo .logo-icon { width: 28px; height: auto; }
.rail-btn { position: relative; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); transition: background 0.12s, color 0.12s; }
.rail-btn:hover { background: var(--hover); color: var(--text); }
.rail-btn.active { background: var(--accent-soft); color: var(--accent-text); }
.rail-btn .dot { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.rail-sep { width: 26px; height: 1px; background: var(--line-2); margin: 8px 0; }
.rail-bottom { margin-top: auto; display: grid; gap: 8px; justify-items: center; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-grad); color: var(--on-accent); font-weight: 700; font-size: 14px; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }

.topbar { grid-column: 2 / -1; display: flex; align-items: center; gap: 12px; padding: 0 20px 0 14px; border-bottom: 1px solid var(--line); background: var(--bg-main); min-width: 0; }
.topbar .divider { width: 1px; height: 18px; background: var(--line-2); }
.topbar h1 { margin: 0; font-size: 15px; font-weight: 500; }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.panel { width: 272px; overflow: auto; padding: 12px 10px 16px; background: var(--bg-panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.panel.hidden { display: none; }
.panel-label { display: flex; align-items: center; justify-content: space-between; padding: 8px 6px 6px 10px; font-size: 12.5px; color: var(--muted); }
.tree-item { display: flex; align-items: center; gap: 10px; height: 38px; padding-right: 6px; border-radius: 10px; cursor: pointer; font-size: 14px; user-select: none; }
.tree-item:hover { background: var(--hover); }
.tree-item.active { background: var(--active); }
.tree-item svg.i { color: var(--muted); }
.tree-item .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-item .chev { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: var(--faint); }
.tree-item .chev:hover { background: var(--active); color: var(--text); }
.tree-item .chev svg.i { width: 16px; height: 16px; transition: transform 0.15s; }
.tree-item .chev.open svg.i { transform: rotate(90deg); }
.panel-foot { margin-top: auto; padding: 18px 10px 0; display: grid; gap: 8px; }
.meter { height: 6px; border-radius: 999px; background: var(--active); overflow: hidden; }
.meter > div { height: 100%; border-radius: inherit; background: var(--accent); min-width: 3px; }
.foot-row { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); }
.foot-row b { color: var(--text); font-weight: 500; }

.main { overflow: auto; position: relative; background: var(--bg-main); }
.page { padding: 28px 36px 20px; max-width: 1360px; min-height: 100%; display: flex; flex-direction: column; }
.page > * { flex: none; }

/* ---------- page header & toolbar ---------- */
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: -6px 0 6px; }
.crumbs button { padding: 2px 6px; border-radius: 6px; color: var(--muted); }
.crumbs button:hover { background: var(--hover); color: var(--text); }
.crumbs svg.i { width: 14px; height: 14px; color: var(--faint); }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; min-height: 42px; }
.page-title { margin: 0; font-size: 26px; font-weight: 600; letter-spacing: -0.015em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.btn-new { height: 40px; padding: 0 14px 0 16px; border-radius: 11px; font-size: 15px; }
.btn-new svg.i { width: 18px; height: 18px; }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px; white-space: nowrap; transition: background 0.12s, border-color 0.12s; }
.pill:hover { background: var(--hover); }
.pill svg.i { width: 17px; height: 17px; }
.pill .chev { width: 15px; height: 15px; color: var(--muted); }
.pill.icon-only { width: 38px; padding: 0; justify-content: center; }
.pill.on { border-color: var(--accent); }
.search-pill { padding: 0 4px 0 12px; }
.search-pill input { border: 0; outline: none; background: transparent; width: 240px; height: 100%; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line-2); border-radius: 999px; }
.seg button { height: 30px; min-width: 34px; padding: 0 10px; border-radius: 999px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 500; }
.seg button svg.i { width: 16px; height: 16px; }
.seg button.on { background: var(--active); color: var(--text); }
.seg button:hover:not(.on) { color: var(--text); }

/* ---------- list ---------- */
.list { display: grid; gap: 2px; }
.row-item {
  display: grid; grid-template-columns: minmax(0, 1fr) 96px 120px 190px 76px; align-items: center; gap: 16px;
  height: 58px; padding: 0 8px 0 12px; border-radius: 12px; cursor: pointer; transition: background 0.1s;
}
.row-item:hover, .row-item.menu-open { background: var(--hover); }
.row-item .name { display: flex; align-items: center; gap: 14px; min-width: 0; font-size: 14.5px; }
.row-item .meta { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .num { text-align: right; font-variant-numeric: tabular-nums; }
.row-item .acts { display: flex; justify-content: flex-end; gap: 2px; opacity: 0; transition: opacity 0.1s; }
.row-item:hover .acts, .row-item:focus-within .acts, .row-item.menu-open .acts { opacity: 1; }
.title-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.saved-tag { font-size: 11.5px; font-weight: 600; color: var(--accent-text); background: var(--accent-soft); padding: 1px 7px; border-radius: 999px; flex: none; }

.folder-glyph { width: 40px; height: 40px; flex: none; display: block; }
.folder-glyph.sm { width: 22px; height: 22px; }
.thumb { width: 40px; height: 40px; border-radius: 9px; overflow: hidden; flex: none; position: relative; display: grid; place-items: center; background: var(--active); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.svg img { object-fit: contain; padding: 5px; background: #fff; }
.thumb .play { position: absolute; right: 3px; bottom: 3px; width: 16px; height: 16px; border-radius: 50%; background: rgba(0, 0, 0, 0.72); color: #fff; display: grid; place-items: center; }
.thumb .play svg.i { width: 8px; height: 8px; fill: currentColor; margin-left: 1px; }
.thumb.tile svg.i { width: 19px; height: 19px; }
.tile-video { background: rgba(139, 92, 246, 0.15); color: #a78bfa; }
.tile-image { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.tile-document { background: rgba(239, 68, 68, 0.14); color: #f87171; }
.tile-archive { background: rgba(245, 158, 11, 0.16); color: #f5a524; }
.tile-font { background: rgba(148, 163, 184, 0.18); color: #94a3b8; }
.tile-audio { background: rgba(236, 72, 153, 0.14); color: #f472b6; }
.tile-data { background: rgba(20, 184, 166, 0.15); color: #2dd4bf; }
:root[data-theme='light'] .tile-video { color: #7c3aed; }
:root[data-theme='light'] .tile-image { color: #0284c7; }
:root[data-theme='light'] .tile-document { color: #dc2626; }
:root[data-theme='light'] .tile-archive { color: #b45309; }
:root[data-theme='light'] .tile-font { color: #475569; }
:root[data-theme='light'] .tile-audio { color: #db2777; }
:root[data-theme='light'] .tile-data { color: #0f766e; }

/* ---------- grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px 18px; }
.card { display: flex; flex-direction: column; gap: 10px; cursor: pointer; min-width: 0; }
.card-media { position: relative; aspect-ratio: 4 / 3; border-radius: 14px; overflow: hidden; background: var(--hover); display: grid; place-items: center; border: 1px solid var(--line); transition: border-color 0.12s; }
.card:hover .card-media, .card.menu-open .card-media { border-color: var(--line-2); }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-media.svg img { object-fit: contain; padding: 18px; background: #fff; }
.card-media .thumb { width: 64px; height: 64px; border-radius: 16px; }
.card-media .thumb svg.i { width: 30px; height: 30px; }
.card-media .folder-glyph { width: 72px; height: 72px; }
.card-media .tag { position: absolute; top: 8px; right: 8px; padding: 2px 8px; border-radius: 7px; background: rgba(0, 0, 0, 0.62); color: #fff; font-size: 11.5px; font-weight: 500; }
.card-media .dur { position: absolute; left: 8px; bottom: 8px; padding: 2px 7px; border-radius: 7px; background: rgba(0, 0, 0, 0.62); color: #fff; font: 500 11.5px/1.5 var(--mono); }
.card-body { display: flex; align-items: flex-start; gap: 6px; padding: 0 2px; }
.card-body b { display: block; font-weight: 500; font-size: 14px; }
.card-body small { color: var(--muted); font-size: 12.5px; }
.card .acts { opacity: 0; transition: opacity 0.1s; }
.card:hover .acts, .card.menu-open .acts, .card:focus-within .acts { opacity: 1; }

/* ---------- pager ---------- */
.pager { display: flex; align-items: center; gap: 14px; margin-top: auto; position: sticky; bottom: 16px; z-index: 5; padding: 8px 10px; border-radius: 14px; background: var(--hover); box-shadow: 0 0 0 16px var(--bg-main); }
.page-fill { flex: 1 0 18px; }
.pager .select { width: auto; height: 36px; background-color: var(--bg-main); border-color: var(--line); }
.pager .count { color: var(--muted); font-size: 13.5px; }
.pager .page-num { min-width: 34px; height: 34px; padding: 0 8px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-grad); color: var(--on-accent); font-weight: 600; }

/* ---------- empty ---------- */
.empty { padding: 72px 24px; display: grid; justify-items: center; gap: 10px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line-2); border-radius: 18px; }
.empty .folder-glyph { width: 64px; height: 64px; margin-bottom: 4px; }
.empty .big { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.empty .big svg.i { width: 26px; height: 26px; }
.empty h3 { margin: 0; color: var(--text); font-size: 16px; font-weight: 600; }
.empty p { margin: 0; max-width: 440px; }
.empty .row { justify-content: center; margin-top: 8px; }

.drop-overlay { position: absolute; inset: 12px; z-index: 20; display: grid; place-items: center; border: 2px dashed var(--accent); border-radius: 18px; background: color-mix(in srgb, var(--bg-main) 88%, transparent); pointer-events: none; }
.drop-overlay div { display: grid; justify-items: center; gap: 10px; font-size: 17px; font-weight: 600; }
.drop-overlay svg.i { width: 36px; height: 36px; color: var(--accent-text); }

/* ---------- menus ---------- */
.menu { position: relative; display: inline-flex; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 210px; padding: 6px; background: var(--elev); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); display: grid; animation: pop 0.1s ease-out; }
.menu-pop.left { left: 0; right: auto; }
.menu-pop.up { top: auto; bottom: calc(100% + 6px); }
.menu-pop.side { left: calc(100% + 10px); right: auto; top: auto; bottom: 0; }
.menu-pop button, .menu-pop a { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 8px; text-align: left; font-size: 13.5px; white-space: nowrap; }
.menu-pop button:hover, .menu-pop a:hover { background: var(--hover); }
.menu-pop svg.i { width: 16px; height: 16px; color: var(--muted); }
.menu-pop .danger { color: var(--danger); }
.menu-pop .danger svg.i { color: var(--danger); }
.menu-pop .tick { margin-left: auto; color: var(--accent-text); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.menu-pop .menu-title { padding: 6px 10px; font-size: 12.5px; color: var(--muted); }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: var(--scrim); display: grid; place-items: center; padding: 24px 16px; animation: fade 0.12s ease-out; }
.modal { width: 100%; max-width: 440px; max-height: calc(100vh - 48px); overflow: auto; background: var(--elev); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow); animation: pop 0.14s ease-out; }
.modal.wide { max-width: 1040px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 0; }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; flex: 1; min-width: 0; }
.modal-body { padding: 16px 20px; display: grid; gap: 14px; }
.modal-body p { margin: 0; color: var(--muted); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 18px; }

/* ---------- details drawer ---------- */
.drawer-scrim { position: fixed; inset: 0; z-index: 45; background: var(--scrim); animation: fade 0.12s ease-out; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 46; width: min(540px, 100vw); display: flex; flex-direction: column; background: var(--elev); border-left: 1px solid var(--line-2); box-shadow: var(--shadow); animation: slide 0.16s ease-out; }
.drawer-head { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 12px 0 18px; border-bottom: 1px solid var(--line); flex: none; }
.drawer-head .thumb { width: 32px; height: 32px; border-radius: 8px; }
.drawer-head .thumb svg.i { width: 16px; height: 16px; }
.name-input { flex: 1; min-width: 0; height: 36px; padding: 0 8px; margin-left: -8px; border: 1px solid transparent; border-radius: 8px; background: transparent; font-size: 15px; font-weight: 600; outline: none; }
.name-input:hover { border-color: var(--line-2); }
.name-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.drawer-body { flex: 1; overflow: auto; padding: 18px; display: flex; flex-direction: column; gap: 18px; }
.drawer-body > * { flex: none; }
.preview { aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #050505; display: grid; place-items: center; border: 1px solid var(--line); }
.preview video, .preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.preview.checker { background: repeating-conic-gradient(var(--hover) 0 25%, var(--active) 0 50%) 0 0 / 18px 18px; }
.preview.file { background: var(--hover); }
.preview .tile-big { display: grid; justify-items: center; gap: 14px; }
.preview .tile-big .thumb { width: 64px; height: 64px; border-radius: 16px; }
.preview .tile-big .thumb svg.i { width: 30px; height: 30px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { height: 40px; padding: 0 10px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500; font-size: 13.5px; display: inline-flex; align-items: center; gap: 7px; }
.tabs button svg.i { width: 16px; height: 16px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.link-row { display: flex; align-items: center; gap: 10px; padding: 5px 5px 5px 12px; border-radius: 10px; border: 1px solid var(--line); min-width: 0; }
.link-row .lbl { width: 60px; flex: none; font-size: 12.5px; color: var(--muted); }
.link-row code { flex: 1; min-width: 0; font: 12px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code { position: relative; }
.code pre { margin: 0; padding: 12px 48px 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-main); font: 12px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 220px; overflow: auto; }
.code .btn { position: absolute; top: 8px; right: 8px; background: var(--elev); }
.subtabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--hover); }
.subtabs button { height: 28px; padding: 0 12px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--muted); }
.subtabs button.on { background: var(--elev); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; margin: 0; font-size: 13.5px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.callout { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--hover); font-size: 13.5px; }
.callout b { display: block; font-weight: 600; }
.callout span { color: var(--muted); }
.callout.good > svg.i { color: var(--accent-text); }
.callout.tip > svg.i { color: var(--warn); }
.callout .btn { margin-left: auto; }
.options { display: grid; gap: 8px; }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2); text-align: left; transition: border-color 0.12s, background 0.12s; }
.option:hover { background: var(--hover); }
.option.on { border-color: var(--accent); background: var(--accent-soft); }
.option .radio { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--faint); margin-top: 2px; flex: none; display: grid; place-items: center; }
.option.on .radio { border-color: var(--accent); }
.option.on .radio::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.option b { display: block; font-weight: 500; }
.option small { color: var(--muted); font-size: 12.5px; }
.estimate { display: grid; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); }
.estimate .est-row { display: flex; justify-content: space-between; gap: 12px; font-weight: 500; }
.estimate .est-row b { color: var(--accent-text); }
.estimate small { color: var(--muted); font-size: 12.5px; }
.estimate.neutral { background: var(--hover); }
.estimate.neutral .est-row b { color: var(--text); }
.progress { display: grid; gap: 8px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); }
.progress .row { justify-content: space-between; font-size: 13.5px; }
.bar { height: 5px; border-radius: 999px; background: var(--active); overflow: hidden; }
.bar > div { height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.2s; }

/* ---------- compare ---------- */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compare figure { margin: 0; display: grid; gap: 8px; }
.compare video, .compare img { width: 100%; border-radius: 10px; background: #000; display: block; }
.compare figcaption { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.compare figcaption b { color: var(--text); }

/* ---------- jobs panel ---------- */
.jobs { position: fixed; right: 20px; bottom: 20px; z-index: 40; width: 380px; max-width: calc(100vw - 32px); background: var(--elev); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; animation: pop 0.14s ease-out; }
.jobs-head { display: flex; align-items: center; gap: 4px; height: 50px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.jobs-head span { flex: 1; }
.jobs-body { max-height: 340px; overflow: auto; }
.job { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 12px 14px 12px 16px; border-top: 1px solid var(--line); }
.job:first-child { border-top: 0; }
.job-main { display: grid; gap: 5px; min-width: 0; }
.job-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.job-top b { flex: 1; min-width: 0; font-weight: 500; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-top svg.i { width: 16px; height: 16px; }
.job small { color: var(--muted); font-size: 12.5px; }
.ok { color: var(--accent-text); }
.err { color: var(--danger); }
.job-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.saved { color: var(--accent-text); }

/* ---------- other pages ---------- */
.lines { display: grid; gap: 2px; }
.line { display: flex; align-items: center; gap: 14px; min-height: 58px; padding: 8px 8px 8px 12px; border-radius: 12px; }
.line:hover { background: var(--hover); }
.line b { font-weight: 500; }
.line small { color: var(--muted); font-size: 12.5px; }
.notice { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--hover); color: var(--muted); font-size: 13.5px; margin-bottom: 18px; }
.notice svg.i { color: var(--accent-text); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.stat { padding: 20px; border-radius: 16px; border: 1px solid var(--line); display: grid; gap: 14px; align-content: start; }
.stat .top { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13.5px; }
.stat .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.stat .big { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; }
.stat small { color: var(--muted); font-size: 13px; }
.kind-row { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; font-size: 13.5px; }
.kind-row .thumb { width: 28px; height: 28px; border-radius: 7px; }
.kind-row .thumb svg.i { width: 15px; height: 15px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 70; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg-main); font-weight: 500; font-size: 13.5px; box-shadow: var(--shadow); animation: pop 0.15s ease-out; max-width: calc(100vw - 32px); }
.toast svg.i { width: 16px; height: 16px; }
.toast.error { background: var(--danger); color: #fff; }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); }
.brand .logo-icon { width: 30px; height: auto; color: var(--accent); }
.brand .logo-text { width: 86px; height: auto; }
.brand-product { padding: 3px 8px; border-radius: 7px; background: var(--active); color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }

/* ---------- sign in ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); min-height: 100%; background: var(--bg-main); }
.auth-side { display: flex; flex-direction: column; padding: 28px 48px 28px; min-height: 100vh; }
.auth-top { display: flex; align-items: center; gap: 12px; }
.auth-form { width: 100%; max-width: 380px; margin: auto; display: grid; gap: 18px; padding: 40px 0; }
.auth-head h1 { margin: 0 0 8px; font-size: 32px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.15; }
.auth-head p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; }
.auth-form .field { gap: 8px; }
.auth-form .label { font-size: 13px; color: var(--text); }
.input-icon { position: relative; display: block; }
.input-icon > svg.i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--faint); pointer-events: none; }
.input-icon .input { height: 46px; padding-left: 42px; border-radius: 12px; font-size: 15px; background: var(--bg-main); }
.input-icon .input::placeholder { color: var(--faint); }
.input-icon .reveal { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); }
.input-icon .reveal:hover { background: var(--hover); color: var(--text); }
.input-icon:has(.reveal) .input { padding-right: 46px; }
.auth-error { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 13.5px; }
.auth-error svg.i { width: 16px; height: 16px; }
.auth-submit { height: 48px; border-radius: 12px; font-size: 15px; margin-top: 4px; }
.auth-submit svg.i { width: 18px; height: 18px; }
.auth-foot { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.auth-foot svg.i { width: 16px; height: 16px; color: var(--accent-text); }

/* Brand panel: always dark, whatever the theme. */
.auth-visual {
  position: relative; overflow: hidden; margin: 12px; border-radius: 24px; color: #eef5f1;
  background: #0a0a0a; display: flex; flex-direction: column; justify-content: space-between; padding: 56px 56px 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.auth-visual::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 30% 20%, #000 20%, transparent 75%);
}
.auth-glow { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(560px 340px at 12% 0%, rgba(15, 211, 117, 0.18), transparent 70%), radial-gradient(480px 380px at 100% 100%, rgba(169, 241, 135, 0.07), transparent 70%); }
.auth-copy { position: relative; max-width: 520px; }
.auth-eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 10px; border-radius: 999px; background: rgba(15, 211, 117, 0.12); border: 1px solid rgba(15, 211, 117, 0.25); color: #17ea81; font-size: 13px; font-weight: 500; }
.auth-eyebrow .logo-icon { width: 18px; height: auto; color: #0fd375; }
.auth-copy h2 { margin: 22px 0 22px; font-size: clamp(28px, 2.6vw, 40px); line-height: 1.12; font-weight: 600; letter-spacing: -0.03em; color: #fff; }
.auth-copy ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.auth-copy li { display: flex; align-items: center; gap: 12px; color: rgba(238, 245, 241, 0.78); font-size: 15px; }
.auth-copy li svg.i { width: 18px; height: 18px; padding: 7px; box-sizing: content-box; border-radius: 10px; background: rgba(255, 255, 255, 0.06); color: #17ea81; }

.auth-mock { position: relative; margin-top: 48px; padding-bottom: 0; }
.mock-window { position: relative; border-radius: 18px 18px 0 0; border: 1px solid rgba(255, 255, 255, 0.1); border-bottom: 0; background: rgba(20, 20, 20, 0.88); backdrop-filter: blur(8px); padding: 8px 8px 14px; box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.35); }
.mock-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px 12px; }
.mock-bar i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); }
.mock-bar span { margin-left: 10px; font-size: 13px; font-weight: 600; color: #fff; }
.mock-row { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 12px; border-radius: 12px; font-size: 14px; color: #eef5f1; }
.mock-row:nth-child(4) { background: rgba(255, 255, 255, 0.05); }
.mock-row .folder-glyph { width: 32px; height: 32px; --folder-back: #0aa862; --folder-front: #0fd375; }
.mock-row b { font-weight: 500; flex: 1; min-width: 0; }
.mock-row span { color: rgba(238, 245, 241, 0.5); font-size: 13px; }
.mock-row em { font-style: normal; font-size: 11.5px; font-weight: 600; color: #17ea81; background: rgba(15, 211, 117, 0.14); padding: 1px 7px; border-radius: 999px; }
.mock-row .thumb { width: 32px; height: 32px; border-radius: 8px; }
.mock-row .thumb svg.i { width: 16px; height: 16px; }
.mock-thumb { width: 32px; height: 32px; border-radius: 8px; flex: none; display: grid; place-items: center; background: linear-gradient(135deg, #0fd375 0%, #0b6b44 55%, #1e1b4b 100%); color: #fff; }
.mock-thumb svg.i { width: 12px; height: 12px; fill: currentColor; }
.mock-toast { position: absolute; right: 24px; top: -30px; display: flex; align-items: center; gap: 12px; padding: 12px 16px 12px 12px; border-radius: 14px; background: #fff; color: #111; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35); animation: float 6s ease-in-out infinite; }
.mock-toast svg.i { width: 22px; height: 22px; color: #108e52; }
.mock-toast b { display: block; font-size: 13.5px; font-weight: 600; }
.mock-toast span { font-size: 12.5px; color: #5b6b66; }
@keyframes float { 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .mock-toast { animation: none; } }

@media (max-width: 960px) {
  .auth { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-side { padding: 20px 20px 24px; }
}

.loading { height: 100%; display: grid; place-items: center; color: var(--muted); }

/* ---------- small screens ---------- */
@media (max-width: 1080px) {
  .row-item { grid-template-columns: minmax(0, 1fr) 90px 170px 76px; }
  .row-item .col-type { display: none; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 56px minmax(0, 1fr); }
  .rail-btn { width: 40px; height: 40px; }
  .topbar { grid-column: 2; padding: 0 12px 0 8px; }
  .panel { position: fixed; top: 56px; left: 56px; bottom: 0; z-index: 35; box-shadow: var(--shadow); }
  .page { padding: 20px 16px 16px; }
  .page-title { font-size: 22px; }
  .row-item { grid-template-columns: minmax(0, 1fr) auto 40px; height: 60px; }
  .row-item .col-date { display: none; }
  .row-item .acts { opacity: 1; }
  .row-item .acts .copy { display: none; }
  .search-pill input { width: 130px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px 12px; }
  .compare { grid-template-columns: 1fr; }
  .pager .count { display: none; }
}

/* explicit grid placement so pages without the folder panel still fill the width */
.panel { grid-column: 2; grid-row: 2; }
.main { grid-column: 3; grid-row: 2; }
@media (max-width: 820px) {
  .main { grid-column: 2; }
}

/* grid view: compact folder tiles above the file cards */
.folder-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 26px; }
.folder-tile { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px 8px 10px 12px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; transition: background 0.12s, border-color 0.12s; }
.folder-tile:hover, .folder-tile.menu-open { background: var(--hover); border-color: var(--line-2); }
.folder-tile .folder-glyph { width: 34px; height: 34px; }
.folder-tile b { display: block; font-weight: 500; }
.folder-tile small { color: var(--muted); font-size: 12.5px; }
.folder-tile .acts { opacity: 0; transition: opacity 0.1s; }
.folder-tile:hover .acts, .folder-tile.menu-open .acts, .folder-tile:focus-within .acts { opacity: 1; }
.warn-text { color: var(--warn) !important; }
.options.compact { gap: 6px; }
.options.compact .option { padding: 10px 12px; }
.option b .badge { margin-left: 6px; height: 19px; vertical-align: 1px; }
