/* WORKBIZ DRIVE — web client styles. Plain CSS, no framework, no build step beyond hashing. */

:root {
  /* [DAN] tokens (lib/dan: dan-brand.css values) -- ink + DAN red, neutral grounds. */
  --bg: #f5f5f3;
  --surface: #ffffff;
  --surface-2: #f1f1ef;
  --surface-3: #e7e7e4;
  --border: rgba(0, 0, 0, .09);
  --border-strong: rgba(0, 0, 0, .18);
  --text: #16161a;
  --text-2: #44444a;
  --muted: #6b6b72;
  --accent: #f25b4f;            /* --dan-red: brackets, caret, focus, the signature accent */
  --accent-hover: #e04a3e;
  --accent-soft: rgba(242, 91, 79, .10);
  --accent-ink: #ffffff;
  --ink-btn: #16161a;           /* DAN primary button = ink, not red */
  --ink-btn-text: #ffffff;
  --select: rgba(242, 91, 79, .09);
  --select-ink: #c8392e;
  --ok: #1f9d63;
  --ok-dot: #38c47f;
  --warn: #b7791f;
  --amber: #eaa63c;
  --danger: #d23b30;
  --dot-off: rgba(0, 0, 0, .10);
  --shadow-1: 0 1px 2px rgba(22, 22, 26, .05), 0 1px 3px rgba(22, 22, 26, .06);
  --shadow-2: 0 6px 18px rgba(22, 22, 26, .08), 0 2px 4px rgba(22, 22, 26, .05);
  --shadow-3: 0 24px 60px rgba(22, 22, 26, .16), 0 6px 16px rgba(22, 22, 26, .08);
  --radius: 10px;
  --radius-lg: 16px;
  --header-h: 64px;
  --sidebar-w: 280px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Text", "Segoe UI", Roboto, Ubuntu, "Noto Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --dot: "Doto", "JetBrains Mono", ui-monospace, monospace;

  --ft-folder: #6b6b72;
  --ft-pdf: #e0493e;
  --ft-sheet: #1f9d63;
  --ft-doc: #3b6fd8;
  --ft-slide: #e08a1e;
  --ft-image: #8e5bd0;
  --ft-video: #d8406f;
  --ft-audio: #13968a;
  --ft-archive: #a8761c;
  --ft-code: #55606e;
  --ft-file: #8a8a92;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1b1f;
    --surface: #232329;
    --surface-2: #2a2a31;
    --surface-3: #33333b;
    --border: rgba(255, 255, 255, .09);
    --border-strong: rgba(255, 255, 255, .18);
    --text: #f5f5f7;
    --text-2: #c4c4cc;
    --muted: #9a9aa3;
    --accent-soft: rgba(242, 91, 79, .16);
    --ink-btn: #f5f5f7;
    --ink-btn-text: #0e0e11;
    --select: rgba(242, 91, 79, .14);
    --select-ink: #ff8a80;
    --ok: #4cc27d;
    --danger: #ff7b70;
    --dot-off: rgba(255, 255, 255, .10);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 6px 18px rgba(0, 0, 0, .45);
    --shadow-3: 0 24px 60px rgba(0, 0, 0, .6);
    --ft-folder: #9a9aa3;
    --ft-file: #9a9aa3;
    --ft-code: #8f9aa8;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 16px; height: 16px; }
.icon.lg { width: 28px; height: 28px; }
:focus-visible { outline: 2px solid var(--select-ink); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--ink-btn); border-color: var(--ink-btn); color: var(--ink-btn-text); }
.btn.primary:hover:not(:disabled) { opacity: .88; }
.btn.red { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.red:hover:not(:disabled) { background: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: transparent; color: var(--text-2); flex: none;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.active { background: var(--select); color: var(--select-ink); }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); min-width: 0; }
.brand-mark { display: inline-grid; place-items: center; flex: none; color: var(--text); }
.wordmark { font-family: var(--dot); font-weight: 900; font-size: 19px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; line-height: 1; }
.wordmark b { color: var(--accent); font-weight: 900; margin: 0 .04em; }
[data-dot] .dan-idp { transition: background .3s; }

/* ---------- sign-in ---------- */
.login { position: relative; min-height: 100%; display: grid; place-items: center; padding: 32px 16px; background: var(--bg); overflow: hidden; }
#dotfield { position: absolute; inset: 0; width: 100%; height: 100%; }
.login-shell {
  position: relative; display: grid; grid-template-columns: 1.05fr 1fr; width: 100%; max-width: 900px;
  border-radius: 22px; overflow: hidden; box-shadow: var(--shadow-3); border: 1px solid var(--border);
}
.login-hero {
  background: #16161a; color: #f5f5f7; padding: 44px 40px; display: flex; flex-direction: column; justify-content: center; gap: 26px;
  background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1.2px); background-size: 14px 14px;
}
.hero-dot { color: #f5f5f7; }
.hero-title { font-family: var(--dot); font-weight: 900; font-size: 46px; line-height: 1.02; letter-spacing: .05em; }
.hero-title b { color: var(--accent); font-weight: 900; }
.hero-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; color: #c4c4cc; font-size: 14px; }
.hero-points li { display: flex; align-items: center; gap: 14px; }
.hero-points li > span { color: #f5f5f7; flex: none; }
.login-card { background: var(--surface); padding: 44px 40px 32px; }
.login-card .brand { margin-bottom: 30px; }
.login-card h1 { font-size: 24px; font-weight: 650; margin: 0 0 6px; letter-spacing: -.01em; }
.login-card .sub { margin: 0 0 26px; color: var(--muted); }
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; letter-spacing: .02em; }
.field .hint { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); font-weight: 400; }
.input, select.input, textarea.input {
  width: 100%; height: 44px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 120px; padding: 10px 13px; font: 13px/1.6 var(--mono); resize: vertical; }
select.input { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 46px; }
.pw-wrap .icon-btn { position: absolute; right: 4px; top: 4px; }
.login-card .btn.primary { width: 100%; height: 46px; margin-top: 10px; font-size: 15px; border-radius: 10px; }
.form-error {
  display: flex; gap: 8px; align-items: flex-start; margin: 4px 0 12px; padding: 10px 12px; border-radius: 10px;
  background: var(--accent-soft); color: var(--danger); font-size: 13px;
}
.login-foot { margin-top: 24px; color: var(--muted); font: 11px var(--mono); letter-spacing: .04em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.check { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }

/* ---------- app shell ---------- */
.app { height: 100%; display: grid; grid-template-rows: var(--header-h) 1fr; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); position: relative; z-index: 20;
}
.topbar .brand { width: calc(var(--sidebar-w) - 28px); }
.admin-btn { height: 38px; border-radius: 19px; }
.admin-btn.on { background: var(--ink-btn); color: var(--ink-btn-text); border-color: var(--ink-btn); }
.admin-btn.on .r { stroke: var(--accent); }
#menuBtn { display: none; }
.search { flex: 1; max-width: 720px; position: relative; }
.search-box {
  display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 8px 0 14px; border-radius: 24px;
  background: var(--surface-2); border: 1px solid transparent; transition: background .12s, box-shadow .12s;
}
.search-box:focus-within { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow-2); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; height: 100%; font-size: 15px; }
.search-box .icon { color: var(--muted); }
.search-results {
  position: absolute; left: 0; right: 0; top: 52px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-3); max-height: 60vh; overflow: auto; padding: 6px;
}
.search-results .sr-head { padding: 8px 10px 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sr-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; background: transparent; border-radius: 8px; text-align: left; }
.sr-item:hover, .sr-item.hl { background: var(--surface-2); }
.sr-item .t { min-width: 0; }
.sr-item .n { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-item .p { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-empty { padding: 14px 12px; color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 14px; text-transform: uppercase;
}

.body { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 0; }
.sidebar {
  display: flex; flex-direction: column; min-height: 0; padding: 14px 10px 10px 12px;
  background: var(--bg);
}
.new-btn {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 12px; height: 54px; padding: 0 22px 0 18px;
  border-radius: 16px; border: 0; background: var(--surface); box-shadow: var(--shadow-2); font-weight: 600; font-size: 15px;
  margin: 0 0 16px 2px; transition: box-shadow .15s, background .15s;
}
.new-btn:hover { box-shadow: var(--shadow-3); background: var(--surface-2); }
.new-btn:disabled { opacity: .55; cursor: not-allowed; box-shadow: var(--shadow-1); }
.new-btn .icon { width: 22px; height: 22px; color: var(--accent); stroke-width: 2.2; }
.side-label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 4px 12px 6px; }
.companies { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.company {
  display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 12px; border: 0; border-radius: 20px;
  background: transparent; text-align: left; font-weight: 500; color: var(--text-2);
}
.company:hover { background: var(--surface-3); }
.company.active { background: var(--select); color: var(--select-ink); font-weight: 600; }
.company .dot { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; flex: none; }
.company .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree { flex: 1; overflow: auto; min-height: 0; padding-bottom: 12px; margin-right: -4px; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tnode {
  display: flex; align-items: center; gap: 4px; height: 32px; padding-right: 10px; border-radius: 16px;
  color: var(--text-2); cursor: pointer; user-select: none; white-space: nowrap;
}
.tnode:hover { background: var(--surface-3); }
.tnode.active { background: var(--select); color: var(--select-ink); font-weight: 600; }
.tnode.locked { color: var(--muted); }
.tnode .tw { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; border: 0; background: transparent; color: var(--muted); flex: none; padding: 0; }
.tnode .tw:hover { background: var(--border); }
.tnode .tw .icon { width: 14px; height: 14px; transition: transform .15s; }
.tnode .tw.open .icon { transform: rotate(90deg); }
.tnode .tw.none { visibility: hidden; }
.tnode .ti { width: 18px; height: 18px; color: var(--ft-folder); }
.tnode.active .ti { color: var(--select-ink); }
.tnode .tl { overflow: hidden; text-overflow: ellipsis; margin-left: 6px; }
.tnode .lk { width: 13px; height: 13px; margin-left: auto; color: var(--muted); }
.side-foot { padding: 10px 12px 2px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--border); }

/* ---------- main pane ---------- */
.main {
  display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface);
  border-radius: var(--radius-lg) 0 0 0; margin-top: 8px; position: relative; box-shadow: var(--shadow-1);
}
.toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 16px 10px 20px; min-height: 64px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; overflow: hidden; }
.crumb {
  border: 0; background: transparent; padding: 6px 10px; border-radius: 18px; font-size: 20px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px;
}
.crumb:hover { background: var(--surface-2); }
.crumb.cur { color: var(--text); font-weight: 500; }
.crumbs .sep { color: var(--muted); flex: none; }
.crumbs .ell { color: var(--muted); padding: 0 4px; font-size: 18px; }
.tool-actions { display: flex; align-items: center; gap: 6px; }
.view-toggle { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 18px; overflow: hidden; margin-left: 4px; }
.view-toggle button { border: 0; background: transparent; height: 34px; width: 44px; display: grid; place-items: center; color: var(--text-2); }
.view-toggle button + button { border-left: 1px solid var(--border-strong); }
.view-toggle button.on { background: var(--select); color: var(--select-ink); }

.notice {
  display: flex; align-items: center; gap: 10px; margin: 0 20px 10px; padding: 10px 14px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-2); font-size: 13px;
}
.notice .icon { color: var(--muted); }

.content { flex: 1; overflow: auto; min-height: 0; padding: 0 12px 24px 20px; position: relative; }

/* list view */
.list { width: 100%; border-collapse: collapse; table-layout: fixed; }
.list thead th {
  position: sticky; top: 0; z-index: 1; background: var(--surface); text-align: left; font-weight: 500; font-size: 13px;
  color: var(--text-2); height: 44px; border-bottom: 1px solid var(--border); padding: 0 8px; white-space: nowrap;
}
.list thead th button { border: 0; background: transparent; padding: 4px 6px; margin-left: -6px; border-radius: 6px; display: inline-flex; align-items: center; gap: 4px; font-weight: 500; color: inherit; }
.list thead th button:hover { background: var(--surface-2); }
.list thead th button .icon { width: 14px; height: 14px; }
.list .c-name { width: auto; }
.list .c-mod { width: 190px; }
.list .c-size { width: 110px; }
.list .c-act { width: 104px; }
.list tbody tr { height: 50px; border-bottom: 1px solid var(--border); cursor: pointer; }
.list tbody tr:hover { background: var(--surface-2); }
.list tbody tr.sel { background: var(--select); }
.list tbody tr.dim { cursor: default; }
.list tbody tr.dim .nm { color: var(--muted); }
.list td { padding: 0 8px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list td.c-name { color: var(--text); }
.namecell { display: flex; align-items: center; gap: 14px; min-width: 0; }
.namecell .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.namecell .meta-m { display: none; font-size: 12px; color: var(--muted); }
/* Row actions are always visible (not hover-only): touch screens have no hover, and clients
   must be able to see Download without discovering it. */
.rowacts { display: flex; gap: 2px; justify-content: flex-end; }

.ficon { width: 24px; height: 24px; flex: none; }

/* grid view */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; padding-top: 6px; }
.grid-sec { grid-column: 1 / -1; font-size: 13px; font-weight: 500; color: var(--text-2); padding: 10px 2px 0; }
.card {
  position: relative; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); overflow: hidden;
  cursor: pointer; transition: box-shadow .12s, border-color .12s;
}
.card:hover { box-shadow: var(--shadow-2); border-color: var(--border-strong); }
.card.sel { border-color: var(--select-ink); box-shadow: 0 0 0 1px var(--select-ink); }
.card .thumb { height: 120px; display: grid; place-items: center; background: var(--surface); margin: 0 8px; border-radius: 8px; }
.card .thumb .ficon { width: 56px; height: 56px; }
.card .cap { display: flex; align-items: center; gap: 10px; padding: 12px 8px 12px 12px; min-width: 0; }
.card .cap .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.card .cap .ficon { width: 20px; height: 20px; }
.card.folder .thumb { display: none; }
.card.folder { background: var(--surface-2); }
.card .sub { padding: 0 12px 12px 42px; margin-top: -8px; font-size: 12px; color: var(--muted); }

/* empty / loading / error states */
.state { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 64px 20px; color: var(--text-2); }
.state .art { width: 120px; height: 120px; margin-bottom: 18px; }
.state h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; color: var(--text); }
.state p { margin: 0 0 18px; max-width: 420px; color: var(--muted); }
.spinner {
  width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton-row { height: 50px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--border); padding: 0 8px; }
.skeleton-row i { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* drop overlay */
.drop {
  position: absolute; inset: 8px; z-index: 30; border-radius: 14px; border: 2px dashed var(--select-ink);
  background: color-mix(in srgb, var(--select) 85%, transparent); display: grid; place-items: center; pointer-events: none;
}
.drop.no { border-color: var(--danger); background: color-mix(in srgb, var(--accent-soft) 90%, transparent); }
.drop-inner { text-align: center; color: var(--select-ink); }
.drop.no .drop-inner { color: var(--danger); }
.drop-inner .icon { width: 48px; height: 48px; margin-bottom: 8px; }
.drop-inner strong { display: block; font-size: 18px; }

/* ---------- menus ---------- */
.menu {
  position: fixed; z-index: 60; min-width: 220px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow-3); padding: 6px 0;
}
.menu button {
  display: flex; align-items: center; gap: 14px; width: 100%; height: 38px; padding: 0 16px; border: 0; background: transparent;
  text-align: left; color: var(--text);
}
.menu button:hover:not(:disabled) { background: var(--surface-2); }
.menu button:disabled { color: var(--muted); cursor: not-allowed; }
.menu button .icon { color: var(--text-2); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.menu .mh { padding: 8px 16px 6px; }
.menu .mh b { display: block; }
.menu .mh small { color: var(--muted); }

/* ---------- dialogs ---------- */
.scrim { position: fixed; inset: 0; z-index: 70; background: rgba(15, 18, 24, .45); display: grid; place-items: center; padding: 16px; animation: fade .12s; }
@keyframes fade { from { opacity: 0; } }
.dialog { width: 100%; max-width: 420px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-3); padding: 22px 24px 18px; }
.dialog h3 { margin: 0 0 14px; font-size: 18px; font-weight: 600; }
.dialog p { margin: 0 0 14px; color: var(--text-2); }
.dialog .err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 6px; }
.dialog .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* ---------- viewer ---------- */
.viewer { position: fixed; inset: 0; z-index: 80; background: rgba(12, 14, 18, .92); display: grid; grid-template-rows: 60px 1fr; color: #eef0f3; animation: fade .12s; }
.viewer .vbar { display: flex; align-items: center; gap: 12px; padding: 0 12px 0 16px; background: rgba(0, 0, 0, .35); }
.viewer .vbar .ficon { width: 22px; height: 22px; }
.viewer .vt { flex: 1; min-width: 0; }
.viewer .vt b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer .vt small { color: #a9afb9; }
.viewer .icon-btn { color: #e3e6ea; }
.viewer .icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.viewer .vbtn { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); color: #fff; }
.viewer .vbtn:hover { background: rgba(255, 255, 255, .18); }
.vstage { position: relative; min-height: 0; display: grid; place-items: center; padding: 16px 72px; overflow: auto; }
.vstage img { max-width: 100%; max-height: calc(100vh - 100px); object-fit: contain; border-radius: 4px; box-shadow: 0 8px 40px rgba(0, 0, 0, .5); background: #fff; }
.vstage video, .vstage audio { max-width: 100%; max-height: calc(100vh - 100px); }
.vstage iframe { width: min(1100px, 100%); height: calc(100vh - 92px); border: 0; border-radius: 6px; background: #fff; }
.vdoc {
  width: min(900px, 100%); height: calc(100vh - 92px); overflow: auto; background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 28px 32px; box-shadow: 0 8px 40px rgba(0, 0, 0, .5);
}
.vdoc pre { margin: 0; font: 13px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; }
.vdoc .docx { white-space: pre-wrap; font-size: 15px; line-height: 1.7; }
.vdoc table { border-collapse: collapse; font-size: 13px; }
.vdoc td, .vdoc th { border: 1px solid var(--border); padding: 5px 9px; white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.vdoc tr:first-child td { background: var(--surface-2); font-weight: 600; }
.vdoc .rn { background: var(--surface-2); color: var(--muted); text-align: right; font-size: 11px; }
.vdoc .trunc { margin-top: 12px; color: var(--muted); font-size: 12px; }
.vnav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; }
.vnav:hover { background: rgba(255, 255, 255, .22); }
.vnav.prev { left: 14px; }
.vnav.next { right: 14px; }
.vnav .icon { width: 26px; height: 26px; }
.vinfo { text-align: center; max-width: 420px; }
.vinfo .ficon { width: 88px; height: 88px; margin-bottom: 16px; }
.vinfo h3 { margin: 0 0 6px; font-weight: 500; word-break: break-word; }
.vinfo p { color: #a9afb9; margin: 0 0 20px; }
.vloading { display: flex; flex-direction: column; align-items: center; gap: 14px; color: #a9afb9; }
.vloading .spinner { border-color: rgba(255, 255, 255, .15); border-top-color: #fff; }

/* ---------- transfers tray ---------- */
.tray {
  position: fixed; right: 20px; bottom: 20px; z-index: 50; width: 380px; max-width: calc(100vw - 32px);
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-3); border: 1px solid var(--border); overflow: hidden;
}
.tray-head { display: flex; align-items: center; gap: 6px; padding: 10px 8px 10px 16px; background: var(--surface-2); }
.tray-head b { flex: 1; font-weight: 600; }
.tray-head .icon-btn { width: 32px; height: 32px; }
.tray.min .tray-list { display: none; }
.tray.min .tray-head .chev .icon { transform: rotate(180deg); }
.tray-list { max-height: 300px; overflow: auto; }
.titem { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-top: 1px solid var(--border); }
.titem .ti-t { flex: 1; min-width: 0; }
.titem .ti-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.titem .ti-s { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.titem.fail .ti-s { color: var(--danger); }
.titem.done .ti-s { color: var(--ok); }
.titem .bar { height: 3px; border-radius: 2px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.titem .bar i { display: block; height: 100%; width: 0; background: var(--select-ink); transition: width .15s; }
.titem.scan .bar i { width: 100% !important; background: linear-gradient(90deg, var(--surface-3), var(--select-ink), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1s linear infinite; }
.titem .st { width: 24px; height: 24px; display: grid; place-items: center; flex: none; }
.titem.done .st { color: var(--ok); }
.titem.fail .st { color: var(--danger); }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; min-width: 260px; max-width: min(560px, calc(100vw - 32px));
  padding: 12px 16px; border-radius: 10px; background: #23262d; color: #f1f3f5; box-shadow: var(--shadow-3); animation: rise .18s ease-out;
}
.toast.err { background: #5b1a17; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .list .c-mod { width: 150px; }
  .topbar .brand { width: auto; }
}
@media (max-width: 760px) {
  :root { --header-h: 58px; }
  #menuBtn { display: inline-grid; }
  .topbar { gap: 6px; padding: 0 8px; }
  .topbar .wordmark { display: none; }
  .admin-btn .lbl { display: none; }
  .admin-btn { width: 38px; padding: 0; }
  .login-shell { grid-template-columns: 1fr; max-width: 440px; }
  .login-hero { display: none; }
  .login-card { padding: 34px 24px 26px; }
  .search-box { height: 42px; }
  .body { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: var(--header-h); bottom: 0; left: 0; width: min(86vw, 320px); z-index: 40;
    background: var(--surface); box-shadow: none; transform: translateX(-105%); visibility: hidden;
    transition: transform .2s ease, visibility 0s linear .2s;
  }
  .app.nav-open .sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-3); transition: transform .2s ease; }
  .app.nav-open .nav-scrim { display: block; }
  .nav-scrim { display: none; position: fixed; inset: var(--header-h) 0 0 0; background: rgba(0, 0, 0, .35); z-index: 35; }
  .main { border-radius: 0; margin-top: 0; box-shadow: none; }
  .toolbar { padding: 10px 12px 6px; row-gap: 6px; }
  .crumbs { flex-basis: 100%; }
  .crumb { font-size: 17px; max-width: 220px; }
  .tool-actions { width: 100%; }
  .tool-actions .view-toggle { margin-left: auto; }
  #uploadBtn { display: none; }
  .content { padding: 0 8px 96px; }
  .list .c-mod, .list .c-size { display: none; }
  .list .c-act { width: 88px; }
  .namecell .meta-m { display: block; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .tool-actions .lbl { display: none; }
  .vstage { padding: 8px; }
  .vnav { display: none; }
  .vdoc { padding: 18px; }
  .tray { right: 16px; left: 16px; width: auto; bottom: 16px; }
  .fab {
    position: fixed; right: 18px; bottom: 22px; z-index: 30; height: 56px; padding: 0 22px 0 18px; border-radius: 18px; border: 0;
    background: var(--accent); color: #fff; box-shadow: var(--shadow-3); display: inline-flex; align-items: center; gap: 10px;
    font: inherit; font-size: 16px; font-weight: 600;
  }
  .fab[hidden] { display: none; }
  .fab .icon { width: 24px; height: 24px; stroke-width: 2.2; }
  /* The icon's red accent stroke is invisible on the red button: draw the whole icon in white. */
  .fab .icon .r, .fab .icon .k { stroke: currentColor; }
}
@media (min-width: 761px) { .fab, .nav-scrim { display: none !important; } }

/* ---------- [DAN] dot-matrix art ---------- */
.state-dot { color: var(--text-2); margin-bottom: 22px; padding: 22px; border-radius: 28px; background: var(--surface-2); display: inline-grid; place-items: center; }
.state-dot.drop-art { color: var(--accent); background: var(--accent-soft); }
.drop .state-dot { background: transparent; color: var(--accent); margin-bottom: 10px; padding: 0; }
.side-label { font-family: var(--mono); font-weight: 600; font-size: 10.5px; letter-spacing: .12em; }
.titem .ti-s, .list td.c-mod, .list td.c-size, .card .sub, .namecell .meta-m, .sr-item .p { font-family: var(--mono); font-size: 12px; }
.list td.c-mod, .list td.c-size { color: var(--muted); }

/* ---------- admin ---------- */
.app.admin-mode .tool-actions { display: none; }
.app.admin-mode .new-btn { visibility: hidden; }
.app.admin-mode .side-label:nth-of-type(2), .app.admin-mode #tree { display: none; }
.admin { padding: 4px 0 40px; }
.admin-title { display: flex; align-items: center; gap: 14px; }
.admin-title .dotword { font-family: var(--dot); font-weight: 900; font-size: 24px; letter-spacing: .06em; text-transform: uppercase; }
.admin-title .dotword b { color: var(--accent); font-weight: 900; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 0 0 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 12px 14px 11px; color: var(--text-2);
  font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab .count { font: 600 11px var(--mono); color: var(--muted); background: var(--surface-2); padding: 1px 7px; border-radius: 10px; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h3 { margin: 0; font-size: 17px; font-weight: 600; flex: 1; min-width: 160px; }
.panel-head .input { width: 240px; height: 36px; }
.panel-head select.input { width: auto; min-width: 180px; background-position: calc(100% - 18px) 15px, calc(100% - 13px) 15px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 18px 16px; overflow: hidden;
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.stat .k { font: 600 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.stat .v { font-family: var(--dot); font-weight: 900; font-size: 44px; line-height: 1.05; margin-top: 10px; letter-spacing: .02em; }
.stat .v.red { color: var(--accent); }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat .corner { position: absolute; right: 14px; top: 14px; color: var(--text-2); opacity: .9; }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; }
.box { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px; min-width: 0; }
.box h4 { margin: 0 0 12px; font: 600 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.box h4 a { margin-left: auto; color: var(--text-2); text-decoration: none; text-transform: none; letter-spacing: 0; font-family: var(--font); font-size: 12px; }
.box h4 a:hover { color: var(--accent); }

.atable { width: 100%; border-collapse: collapse; }
.atable th { text-align: left; font: 600 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0 10px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.atable td { padding: 12px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.atable tr:last-child td { border-bottom: 0; }
.atable tbody tr:hover { background: var(--surface-2); }
.atable .mono { font: 12px var(--mono); color: var(--text-2); word-break: break-all; }
.atable .acts { text-align: right; white-space: nowrap; }
.atable.compact td { padding: 8px 10px; }
.who { display: flex; align-items: center; gap: 12px; font-weight: 600; }
.who .av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--text); font: 700 12px var(--font); flex: none; }
.who .av.boss { background: var(--ink-btn); color: var(--ink-btn-text); }
.who small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 10px; border-radius: 14px; border: 1px solid var(--border-strong);
  font-size: 12px; background: var(--surface); max-width: 100%;
}
.chip .c { font-weight: 600; white-space: nowrap; }
.chip .p { font-family: var(--mono); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.chip .m { font: 600 10px var(--mono); letter-spacing: .06em; padding: 2px 6px; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.chip .m.up { background: var(--accent-soft); color: var(--select-ink); }
.chip button { width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; color: var(--muted); padding: 0; }
.chip button:hover { background: var(--surface-3); color: var(--danger); }
.chip button .icon { width: 14px; height: 14px; }
.chip.add { border-style: dashed; padding: 0 10px; color: var(--text-2); cursor: pointer; background: transparent; }
.chip.add:hover { border-color: var(--accent); color: var(--accent); }
.badge { display: inline-flex; align-items: center; gap: 6px; font: 600 10.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.badge.no { color: var(--danger); background: var(--accent-soft); }
.badge.plain::before { display: none; }

.drives { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.drive { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 20px; }
.drive .top { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.drive .top .t { flex: 1; min-width: 0; }
.drive .top b { display: block; font-weight: 600; }
.drive .top .mono { font: 12px var(--mono); color: var(--muted); word-break: break-all; }
.drive .big { font-family: var(--dot); font-weight: 900; font-size: 38px; letter-spacing: .02em; line-height: 1; }
.drive .big small { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.dotbar { display: grid; grid-template-columns: repeat(40, 1fr); gap: 3px; margin: 14px 0 8px; }
.dotbar i { aspect-ratio: 1; border-radius: 50%; background: var(--dot-off); }
.dotbar i.on { background: var(--text); }
.dotbar.warn i.on { background: var(--amber); }
.dotbar.hot i.on { background: var(--accent); }
.drive .foot { display: flex; justify-content: space-between; font: 12px var(--mono); color: var(--muted); }
.drive.bad { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.drive .err { color: var(--danger); font-size: 13px; }

.templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.tpl { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px; }
.tpl h5 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 10px; }
.tpl ul { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.tpl li { padding: 4px 0; display: flex; gap: 8px; align-items: baseline; }
.tpl li .sub { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.tpl .sides { margin-top: 12px; font: 11px var(--mono); color: var(--muted); }
.act { font-family: var(--mono); font-size: 12px; }
.skeleton-box { height: 120px; border-radius: 16px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }

.dialog.wide { max-width: 560px; }
.dialog .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dialog .note { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; }
.dialog .danger-note { background: var(--accent-soft); color: var(--danger); }
.dialog .btn.primary.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; font-size: 13px; color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.on { background: var(--ink-btn); color: var(--ink-btn-text); }

@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .atable .hide-m { display: none; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .v { font-size: 34px; }
  .dialog .row2 { grid-template-columns: 1fr; }
  .panel-head .input { width: 100%; }
  .drives { grid-template-columns: 1fr; }
}
