/* Lumcells Drive: the one stylesheet, for the public pages, the app and the staff pages.
 *
 * 1. Tokens: the colours, spaces, radii, type sizes and shadows of the Lumcells Cloud console
 *    (docs/STYLE.md), unchanged, so the two products look like one family. Drive adds two
 *    tokens of its own (a wider radius and a hero tint) and is otherwise only softer in its
 *    use of space. Nothing below this block names a colour by its value. Dark mode changes
 *    tokens and nothing else.
 * 2. Base. 3. The kit: cards, buttons, forms, notices, badges, stats, tables, empty states.
 * 4. Public pages. 5. The app. 6. Staff pages.
 *
 * No font, image or script is loaded from anywhere else.
 */

/* ------------------------------------------------------------------ 1. tokens */
:root {
  color-scheme: light dark;

  /* The brand accent, one scale. */
  --brand-50: #eef1ff;
  --brand-100: #dfe4ff;
  --brand-200: #c3cbff;
  --brand-300: #9da6fb;
  --brand-400: #7a80f4;
  --brand-500: #5f61ea;
  --brand-600: #4b49d6;
  --brand-700: #3d3bb3;
  --brand-800: #323189;
  --brand-900: #272763;

  /* Neutrals. */
  --ink: #131722;
  --ink-2: #3b4252;
  --ink-3: #5d6678;
  --ink-4: #8a93a5;
  --line: #e2e5ec;
  --line-2: #cfd4de;
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eef0f5;

  /* Meaning: soft background, border, text, solid. */
  --green-bg: #e9f7ef;  --green-line: #b4e0c5;  --green-ink: #17663a;  --green: #1f9d57;
  --red-bg: #fdecee;    --red-line: #f3b9c1;    --red-ink: #a3182d;    --red: #d5364c;
  --amber-bg: #fdf4df;  --amber-line: #efd38d;  --amber-ink: #7a4d05;  --amber: #d99a12;
  --blue-bg: #e9f2fd;   --blue-line: #b5d2f5;   --blue-ink: #17508f;   --blue: #2a78d6;

  --accent: var(--brand-600);
  --accent-hover: var(--brand-700);
  --accent-ink: var(--brand-700);
  --accent-soft: var(--brand-50);
  --accent-soft-line: var(--brand-200);
  --on-accent: #ffffff;
  --focus: var(--brand-400);

  /* Space (4px steps). */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s7: 32px; --s8: 48px;

  /* Radii. */
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px; --r-full: 999px;

  /* Type. */
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --t-xs: 12px; --t-sm: 13px; --t-md: 14px; --t-lg: 16px; --t-xl: 20px; --t-2xl: 24px; --t-3xl: 32px;

  /* Shadows. */
  --shadow-1: 0 1px 2px rgba(19, 23, 34, .05);
  --shadow-2: 0 1px 2px rgba(19, 23, 34, .05), 0 4px 12px rgba(19, 23, 34, .06);
  --shadow-3: 0 8px 28px rgba(19, 23, 34, .14);

  /* Charts: axis text, grid, and the two series colours (told apart by hue and by lightness). */
  --chart-ink: #5d6678;
  --chart-grid: #e2e5ec;
  --chart-1: #2a78d6;
  --chart-2: #c2571a;

  --header-h: 56px;
  --side-w: 236px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand-50: #1b1d3a;
    --brand-100: #23264d;
    --brand-200: #33377a;
    --brand-300: #4a4fb0;
    --brand-400: #6f74ea;
    --brand-500: #7f84f2;
    --brand-600: #6468e6;
    --brand-700: #a9adff;
    --brand-800: #c5c8ff;
    --brand-900: #e1e3ff;

    --ink: #eceef4;
    --ink-2: #c9cedb;
    --ink-3: #a0a8ba;
    --ink-4: #7b8498;
    --line: #2a2f3d;
    --line-2: #3a4052;
    --bg: #0e1118;
    --surface: #161a24;
    --surface-2: #1b202c;
    --surface-3: #232937;

    --green-bg: #11291c;  --green-line: #1f5236;  --green-ink: #7fdba6;  --green: #2fb46a;
    --red-bg: #33151a;    --red-line: #6b2732;    --red-ink: #ff9aa8;    --red: #e2566a;
    --amber-bg: #2e2410;  --amber-line: #5f4a17;  --amber-ink: #f3cd74;  --amber: #e0a52a;
    --blue-bg: #12233a;   --blue-line: #234a7a;   --blue-ink: #93c2f7;   --blue: #4a93e6;

    --accent: #5b5fe0;
    --accent-hover: #6f73ea;
    --accent-ink: #b3b6ff;
    --accent-soft: #1d2040;
    --accent-soft-line: #3a3f86;
    --focus: #8f93ff;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-2: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .35);
    --shadow-3: 0 10px 30px rgba(0, 0, 0, .6);

    --chart-ink: #a0a8ba;
    --chart-grid: #2a2f3d;
    --chart-1: #5aa2f0;
    --chart-2: #f0a35e;
  }
}

:root { --r-2xl: 20px; --hero: linear-gradient(160deg, var(--brand-50), var(--surface) 60%); --top-h: 60px; }

/* ------------------------------------------------------------------ 2. base */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, kbd { font-family: var(--mono); font-size: .92em; }
code { background: var(--surface-3); border-radius: var(--r-sm); padding: 1px 5px; overflow-wrap: anywhere; }
pre code { background: none; padding: 0; }
.copy-all { user-select: all; }
pre { background: var(--surface-3); border-radius: var(--r-md); padding: var(--s3); overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--surface); padding: var(--s2) var(--s3); z-index: 100; border-radius: var(--r-md); }
.skip:focus { left: var(--s2); top: var(--s2); }
.muted { color: var(--ink-3); }
.small { font-size: var(--t-sm); }
.strong { font-weight: 650; }
.mono { font-family: var(--mono); }
.vstack { display: flex; flex-direction: column; gap: var(--s4); }
.vstack.tight { gap: var(--s2); }
.hstack { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.center { text-align: center; }
.wrap-any { overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ 3. the kit */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-1); min-width: 0; }
.card.pad { padding: var(--s5); }
.card-title { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-lg); font-weight: 650; }
.card-title .ic { color: var(--accent-ink); }
.card > .card-title { padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line); }
.card.pad > .card-title { margin: calc(-1 * var(--s5)) calc(-1 * var(--s5)) var(--s4); }
.card-body { padding: var(--s5); }
.card-foot { padding: var(--s3) var(--s5); border-top: 1px solid var(--line); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 38px; padding: 0 var(--s4); border-radius: var(--r-full); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 600; font-size: var(--t-md); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--red); border-color: var(--red); color: var(--on-accent); }
.btn-danger:hover { background: var(--red); filter: brightness(.94); }
.btn-amber { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber-ink); }
.btn-ghost { border-color: transparent; background: none; }
.btn-sm { min-height: 30px; padding: 0 var(--s3); font-size: var(--t-sm); }
.btn-lg { min-height: 46px; padding: 0 var(--s6); font-size: var(--t-lg); }
.btn-icon { width: 36px; min-height: 36px; padding: 0; border-color: transparent; background: none; color: var(--ink-3); }
.btn-icon:hover { color: var(--ink); }
.btn-block { width: 100%; }

.form { display: flex; flex-direction: column; gap: var(--s4); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-weight: 600; font-size: var(--t-md); }
.field input[type="text"], .field input[type="email"], .field input[type="password"], .field input[type="number"], .field textarea, .field select, .input {
  width: 100%; min-height: 42px; padding: var(--s2) var(--s3); border: 1px solid var(--line-2); border-radius: var(--r-lg); background: var(--surface); }
.field textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.field input:focus-visible, .field textarea:focus-visible, .input:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.field .help { font-size: var(--t-sm); color: var(--ink-3); }
.field .error { font-size: var(--t-sm); color: var(--red-ink); }
.check { display: flex; gap: var(--s2); align-items: flex-start; }
.check input { width: 18px; height: 18px; margin: 3px 0 0; flex: none; accent-color: var(--accent); }
.form-actions { display: flex; gap: var(--s2); justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.form-inline { display: flex; gap: var(--s3); align-items: flex-end; flex-wrap: wrap; }

.note { display: flex; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface-2); font-size: var(--t-md); }
.note .ic { margin-top: 2px; }
.note-blue { background: var(--blue-bg); border-color: var(--blue-line); color: var(--blue-ink); }
.note-amber { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber-ink); }
.note-red { background: var(--red-bg); border-color: var(--red-line); color: var(--red-ink); }
.note-green { background: var(--green-bg); border-color: var(--green-line); color: var(--green-ink); }
.note-grey { color: var(--ink-2); }
.note a { color: inherit; text-decoration: underline; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: var(--r-full); border: 1px solid var(--line); background: var(--surface-3); color: var(--ink-2); font-size: var(--t-xs); font-weight: 600; line-height: 1.5; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: var(--r-full); background: currentColor; opacity: .8; flex: none; }
.badge-green { background: var(--green-bg); border-color: var(--green-line); color: var(--green-ink); }
.badge-red { background: var(--red-bg); border-color: var(--red-line); color: var(--red-ink); }
.badge-amber { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber-ink); }
.badge-blue { background: var(--blue-bg); border-color: var(--blue-line); color: var(--blue-ink); }
.badge-grey { }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--s4); }
.stat { padding: var(--s4) var(--s5); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat-top { display: flex; align-items: center; gap: var(--s2); }
.stat-ic { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: var(--r-md); background: var(--accent-soft); color: var(--accent-ink); }
.stat-green .stat-ic { background: var(--green-bg); color: var(--green-ink); }
.stat-amber .stat-ic { background: var(--amber-bg); color: var(--amber-ink); }
.stat-red .stat-ic { background: var(--red-bg); color: var(--red-ink); }
.stat-grey .stat-ic { background: var(--surface-3); color: var(--ink-3); }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.stat-value { font-size: var(--t-2xl); font-weight: 650; letter-spacing: -.01em; line-height: 1.25; overflow-wrap: anywhere; }
.stat-hint { font-size: var(--t-xs); color: var(--ink-3); overflow-wrap: anywhere; }

progress.meter { appearance: none; -webkit-appearance: none; width: 100%; height: 8px; border: 0; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; display: block; }
progress.meter::-webkit-progress-bar { background: var(--surface-3); border-radius: var(--r-full); }
progress.meter::-webkit-progress-value { background: var(--accent); border-radius: var(--r-full); transition: width .2s; }
progress.meter::-moz-progress-bar { background: var(--accent); border-radius: var(--r-full); }
progress.meter.green::-webkit-progress-value { background: var(--green); }
progress.meter.green::-moz-progress-bar { background: var(--green); }
progress.meter.amber::-webkit-progress-value { background: var(--amber); }
progress.meter.amber::-moz-progress-bar { background: var(--amber); }
progress.meter.red::-webkit-progress-value { background: var(--red); }
progress.meter.red::-moz-progress-bar { background: var(--red); }

.scroll-x { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--t-md); }
.tbl th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; white-space: nowrap; }
.tbl .sub { display: block; font-size: var(--t-sm); color: var(--ink-3); }

.empty { margin: var(--s5); padding: var(--s7) var(--s4); border: 1px dashed var(--line-2); border-radius: var(--r-lg); text-align: center; color: var(--ink-3); display: grid; justify-items: center; gap: var(--s3); }
.empty-ic { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: var(--r-full); background: var(--surface-3); color: var(--ink-4); }
.empty-ic .ic { width: 26px; height: 26px; }
.empty p { max-width: 34rem; }

.page-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.page-head h1 { font-size: var(--t-2xl); font-weight: 650; letter-spacing: -.01em; }
.page-head .head-ic { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-lg); background: var(--accent-soft); color: var(--accent-ink); flex: none; }
.page-head .head-ic .ic { width: 22px; height: 22px; }
.page-head .lead { color: var(--ink-3); font-size: var(--t-md); }
.page-head .actions { margin-left: auto; display: flex; gap: var(--s2); flex-wrap: wrap; }

.kv { display: grid; grid-template-columns: minmax(120px, 220px) 1fr; gap: var(--s2) var(--s4); }
.kv dt { color: var(--ink-3); }
.kv dd { overflow-wrap: anywhere; min-width: 0; }

details.more > summary { cursor: pointer; color: var(--accent-ink); font-size: var(--t-sm); }
details.more[open] > summary { margin-bottom: var(--s2); }

/* ------------------------------------------------------------------ 4. public pages */
.topbar { height: var(--top-h); display: flex; align-items: center; gap: var(--s4); padding: 0 var(--s5); background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 700; font-size: var(--t-lg); color: var(--ink); letter-spacing: -.01em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--on-accent); display: inline-grid; place-items: center; }
.brand-mark .ic { width: 18px; height: 18px; stroke-width: 2.2; }
.topbar nav { margin-left: auto; display: flex; gap: var(--s2); align-items: center; }
.wrap { max-width: 1080px; margin: 0 auto; padding: var(--s7) var(--s5); display: flex; flex-direction: column; gap: var(--s7); }
.narrow { max-width: 480px; margin: 0 auto; padding: var(--s7) var(--s4); display: flex; flex-direction: column; gap: var(--s4); }
.narrow.wide { max-width: 640px; }
.narrow h1 { font-size: var(--t-2xl); font-weight: 650; letter-spacing: -.01em; }
.prose { max-width: 760px; margin: 0 auto; padding: var(--s7) var(--s5); display: flex; flex-direction: column; gap: var(--s4); }
.prose h1 { font-size: var(--t-3xl); letter-spacing: -.02em; }
.prose h2 { font-size: var(--t-xl); margin-top: var(--s4); }
.prose ul { list-style: disc; padding-left: var(--s5); display: flex; flex-direction: column; gap: var(--s2); }
.hero { background: var(--hero); border: 1px solid var(--line); border-radius: var(--r-2xl); padding: var(--s8) var(--s7); display: flex; flex-direction: column; gap: var(--s4); align-items: flex-start; }
.hero h1 { font-size: clamp(28px, 5vw, 44px); line-height: 1.12; letter-spacing: -.025em; max-width: 18ch; }
.hero p { font-size: var(--t-lg); color: var(--ink-2); max-width: 56ch; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s4); }
.fact { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s2); }
.fact h3 { font-size: var(--t-lg); display: flex; align-items: center; gap: var(--s2); }
.fact h3 .ic { color: var(--accent-ink); }
.fact p { color: var(--ink-2); }
.section-title { font-size: var(--t-xl); font-weight: 650; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--s4); }
.plan { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s2); }
.plan .plan-size { font-size: var(--t-2xl); font-weight: 650; }
.foot { border-top: 1px solid var(--line); padding: var(--s5); color: var(--ink-3); font-size: var(--t-sm); display: flex; gap: var(--s4); flex-wrap: wrap; justify-content: center; }

.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.strength span { height: 6px; border-radius: var(--r-full); background: var(--surface-3); }
.strength[data-score="1"] span:nth-child(-n+1) { background: var(--red); }
.strength[data-score="2"] span:nth-child(-n+2) { background: var(--amber); }
.strength[data-score="3"] span:nth-child(-n+3) { background: var(--green); }
.strength[data-score="4"] span:nth-child(-n+4) { background: var(--green); }

.words { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); counter-reset: word; padding: var(--s4); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); }
.words li { counter-increment: word; font-family: var(--mono); font-size: var(--t-md); padding: 6px 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.words li::before { content: counter(word); color: var(--ink-4); font-size: 11px; min-width: 1.3em; text-align: right; }
@media (max-width: 560px) { .words { grid-template-columns: repeat(2, 1fr); } }

.working { display: flex; align-items: center; gap: var(--s3); color: var(--ink-2); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* ------------------------------------------------------------------ 5. the app */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: var(--s4); padding: var(--s4); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { padding: var(--s1) var(--s2) var(--s3); }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: var(--s3); padding: 10px var(--s3); border-radius: var(--r-lg); color: var(--ink-2); font-weight: 550; }
.side-nav a:hover { background: var(--surface-3); text-decoration: none; }
.side-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }
.side-nav a.drop-target { outline: 2px dashed var(--accent); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--s3); }
.quota { padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 6px; font-size: var(--t-sm); color: var(--ink-2); background: var(--surface-2); }
.quota:hover { text-decoration: none; }
.enc-line { display: flex; gap: var(--s2); align-items: center; font-size: var(--t-xs); color: var(--ink-3); padding: 0 var(--s2); }
.enc-line .ic { width: 14px; height: 14px; color: var(--green-ink); }
.main { padding: var(--s5) var(--s6) 120px; display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.mobile-bar { display: none; }

.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: var(--t-xl); font-weight: 650; letter-spacing: -.01em; min-width: 0; }
.crumbs a, .crumbs span.here { padding: 2px 8px; border-radius: var(--r-md); color: var(--ink-3); overflow-wrap: anywhere; }
.crumbs span.here { color: var(--ink); }
.crumbs a:hover { background: var(--surface-3); text-decoration: none; }
.crumbs a.drop-target { outline: 2px dashed var(--accent); }
.crumbs .ic { color: var(--ink-4); width: 16px; height: 16px; }

.toolbar { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; min-height: 40px; }
.toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 var(--s1); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-full); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 12px; cursor: pointer; display: inline-flex; align-items: center; color: var(--ink-3); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); }
.select { min-height: 36px; padding: 0 var(--s3); border: 1px solid var(--line-2); border-radius: var(--r-full); background: var(--surface); }
.selbar { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; padding: var(--s2) var(--s3); background: var(--accent-soft); border: 1px solid var(--accent-soft-line); border-radius: var(--r-lg); color: var(--accent-ink); font-weight: 600; }

.files { display: flex; flex-direction: column; }
.files-head, .frow { display: grid; grid-template-columns: 36px minmax(0, 1fr) 110px 170px 84px; align-items: center; gap: var(--s2); padding: 0 var(--s3); }
.files-head { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); min-height: 38px; border-bottom: 1px solid var(--line); }
.files-head button { background: none; border: 0; padding: 0; font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.files-head .ic { width: 12px; height: 12px; }
.frow { min-height: 52px; border-bottom: 1px solid var(--line); cursor: default; user-select: none; }
.frow:last-child { border-bottom: 0; }
.frow:hover { background: var(--surface-2); }
.frow[aria-selected="true"] { background: var(--accent-soft); }
.frow.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; }
.frow.cut { opacity: .5; }
.fname { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.fname .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.fname a.label { color: var(--ink); }
.ficon { width: 34px; height: 34px; border-radius: var(--r-md); display: inline-grid; place-items: center; flex: none; background: var(--surface-3); color: var(--ink-3); }
.ficon.folder { background: var(--accent-soft); color: var(--accent-ink); }
.frow .acts { display: flex; justify-content: flex-end; }
.frow input[type="checkbox"], .files-head input[type="checkbox"], .tile input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent); }
.fsize, .fdate { color: var(--ink-3); font-size: var(--t-sm); white-space: nowrap; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); padding: var(--s4); }
.tile { position: relative; border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s4) var(--s3) var(--s3); display: flex; flex-direction: column; align-items: center; gap: var(--s2); text-align: center; background: var(--surface); user-select: none; min-width: 0; }
.tile:hover { background: var(--surface-2); }
.tile[aria-selected="true"] { background: var(--accent-soft); border-color: var(--accent-soft-line); }
.tile.drop-target { outline: 2px dashed var(--accent); }
.tile .ficon { width: 56px; height: 56px; border-radius: var(--r-lg); }
.tile .ficon .ic { width: 28px; height: 28px; }
.tile .label { font-weight: 550; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink); font-size: var(--t-md); }
.tile input[type="checkbox"] { position: absolute; top: 8px; left: 8px; }
.tile .acts { position: absolute; top: 2px; right: 2px; }

.dropzone { position: fixed; inset: 0; z-index: 60; background: color-mix(in srgb, var(--accent) 14%, transparent); border: 3px dashed var(--accent); display: grid; place-items: center; pointer-events: none; }
.dropzone div { background: var(--surface); padding: var(--s4) var(--s6); border-radius: var(--r-xl); box-shadow: var(--shadow-3); font-weight: 650; font-size: var(--t-lg); display: flex; gap: var(--s3); align-items: center; }

.menu { position: absolute; z-index: 50; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-3); padding: 6px; display: flex; flex-direction: column; }
.menu button { display: flex; align-items: center; gap: var(--s3); padding: 8px var(--s3); border: 0; background: none; border-radius: var(--r-md); cursor: pointer; text-align: left; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-3); }
.menu button.danger { color: var(--red-ink); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }

.uploads { position: fixed; right: var(--s5); bottom: var(--s5); width: min(420px, calc(100vw - 2 * var(--s4))); z-index: 40; box-shadow: var(--shadow-3); max-height: 60vh; display: flex; flex-direction: column; }
.uploads-head { display: flex; align-items: center; gap: var(--s2); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
.uploads-head .title { font-weight: 650; }
.uploads-overall { padding: var(--s2) var(--s4) var(--s3); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; font-size: var(--t-sm); color: var(--ink-3); }
.uploads-list { overflow-y: auto; }
.urow { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.urow:last-child { border-bottom: 0; }
.urow-top { display: flex; align-items: center; gap: var(--s2); }
.urow-top .label { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.urow .sub { font-size: var(--t-xs); color: var(--ink-3); display: flex; gap: var(--s2); justify-content: space-between; flex-wrap: wrap; }
.urow .sub.err { color: var(--red-ink); }

dialog.modal { border: 1px solid var(--line); border-radius: var(--r-xl); padding: 0; background: var(--surface); color: var(--ink); width: min(480px, calc(100vw - 2 * var(--s4))); box-shadow: var(--shadow-3); }
dialog.modal::backdrop { background: rgba(10, 12, 20, .5); }
dialog.modal form, dialog.modal .modal-body { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s4); }
dialog.modal h2 { font-size: var(--t-xl); }
.tree { border: 1px solid var(--line); border-radius: var(--r-lg); max-height: 300px; overflow-y: auto; padding: 4px; }
.tree button { display: flex; align-items: center; gap: var(--s2); width: 100%; padding: 8px var(--s3); border: 0; background: none; border-radius: var(--r-md); cursor: pointer; text-align: left; }
.tree button:hover { background: var(--surface-3); }
.tree button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.tree button:disabled { opacity: .45; cursor: not-allowed; }

.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: var(--s5); z-index: 70; display: flex; flex-direction: column; gap: var(--s2); align-items: center; width: min(520px, calc(100vw - 2 * var(--s4))); pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); padding: var(--s3) var(--s4); border-radius: var(--r-lg); box-shadow: var(--shadow-3); font-size: var(--t-md); display: flex; gap: var(--s3); align-items: center; }
.toast.err { background: var(--red); color: var(--on-accent); }
.toast button { background: none; border: 0; color: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }

.cards-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--s4); align-items: start; }
.session { display: flex; gap: var(--s3); align-items: center; padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line); }
.session:last-child { border-bottom: 0; }
.center-screen { min-height: 100vh; display: grid; place-items: center; padding: var(--s4); }

@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: min(290px, 86vw); z-index: 55; transform: translateX(-102%); transition: transform .18s; box-shadow: var(--shadow-3); }
  .app.menu-open .side { transform: none; }
  .app.menu-open::after { content: ""; position: fixed; inset: 0; background: rgba(10, 12, 20, .45); z-index: 54; }
  .mobile-bar { display: flex; align-items: center; gap: var(--s2); height: 54px; padding: 0 var(--s3); background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .main { padding: var(--s4) var(--s3) 140px; }
  .files-head { display: none; }
  .frow { grid-template-columns: 30px minmax(0, 1fr) 40px; grid-template-areas: "c n a" "c m a"; padding: 6px var(--s2); row-gap: 0; }
  .frow > .fcheck { grid-area: c; } .frow > .fname { grid-area: n; } .frow > .acts { grid-area: a; }
  .frow > .fsize { grid-area: m; padding-left: 46px; } .frow > .fdate { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); padding: var(--s3); }
  .uploads { right: 0; left: 0; bottom: 0; width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 50vh; }
  .crumbs { font-size: var(--t-lg); }
  .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: var(--s2); }
  .hero { padding: var(--s6) var(--s4); }
  .wrap { padding: var(--s5) var(--s3); gap: var(--s5); }
  .topbar { padding: 0 var(--s3); }
  .session { padding: var(--s3) var(--s4); flex-wrap: wrap; }
  /* Tables become one card per row, each value with its column heading in front. */
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); }
  .tbl tr:last-child { border-bottom: 0; }
  .tbl td { border: 0; padding: 3px 0; text-align: left !important; }
  .tbl td[data-th]::before { content: attr(data-th) ": "; color: var(--ink-3); font-size: var(--t-sm); }
}

/* ------------------------------------------------------------------ 6. staff pages */
.admin { max-width: 1180px; margin: 0 auto; padding: var(--s5); display: flex; flex-direction: column; gap: var(--s5); }
.admin-nav { display: flex; gap: var(--s1); flex-wrap: wrap; }
.admin-nav a { padding: 6px var(--s3); border-radius: var(--r-full); color: var(--ink-2); font-weight: 600; display: inline-flex; gap: var(--s2); align-items: center; }
.admin-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }
.admin-nav a:hover { background: var(--surface-3); text-decoration: none; }
.staff-tag { font-size: var(--t-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--amber-ink); background: var(--amber-bg); border: 1px solid var(--amber-line); padding: 2px 8px; border-radius: var(--r-full); }
.real-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2) var(--s4); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); }
.real-row:last-child { border-bottom: 0; }
.real-row h3 { font-size: var(--t-lg); font-weight: 650; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.real-row .detail { grid-column: 1 / -1; color: var(--ink-2); }
.real-row .needs { grid-column: 1 / -1; font-size: var(--t-sm); color: var(--ink-3); }
.method { font-family: var(--mono); font-size: var(--t-xs); font-weight: 700; padding: 2px 7px; border-radius: var(--r-sm); background: var(--surface-3); }
.method.GET { background: var(--green-bg); color: var(--green-ink); }
.method.POST { background: var(--blue-bg); color: var(--blue-ink); }
.method.PUT, .method.PATCH { background: var(--amber-bg); color: var(--amber-ink); }
.method.DELETE { background: var(--red-bg); color: var(--red-ink); }

/* A narrow screen has no room for the staff email next to the brand: the page stays as wide as the screen. */
@media (max-width: 560px) { .topbar nav .small.muted { display: none; } .topbar { gap: var(--s2); } }

/* ---------------------------------------------------------------- lane W2: sharing, previews, search */
.sub-title { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-lg); font-weight: 650; }
.sub-title .ic { color: var(--accent-ink); }
.field-row { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: flex-end; }
.field-row > .field { flex: 1 1 140px; }
.tabs { display: flex; gap: var(--s1); border-bottom: 1px solid var(--line); }
.tabs .tab { padding: var(--s2) var(--s4); border-bottom: 2px solid transparent; color: var(--ink-3); font-weight: 600; margin-bottom: -1px; }
.tabs .tab:hover { color: var(--ink); text-decoration: none; }
.tabs .tab.on { color: var(--accent-ink); border-bottom-color: var(--accent); }
dialog.modal:has(.share-dialog) { width: min(640px, calc(100vw - 2 * var(--s4))); }
dialog.modal .share-dialog form { padding: 0; }
.share-dialog section { display: flex; flex-direction: column; gap: var(--s3); padding-bottom: var(--s4); border-bottom: 1px solid var(--line); }
.share-form { border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s4) !important; background: var(--surface-2); }
.share-row { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line); min-width: 0; }
.share-row:last-child { border-bottom: 0; }
.share-dialog .share-row { padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-lg); }
dialog.modal:has(.versions-dialog) { width: min(640px, calc(100vw - 2 * var(--s4))); }
.versions-dialog .share-row { padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-lg); }
.share-row > .ic { margin-top: 3px; color: var(--ink-3); flex: none; }
.share-row .grow { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.share-acts { display: flex; gap: var(--s2); flex-wrap: wrap; justify-content: flex-end; align-items: center; flex: none; }
.link-url { width: 100%; margin-top: 4px; font-family: var(--mono, ui-monospace, monospace); font-size: var(--t-sm); padding: 6px 8px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--surface); color: var(--ink-2, var(--ink)); }
.shared-mark { color: var(--accent-ink); display: inline-flex; margin-left: 6px; vertical-align: middle; }
.shared-mark .ic { width: 15px; height: 15px; }

/* The search box and its results. */
.search { position: relative; display: flex; align-items: center; }
.search .ic { position: absolute; left: 10px; color: var(--ink-3); pointer-events: none; }
.search input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--line-2); border-radius: var(--r-full); background: var(--surface); color: var(--ink); font: inherit; }
.search input:focus-visible { outline: 2px solid var(--focus); border-color: var(--focus); }
.result { display: flex; gap: var(--s3); align-items: center; padding: var(--s3) var(--s5); border-bottom: 1px solid var(--line); min-width: 0; cursor: pointer; width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; color: inherit; font: inherit; }
.result:last-child { border-bottom: 0; }
.result:hover, .result:focus-visible { background: var(--surface-2); }
.result .grow { min-width: 0; }
.result mark { background: var(--amber-bg, #fde68a); color: inherit; border-radius: 3px; padding: 0 1px; }

/* Thumbnails in the grid and the list. */
.tile .thumb { width: 100%; aspect-ratio: 4 / 3; border-radius: var(--r-md); overflow: hidden; background: var(--surface-3); display: grid; place-items: center; }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ficon.has-thumb { padding: 0; overflow: hidden; background: var(--surface-3); }
.ficon.has-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* The viewer: a file opened on the device, over the page. */
dialog.viewer { border: 0; padding: 0; margin: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; background: rgba(12, 14, 22, .96); color: #f4f5f8; display: flex; flex-direction: column; }
dialog.viewer:not([open]) { display: none; }
.viewer-bar { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); background: rgba(0, 0, 0, .35); flex: none; min-width: 0; }
.viewer-bar .name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.viewer-bar .meta { color: #b8bcc8; font-size: var(--t-sm); white-space: nowrap; }
.viewer-bar .btn { background: rgba(255, 255, 255, .1); color: inherit; border-color: rgba(255, 255, 255, .2); }
.viewer-body { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; padding: var(--s4); }
.viewer-body img.shown { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-body video { max-width: 100%; max-height: 100%; background: #000; }
.viewer-body audio { width: min(560px, 100%); }
.viewer-body pre.text { align-self: start; justify-self: stretch; margin: 0 auto; max-width: 1000px; width: 100%; background: var(--surface); color: var(--ink); border-radius: var(--r-lg); padding: var(--s4); font-family: var(--mono, ui-monospace, monospace); font-size: var(--t-sm); line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4; }
.viewer-body .pdf { align-self: start; display: flex; flex-direction: column; gap: var(--s3); align-items: center; width: 100%; }
.viewer-body .pdf canvas { max-width: 100%; height: auto; background: #fff; border-radius: 4px; box-shadow: 0 2px 12px rgba(0, 0, 0, .5); }
.viewer-body .media { display: flex; flex-direction: column; gap: var(--s4); align-items: center; width: 100%; max-height: 100%; }
.viewer-note { color: #d6d9e2; display: flex; flex-direction: column; gap: var(--s3); align-items: center; text-align: center; max-width: 520px; }
.viewer-note .spinner { border-color: rgba(255, 255, 255, .25); border-top-color: #fff; }

/* The public page of a share link. */
.share-page { max-width: 860px; margin: 0 auto; padding: var(--s6) var(--s4); display: flex; flex-direction: column; gap: var(--s4); }
.share-head { display: flex; gap: var(--s4); align-items: center; padding: var(--s5); flex-wrap: wrap; }
.share-head .ficon { width: 56px; height: 56px; border-radius: var(--r-lg); flex: none; }
.share-head .ficon .ic { width: 28px; height: 28px; }
.share-head h1 { font-size: var(--t-xl); overflow-wrap: anywhere; }
.share-head .grow { min-width: 0; flex: 1 1 220px; }
.share-thumb { max-width: 100%; max-height: 320px; border-radius: var(--r-lg); display: block; margin: 0 auto; }
.or-line { display: flex; align-items: center; gap: var(--s3); color: var(--ink-3); font-size: var(--t-sm); }
.or-line::before, .or-line::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

@media (max-width: 760px) {
  .share-row { padding: var(--s3) var(--s4); flex-wrap: wrap; }
  .share-acts { width: 100%; justify-content: flex-start; }
  .result { padding: var(--s3) var(--s4); }
  .viewer-bar .meta { display: none; }
  .viewer-body { padding: var(--s2); }
}
/* Continue with Google on the login and sign-up cards: the button, the "or" line, the blocker.
   The "G" keeps Google's own colours (its brand rules), drawn in icons.svg; nothing else may. */
.google-choice { display: flex; flex-direction: column; gap: var(--s4); margin-bottom: var(--s4); }
.google-blocked { margin-bottom: var(--s4); }
.ic-google { stroke: none; }
.or-line { display: flex; align-items: center; gap: var(--s3); color: var(--ink-4); font-size: var(--t-sm); }
.or-line::before, .or-line::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
/* The email Google confirmed: shown, not editable. */
.field input[readonly] { background: var(--surface-2); color: var(--ink-2); }

/* The selection's actions stand in the toolbar, in place of the upload buttons. */
.toolbar .selbar { flex: 1 1 320px; padding: 4px var(--s3); min-width: 0; }
@media (min-width: 761px) {
  /* One line of fixed height: a second click of a double-click must find the same row under it. */
  .toolbar { flex-wrap: nowrap; height: 46px; }
  .toolbar .selbar { flex: 1 1 0; flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: thin; }
  .toolbar .selbar .btn { flex: none; }
  .toolbar .right { flex: none; }
}

/* The player of audio and video: a document of the service worker, in a frame of the viewer. */
.viewer-body iframe.player { border: 0; width: min(1100px, 100%); height: min(78vh, 720px); background: transparent; color-scheme: dark; }
.viewer-body iframe.player.audio { width: min(600px, 100%); height: 90px; }
body.player-doc { margin: 0; height: 100vh; display: grid; place-items: center; background: #0c0e16; overflow: hidden; }
body.player-doc video { max-width: 100%; max-height: 100vh; background: #000; }
body.player-doc audio { width: 100%; }
/* A dialog taller than the screen scrolls inside itself. */
dialog.modal { max-height: calc(100vh - 2 * var(--s4)); overflow-y: auto; }
