/* Quill design system (shared with Stash, ClosedDoor and SkyNet): deep navy and chrome with the logo's electric blue and gold.
   No external fonts or images: this file is the whole look. Light and dark follow the visitor's system. */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;

  --bg: #f2f5fa;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #eaeff7;
  --line: #e1e7f0;
  --line-strong: #c9d3e2;
  --input-line: #75839a;
  --text: #0c1424;
  --muted: #47546a;
  --accent: #1560d4;
  --accent-hover: #0f4fb3;
  --on-accent: #ffffff;
  --accent-soft: #e6f0ff;
  --ring: #1560d4;
  --gold: #f0a30a;
  --gold-light: #ffcb52;
  --gold-text: #8a5800;
  --navy: #0a1630;
  --silver: #a9b4c6;

  --danger: #b42318;   --danger-bg: #fef3f2;  --danger-line: #fecdca;
  --success: #067647;  --success-bg: #ecfdf3; --success-line: #abefc6;
  --warn: #93370d;     --warn-bg: #fffaeb;    --warn-line: #fedf89;
  --info: #175cd3;     --info-bg: #eff8ff;    --info-line: #b2ddff;

  --shadow-sm: 0 1px 2px rgba(12, 20, 36, .06);
  --shadow-md: 0 1px 3px rgba(12, 20, 36, .08), 0 8px 24px rgba(12, 20, 36, .07);
  --shadow-lg: 0 2px 6px rgba(12, 20, 36, .08), 0 22px 54px rgba(12, 20, 36, .16);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;

  --sidebar-w: 15.5rem;
  --topbar-h: 4rem;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* file type tiles */
  --ft-folder-bg: #fff2cc; --ft-folder-fg: #8a5800;
  --ft-image-bg: #d9f5e6;  --ft-image-fg: #0b6b3a;
  --ft-video-bg: #ece4ff;  --ft-video-fg: #5b2fc4;
  --ft-audio-bg: #ffe3f0;  --ft-audio-fg: #a3175f;
  --ft-pdf-bg: #ffe2df;    --ft-pdf-fg: #b42318;
  --ft-doc-bg: #dfeaff;    --ft-doc-fg: #1853b8;
  --ft-sheet-bg: #dcf6e3;  --ft-sheet-fg: #0d6b2d;
  --ft-slides-bg: #ffe8d1; --ft-slides-fg: #a34a05;
  --ft-archive-bg: #ece6dc;--ft-archive-fg: #6b4f1d;
  --ft-code-bg: #d9f3f7;   --ft-code-fg: #0a6475;
  --ft-file-bg: #e9eef6;   --ft-file-fg: #46546a;

  --av-0-bg: #dfe8ff; --av-0-fg: #1e3a8a;
  --av-1-bg: #fce7f3; --av-1-fg: #9d174d;
  --av-2-bg: #dcfce7; --av-2-fg: #166534;
  --av-3-bg: #fef3c7; --av-3-fg: #92400e;
  --av-4-bg: #e0f2fe; --av-4-fg: #075985;
  --av-5-bg: #f3e8ff; --av-5-fg: #6b21a8;
  --av-6-bg: #ffedd5; --av-6-fg: #9a3412;
  --av-7-bg: #e2e8f0; --av-7-fg: #334155;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070b14;
    --surface: #0f1626;
    --surface-2: #131c2f;
    --surface-3: #1a2540;
    --line: #1f2b45;
    --line-strong: #2f3e5e;
    --input-line: #6a7b9a;
    --text: #e8eefa;
    --muted: #a3b0c8;
    --accent: #5aa3ff;
    --accent-hover: #86bcff;
    --on-accent: #04101f;
    --accent-soft: #112442;
    --ring: #86bcff;
    --gold-text: #f7c85a;
    --silver: #7d8aa3;

    --danger: #ff9a92;   --danger-bg: #2a1517;  --danger-line: #5c2a2e;
    --success: #5ddc9a;  --success-bg: #0f2a1c; --success-line: #1f5a3a;
    --warn: #f5b04a;     --warn-bg: #2b2010;    --warn-line: #5c4416;
    --info: #7db4ff;     --info-bg: #0f2036;    --info-line: #1f4676;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, .55), 0 8px 24px rgba(0, 0, 0, .4);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, .55), 0 22px 54px rgba(0, 0, 0, .55);

    --ft-folder-bg: #3a2c0a; --ft-folder-fg: #ffd36b;
    --ft-image-bg: #0f3322;  --ft-image-fg: #7ee8b0;
    --ft-video-bg: #261a4d;  --ft-video-fg: #c6b0ff;
    --ft-audio-bg: #3d1630;  --ft-audio-fg: #ffa6d3;
    --ft-pdf-bg: #3d1a18;    --ft-pdf-fg: #ffa59c;
    --ft-doc-bg: #12284d;    --ft-doc-fg: #9cc2ff;
    --ft-sheet-bg: #0f3320;  --ft-sheet-fg: #86e8a6;
    --ft-slides-bg: #40250e; --ft-slides-fg: #ffbb85;
    --ft-archive-bg: #33291a;--ft-archive-fg: #e3c88f;
    --ft-code-bg: #0b3139;   --ft-code-fg: #86dbe8;
    --ft-file-bg: #1c2740;   --ft-file-fg: #a9b6cf;

    --av-0-bg: #1b2a5e; --av-0-fg: #c7d6ff;
    --av-1-bg: #4a1530; --av-1-fg: #fbcfe8;
    --av-2-bg: #123524; --av-2-fg: #bbf7d0;
    --av-3-bg: #3d2a0a; --av-3-fg: #fde68a;
    --av-4-bg: #0c2a40; --av-4-fg: #bae6fd;
    --av-5-bg: #34154d; --av-5-fg: #e9d5ff;
    --av-6-bg: #3f1d0b; --av-6-fg: #fed7aa;
    --av-7-bg: #252b38; --av-7-fg: #cbd5e1;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 1rem); }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.015em; }
h1 { font-size: 1.625rem; font-weight: 700; }
h2 { font-size: 1.0625rem; font-weight: 650; }
h3 { font-size: .9375rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; text-decoration-thickness: 1px; transition: text-decoration-color .15s; }
a:hover { text-decoration-color: currentColor; }
code, .mono { font-family: var(--mono); font-size: .875em; }
code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .1em .4em; word-break: break-all; }
small { font-size: .8125rem; }
img, svg { max-width: 100%; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip-link { position: absolute; left: .75rem; top: -4rem; z-index: 100; background: var(--accent); color: var(--on-accent); padding: .6rem 1rem; border-radius: var(--radius-sm); text-decoration: none; font-weight: 600; }
.skip-link:focus { top: .75rem; }
.icon { width: 1.125rem; height: 1.125rem; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 1.5rem; height: 1.5rem; }
.icon-xl { width: 2rem; height: 2rem; }
.stack > * + * { margin-top: 1rem; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.spacer { flex: 1; }
.section-gap { margin-top: 1.5rem; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
html.js .no-js-only { display: none !important; }
html:not(.js) .js-only { display: none !important; }
form { margin: 0; }
form.inline { display: inline; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); }
.logo-nav { display: block; height: 2.9rem; width: auto; filter: drop-shadow(0 1px 6px color-mix(in srgb, var(--accent) 35%, transparent)); }
.logo-hero { display: block; width: min(25rem, 100%); height: auto; margin: 0 auto; filter: drop-shadow(0 12px 38px color-mix(in srgb, var(--accent) 38%, transparent)); }
.brand-caption { font-size: .75rem; font-weight: 650; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 2.5rem; padding: .5rem 1rem; font: inherit; font-weight: 600; font-size: .9375rem; line-height: 1.2;
  color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm); cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn-primary { color: var(--on-accent); background: var(--accent); border-color: var(--accent); box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: #fff; background: #b42318; border-color: #b42318; }
.btn-danger:hover { background: #912018; border-color: #912018; }
@media (prefers-color-scheme: dark) { .btn-danger { background: #f04438; border-color: #f04438; color: #1a0a09; } .btn-danger:hover { background: #ff6a5e; border-color: #ff6a5e; } }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-sm { min-height: 2rem; padding: .25rem .75rem; font-size: .875rem; }
.btn-block { display: flex; width: 100%; }
.btn-icon { width: 2.25rem; min-height: 2.25rem; padding: 0; }
.btn-link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btn-gold { color: #2a1c00; background: linear-gradient(180deg, var(--gold-light), var(--gold)); border-color: #c98600; }
.btn-gold:hover { filter: brightness(1.05); background: linear-gradient(180deg, var(--gold-light), var(--gold)); border-color: #c98600; }

/* ---------- Forms ---------- */
.field { margin: 0 0 1rem; }
.field:last-child { margin-bottom: 0; }
.label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: .375rem; }
.hint { display: block; font-size: .8125rem; color: var(--muted); margin-top: .375rem; font-weight: 400; }
.input {
  display: block; width: 100%; min-height: 2.625rem; padding: .55rem .75rem; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--input-line); border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
select.input { appearance: none; padding-right: 2.25rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23778' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; }
.input:hover { border-color: var(--muted); }
.input:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 28%, transparent); }
.input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.input-sm { min-height: 2.25rem; padding: .35rem .6rem; font-size: .9rem; }
.check { display: flex; align-items: flex-start; gap: .625rem; font-size: .9375rem; font-weight: 400; margin: 0 0 .75rem; cursor: pointer; }
.check input { width: 1.125rem; height: 1.125rem; margin: .2rem 0 0; accent-color: var(--accent); flex: none; }
fieldset { border: 0; padding: 0; margin: 0 0 1.25rem; min-width: 0; }
legend { padding: 0; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .75rem; }
.form-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.form-row .field { margin: 0; flex: 1 1 10rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: 1.25rem; }
.grid-2 { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ---------- Alerts, badges, avatars ---------- */
.alert { display: flex; gap: .75rem; align-items: flex-start; padding: .75rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font-size: .9375rem; margin-bottom: 1rem; }
.alert .icon { margin-top: .15rem; }
.alert-body > :last-child { margin-bottom: 0; }
.alert-error { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
.alert-ok { color: var(--success); background: var(--success-bg); border-color: var(--success-line); }
.alert-warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.alert-info { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .125rem .55rem; font-size: .75rem; font-weight: 600; line-height: 1.4; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.badge-ok { color: var(--success); background: var(--success-bg); border-color: var(--success-line); }
.badge-warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.badge-danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
.badge-info { color: var(--info); background: var(--info-bg); border-color: var(--info-line); }
.badge-gold { color: var(--gold-text); background: color-mix(in srgb, var(--gold) 14%, transparent); border-color: color-mix(in srgb, var(--gold) 50%, transparent); }
.badge-mono { font-family: var(--mono); font-weight: 500; }
.avatar { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none; border-radius: 999px; font-size: .8125rem; font-weight: 700; letter-spacing: .02em; background: var(--av-bg, var(--av-7-bg)); color: var(--av-fg, var(--av-7-fg)); }
.avatar.is-admin { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--gold); }
.avatar-sm { width: 1.75rem; height: 1.75rem; font-size: .6875rem; }
.avatar-lg { width: 3.5rem; height: 3.5rem; font-size: 1.125rem; }
.av-0 { --av-bg: var(--av-0-bg); --av-fg: var(--av-0-fg); } .av-1 { --av-bg: var(--av-1-bg); --av-fg: var(--av-1-fg); }
.av-2 { --av-bg: var(--av-2-bg); --av-fg: var(--av-2-fg); } .av-3 { --av-bg: var(--av-3-bg); --av-fg: var(--av-3-fg); }
.av-4 { --av-bg: var(--av-4-bg); --av-fg: var(--av-4-fg); } .av-5 { --av-bg: var(--av-5-bg); --av-fg: var(--av-5-fg); }
.av-6 { --av-bg: var(--av-6-bg); --av-fg: var(--av-6-fg); } .av-7 { --av-bg: var(--av-7-bg); --av-fg: var(--av-7-fg); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 1.25rem; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.card-head h2 { display: flex; align-items: center; gap: .5rem; }
.card-head p { margin: .125rem 0 0; font-size: .875rem; color: var(--muted); }
.card-body { padding: 1.25rem; }
.card-foot { font-size: .875rem; padding: .875rem 1.25rem; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card-flush { padding: 0; overflow: hidden; position: relative; }
.card-danger { border-color: var(--danger-line); }
.card-danger .card-head h2 { color: var(--danger); }

/* ---------- Auth shell (sign-in) ---------- */
body.auth {
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem;
  background:
    radial-gradient(54rem 26rem at 50% -6rem, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(40rem 20rem at 85% 110%, color-mix(in srgb, var(--gold) 12%, transparent), transparent 70%),
    linear-gradient(var(--bg), var(--bg));
}
body.auth::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(color-mix(in srgb, var(--text) 18%, transparent) 1px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(60% 55% at 50% 30%, #000 0%, transparent 100%);
  mask-image: radial-gradient(60% 55% at 50% 30%, #000 0%, transparent 100%);
}
.auth-wrap { width: 100%; max-width: 26rem; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: .75rem; margin-bottom: 1.5rem; text-align: center; }
.auth-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 2rem 1.75rem; overflow: hidden; }
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--accent), #6fb1ff 40%, var(--gold-light) 70%, var(--gold)); }
.auth-card h1 { font-size: 1.5rem; margin-bottom: .25rem; }
.auth-card .lead { color: var(--muted); margin-bottom: 1.5rem; }
.auth-card.center { text-align: center; }
.auth-foot { margin-top: 1.5rem; text-align: center; font-size: .8125rem; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: .4rem; flex-wrap: wrap; }
.auth-features { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; text-align: center; font-size: .8125rem; color: var(--muted); }
.auth-features li { display: grid; gap: .35rem; justify-items: center; }
.auth-features .icon { width: 1.4rem; height: 1.4rem; color: var(--accent); }
.status-icon { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 999px; margin: 0 auto 1rem; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.status-icon .icon { width: 1.5rem; height: 1.5rem; }
.status-icon.ok { color: var(--success); background: var(--success-bg); border-color: var(--success-line); }
.status-icon.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-line); }
.status-icon.danger { color: var(--danger); background: var(--danger-bg); border-color: var(--danger-line); }
.error-code { font-family: var(--mono); font-size: .75rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; margin-bottom: .5rem; }
details.break { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .9rem; }
details.break summary { cursor: pointer; color: var(--muted); font-weight: 550; }
details.break form { margin-top: .75rem; display: grid; gap: .625rem; }

/* ---------- App shell ---------- */
body.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); grid-template-rows: var(--topbar-h) 1fr; grid-template-areas: "top top" "side main"; background: var(--bg); }
.topbar { grid-area: top; position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 1rem; padding: 0 1.25rem 0 1rem; background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); }
.topbar .brand { width: calc(var(--sidebar-w) - 2rem); }
.searchbox { position: relative; flex: 1; max-width: 38rem; }
.searchbox .icon { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.searchbox input { width: 100%; height: 2.5rem; padding: 0 .9rem 0 2.6rem; font: inherit; color: var(--text); background: var(--surface-3); border: 1px solid transparent; border-radius: 999px; transition: background-color .15s, border-color .15s, box-shadow .15s; }
.searchbox input::placeholder { color: var(--muted); }
.searchbox input:hover { background: var(--surface-2); border-color: var(--line); }
.searchbox input:focus { outline: none; background: var(--surface); border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 25%, transparent); }
.usermenu { position: relative; margin-left: auto; }
.usermenu summary, .menu summary { list-style: none; cursor: pointer; }
.usermenu summary::-webkit-details-marker, .menu summary::-webkit-details-marker { display: none; }
.usermenu summary { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem .25rem .25rem; border-radius: 999px; border: 1px solid transparent; transition: background-color .15s; }
.usermenu summary:hover, .usermenu[open] summary { background: var(--surface-2); border-color: var(--line); }
.usermenu .who { font-size: .875rem; font-weight: 600; max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel { position: absolute; z-index: 50; min-width: 15rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .5rem; }
.usermenu .panel { right: 0; top: calc(100% + .5rem); }
.panel-head { padding: .5rem .625rem .625rem; border-bottom: 1px solid var(--line); margin-bottom: .375rem; }
.panel-head strong { display: block; font-size: .9375rem; }
.panel-head span { display: block; font-size: .8125rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.menu-item { display: flex; width: 100%; align-items: center; gap: .6rem; padding: .5rem .625rem; border-radius: var(--radius-sm); color: var(--text); font: inherit; font-size: .9375rem; text-decoration: none; background: none; border: 0; cursor: pointer; text-align: left; white-space: nowrap; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); }
.menu-item.danger { color: var(--danger); }
.menu-sep { height: 1px; background: var(--line); margin: .375rem 0; }
.menu { position: relative; display: inline-block; }
.menu .panel { left: 0; top: calc(100% + .35rem); }
.menu.end .panel { left: auto; right: 0; }
.menu-form { padding: .5rem .625rem .625rem; display: grid; gap: .5rem; }
.menu-form .input { min-height: 2.25rem; }

.sidebar { grid-area: side; position: sticky; top: var(--topbar-h); align-self: start; height: calc(100vh - var(--topbar-h)); overflow-y: auto; padding: 1rem .75rem 1rem 1rem; display: flex; flex-direction: column; gap: 1rem; }
.sidenav { display: grid; gap: .125rem; }
.sidenav a { display: flex; align-items: center; gap: .75rem; padding: .55rem .75rem; border-radius: var(--radius-sm); color: var(--muted); font-weight: 560; font-size: .9375rem; text-decoration: none; transition: background-color .15s, color .15s; }
.sidenav a:hover { background: var(--surface-3); color: var(--text); }
.sidenav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.sidenav a[aria-current="page"] .icon { stroke-width: 2.1; }
.sidenav hr { border: 0; border-top: 1px solid var(--line); margin: .5rem .25rem; }
.sidenav .label { padding: .5rem .75rem .25rem; font-size: .6875rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0; }
.meter { margin-top: auto; padding: .875rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.meter-head { display: flex; align-items: center; gap: .5rem; font-size: .8125rem; font-weight: 650; margin-bottom: .6rem; }
.meter-bar { height: .5rem; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), #6fb1ff 55%, var(--gold)); min-width: 3px; }
.meter-fill.full { background: linear-gradient(90deg, var(--gold), var(--danger)); }
.meter-text { margin-top: .5rem; font-size: .8125rem; color: var(--muted); }
.w-0 { width: 0 } .w-1 { width: 1% } .w-2 { width: 2% } .w-3 { width: 3% } .w-4 { width: 4% } .w-5 { width: 5% }
.w-6 { width: 6% } .w-7 { width: 7% } .w-8 { width: 8% } .w-9 { width: 9% } .w-10 { width: 10% }
.w-11 { width: 11% } .w-12 { width: 12% } .w-13 { width: 13% } .w-14 { width: 14% } .w-15 { width: 15% }
.w-16 { width: 16% } .w-17 { width: 17% } .w-18 { width: 18% } .w-19 { width: 19% } .w-20 { width: 20% }
.w-21 { width: 21% } .w-22 { width: 22% } .w-23 { width: 23% } .w-24 { width: 24% } .w-25 { width: 25% }
.w-26 { width: 26% } .w-27 { width: 27% } .w-28 { width: 28% } .w-29 { width: 29% } .w-30 { width: 30% }
.w-31 { width: 31% } .w-32 { width: 32% } .w-33 { width: 33% } .w-34 { width: 34% } .w-35 { width: 35% }
.w-36 { width: 36% } .w-37 { width: 37% } .w-38 { width: 38% } .w-39 { width: 39% } .w-40 { width: 40% }
.w-41 { width: 41% } .w-42 { width: 42% } .w-43 { width: 43% } .w-44 { width: 44% } .w-45 { width: 45% }
.w-46 { width: 46% } .w-47 { width: 47% } .w-48 { width: 48% } .w-49 { width: 49% } .w-50 { width: 50% }
.w-51 { width: 51% } .w-52 { width: 52% } .w-53 { width: 53% } .w-54 { width: 54% } .w-55 { width: 55% }
.w-56 { width: 56% } .w-57 { width: 57% } .w-58 { width: 58% } .w-59 { width: 59% } .w-60 { width: 60% }
.w-61 { width: 61% } .w-62 { width: 62% } .w-63 { width: 63% } .w-64 { width: 64% } .w-65 { width: 65% }
.w-66 { width: 66% } .w-67 { width: 67% } .w-68 { width: 68% } .w-69 { width: 69% } .w-70 { width: 70% }
.w-71 { width: 71% } .w-72 { width: 72% } .w-73 { width: 73% } .w-74 { width: 74% } .w-75 { width: 75% }
.w-76 { width: 76% } .w-77 { width: 77% } .w-78 { width: 78% } .w-79 { width: 79% } .w-80 { width: 80% }
.w-81 { width: 81% } .w-82 { width: 82% } .w-83 { width: 83% } .w-84 { width: 84% } .w-85 { width: 85% }
.w-86 { width: 86% } .w-87 { width: 87% } .w-88 { width: 88% } .w-89 { width: 89% } .w-90 { width: 90% }
.w-91 { width: 91% } .w-92 { width: 92% } .w-93 { width: 93% } .w-94 { width: 94% } .w-95 { width: 95% }
.w-96 { width: 96% } .w-97 { width: 97% } .w-98 { width: 98% } .w-99 { width: 99% } .w-100 { width: 100% }

.content { grid-area: main; min-width: 0; padding: 1.5rem 1.75rem 4rem; }
.content-narrow { max-width: 62rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head .lead { color: var(--muted); margin-top: .25rem; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: .125rem .25rem; font-size: .875rem; color: var(--muted); margin-bottom: .375rem; }
.breadcrumb a { color: var(--muted); text-decoration: none; padding: .125rem .375rem; border-radius: 6px; }
.breadcrumb a:hover { background: var(--surface-3); color: var(--text); }
.breadcrumb .icon { width: .9rem; height: .9rem; opacity: .6; }
.tabs { display: flex; gap: .25rem; margin: 0 0 1.25rem; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { position: relative; display: inline-flex; align-items: center; gap: .4rem; padding: .7rem .875rem; color: var(--muted); font-weight: 560; font-size: .9375rem; text-decoration: none; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); }
.tabs a[aria-current="page"]::after { content: ""; position: absolute; left: .5rem; right: .5rem; bottom: -1px; height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
.tabbar { display: none; }
.toast-stack { position: fixed; z-index: 90; left: 50%; bottom: 1.25rem; transform: translateX(-50%); display: grid; gap: .5rem; width: min(26rem, calc(100vw - 2rem)); }
.toast { display: flex; gap: .6rem; align-items: center; padding: .75rem 1rem; border-radius: var(--radius-sm); background: var(--navy); color: #eef3ff; border: 1px solid #2a3a63; box-shadow: var(--shadow-lg); font-size: .9rem; animation: toast-in .2s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Files: toolbar, list, grid ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.seg a, .seg button { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; color: var(--muted); background: none; border: 0; cursor: pointer; text-decoration: none; }
.seg a:hover { background: var(--surface-3); color: var(--text); }
.seg a[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { min-height: 1.9rem; display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .75rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-size: .8125rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip[aria-current="true"] { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.ft { display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 9px; flex: none; background: var(--ft-bg); color: var(--ft-fg); }
.ft .icon { width: 1.2rem; height: 1.2rem; }
.ft-folder { --ft-bg: var(--ft-folder-bg); --ft-fg: var(--ft-folder-fg); } .ft-image { --ft-bg: var(--ft-image-bg); --ft-fg: var(--ft-image-fg); }
.ft-video { --ft-bg: var(--ft-video-bg); --ft-fg: var(--ft-video-fg); } .ft-audio { --ft-bg: var(--ft-audio-bg); --ft-fg: var(--ft-audio-fg); }
.ft-pdf { --ft-bg: var(--ft-pdf-bg); --ft-fg: var(--ft-pdf-fg); } .ft-doc { --ft-bg: var(--ft-doc-bg); --ft-fg: var(--ft-doc-fg); }
.ft-sheet { --ft-bg: var(--ft-sheet-bg); --ft-fg: var(--ft-sheet-fg); } .ft-slides { --ft-bg: var(--ft-slides-bg); --ft-fg: var(--ft-slides-fg); }
.ft-archive { --ft-bg: var(--ft-archive-bg); --ft-fg: var(--ft-archive-fg); } .ft-code { --ft-bg: var(--ft-code-bg); --ft-fg: var(--ft-code-fg); }
.ft-file { --ft-bg: var(--ft-file-bg); --ft-fg: var(--ft-file-fg); }
.ft-lg { width: 4rem; height: 4rem; border-radius: 14px; } .ft-lg .icon { width: 2rem; height: 2rem; }

/* ---------- Quill: sidebar extras ---------- */
.newmenu { position: relative; }
.newmenu summary { list-style: none; cursor: pointer; }
.newmenu summary::-webkit-details-marker { display: none; }
.btn-new { width: 100%; justify-content: flex-start; gap: .65rem; min-height: 3rem; font-size: 1rem; border-radius: 999px; padding-inline: 1.1rem; box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, .2); }
.newmenu .panel { left: 0; right: 0; top: calc(100% + .4rem); }
.newmenu .menu-item .ft { width: 1.9rem; height: 1.9rem; border-radius: 8px; }
.side-note { margin-top: auto; display: flex; gap: .6rem; align-items: flex-start; padding: .875rem; font-size: .8125rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.side-note .icon { margin-top: .1rem; color: var(--accent); }
.mono { font-family: var(--mono); font-size: .875em; }
.col-hide { }

/* ---------- Quill: home ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.start { margin-bottom: 2rem; padding: 1.25rem 1.25rem 1.5rem; border-radius: var(--radius-lg); border: 1px solid var(--line); background:
  radial-gradient(40rem 12rem at 0% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
  radial-gradient(30rem 12rem at 100% 100%, color-mix(in srgb, var(--gold) 10%, transparent), transparent 70%), var(--surface); box-shadow: var(--shadow-sm); }
.starters { display: flex; gap: 1rem; overflow-x: auto; padding: .25rem .25rem .5rem; scroll-snap-type: x proximity; scrollbar-width: thin; }
.starter { flex: none; scroll-snap-align: start; }
.starter-btn { display: grid; gap: .5rem; width: 9.5rem; padding: 0; background: none; border: 0; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.starter-btn:focus-visible { outline-offset: 4px; }
.starter-name { font-weight: 650; font-size: .9rem; line-height: 1.25; }
.starter-kind { font-size: .75rem; color: var(--muted); margin-top: -.35rem; }
.starter .thumb { height: 8.5rem; transition: transform .15s, box-shadow .15s, border-color .15s; }
.starter-btn:hover .thumb { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--accent); }

/* A document or spreadsheet drawn in CSS: no images, so it works in light and dark, and offline. */
.thumb { display: block; position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-sm); }
.thumb-doc { padding: .85rem .8rem; }
.thumb-doc i { display: block; height: .3rem; margin: 0 0 .42rem; border-radius: 3px; background: var(--line-strong); }
.thumb-doc i:nth-child(1) { width: 52%; height: .5rem; margin-bottom: .75rem; background: var(--ft-doc-fg); opacity: .85; }
.thumb-doc i:nth-child(2) { width: 100%; } .thumb-doc i:nth-child(3) { width: 94%; } .thumb-doc i:nth-child(4) { width: 98%; } .thumb-doc i:nth-child(5) { width: 62%; }
.thumb-doc.thumb-fancy i:nth-child(1) { background: linear-gradient(90deg, var(--accent), var(--gold)); }
.thumb-sheet { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1fr; grid-auto-rows: 1fr; gap: 0; background: var(--surface); }
.thumb-sheet i { display: block; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.thumb-sheet i:nth-child(-n+4) { background: var(--ft-sheet-bg); border-bottom-color: var(--line-strong); }
.thumb-sheet i:nth-child(4n+1):nth-child(n+5) { background: var(--surface-2); }
.thumb-sheet i:nth-child(4n) { border-right: 0; }
.thumb-sheet.thumb-fancy i:nth-child(6), .thumb-sheet.thumb-fancy i:nth-child(11) { background: color-mix(in srgb, var(--accent) 16%, transparent); }

.files-section .page-head h1 { font-size: 1.5rem; }
.fgrid { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); }
.fcard { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s, border-color .15s; }
.fcard:hover, .fcard:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.fcard-main { display: block; color: inherit; text-decoration: none; border-radius: var(--radius); }
.fcard .thumb { height: 9.5rem; border: 0; border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; box-shadow: none; background: var(--surface-2); margin: 0; }
.fcard .thumb-doc { padding: 1.1rem 1.6rem; }
.fcard-body { display: flex; align-items: center; gap: .75rem; padding: .75rem .85rem .85rem; min-width: 0; }
.fcard-text { display: grid; min-width: 0; padding-right: 1.6rem; }
.fcard-title { font-weight: 650; font-size: .9375rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcard-title .star { color: var(--gold); display: inline-flex; vertical-align: -.15em; }
.fcard-title .star .icon { width: .95rem; height: .95rem; fill: currentColor; }
.fcard-meta { font-size: .8125rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcard-menu { position: absolute; right: .35rem; bottom: .55rem; }
.fcard-menu .menu .panel { bottom: calc(100% + .25rem); top: auto; min-width: 14rem; }
.filemenu .menu-form { padding: .25rem .5rem .5rem; }

#files[data-view="list"] { grid-template-columns: 1fr; gap: .5rem; }
#files[data-view="list"] .fcard { display: flex; align-items: center; }
#files[data-view="list"] .fcard-main { display: flex; flex: 1; align-items: center; min-width: 0; }
#files[data-view="list"] .thumb { display: none; }
#files[data-view="list"] .fcard-body { flex: 1; padding: .6rem .85rem; }
#files[data-view="list"] .fcard-text { grid-template-columns: minmax(0, 1fr); }
#files[data-view="list"] .fcard-menu { position: static; padding-right: .5rem; }
#files[data-view="list"] .fcard-menu .menu .panel { bottom: auto; top: calc(100% + .25rem); }
#files[data-view="list"] .fcard:hover { transform: none; }

.seg button { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; color: var(--muted); background: none; border: 0; cursor: pointer; }
.seg button:hover { background: var(--surface-3); color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.empty { display: grid; justify-items: center; text-align: center; gap: .5rem; padding: 3rem 1rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--surface); }
.empty-art { display: grid; place-items: center; width: 4.5rem; height: 4.5rem; border-radius: 22px; color: var(--accent); background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--gold) 22%, transparent)); border: 1px solid var(--line); }
.empty-art .icon { width: 2.2rem; height: 2.2rem; }
.empty .form-actions { margin-top: 1rem; }

/* ---------- Quill: admin ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; padding: .6rem 1rem; font-size: .75rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: .6rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }
.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); margin: 0 0 1.25rem; }
.stat { display: flex; flex-direction: column; gap: .1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.125rem; box-shadow: var(--shadow-sm); }
.stat-n { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-l { font-size: .8125rem; color: var(--muted); font-weight: 550; }
body.auth .logo-hero { width: min(23rem, 100%); }

/* ---------- Small screens ---------- */
@media (max-width: 52rem) {
  body.app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; padding-bottom: 4.5rem; }
  .sidebar { display: none; }
  .topbar { gap: .5rem; padding: 0 .75rem; }
  .topbar .brand { width: auto; }
  .logo-nav { height: 2.4rem; }
  .usermenu .who { display: none; }
  .content { padding: 1rem .875rem 3rem; }
  .tabbar { position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: grid; justify-items: center; gap: .15rem; padding: .55rem .25rem .5rem; font-size: .6875rem; font-weight: 600; color: var(--muted); text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .tabbar .icon { width: 1.4rem; height: 1.4rem; }
  .toast-stack { bottom: 5rem; }
  .col-hide { display: none; }
}
@media (max-width: 40rem) {
  body { font-size: 16px; }
  h1 { font-size: 1.4rem; }
  .btn { min-height: 2.75rem; }
  .btn-sm { min-height: 2.25rem; }
  .input { min-height: 2.75rem; font-size: 1rem; }
  .auth-card { padding: 1.5rem 1.25rem; }
  .fgrid { grid-template-columns: repeat(2, 1fr); gap: .75rem; }
  .fcard .thumb { height: 7rem; }
  .fcard-body { padding: .6rem .6rem .7rem; gap: .5rem; }
  .fcard-body .ft { display: none; }
  .start { padding: 1rem .75rem 1.1rem; }
  .page-actions { width: 100%; }
  .searchbox { min-width: 0; }
  .chip { min-height: 2.25rem; }
}
@media (hover: none) { .fcard:hover { transform: none; } }

/* ---------- Accessibility preferences ---------- */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } .fcard:hover { transform: none; } }
@media (forced-colors: active) { .btn, .input, .card, .fcard, .auth-card, .alert, .badge, .thumb { border: 1px solid CanvasText; } .btn-primary { forced-color-adjust: none; background: Highlight; color: HighlightText; } }

/* Verified personal app grants; no remote assets or script required. */
.app-rail{height:24px;display:flex;align-items:center;gap:16px;padding:0 16px;overflow-x:auto;white-space:nowrap;background:var(--surface);color:var(--text);font-size:11px;border-bottom:1px solid var(--line);position:relative;z-index:60;box-sizing:border-box}
.app-rail a{color:inherit;text-decoration:none;flex:none}.app-rail a:hover,.app-rail a:focus-visible{text-decoration:underline}

body.app.has-app-rail{grid-template-rows:24px var(--topbar-h) 1fr;grid-template-areas:"rail rail" "top top" "side main"}
.app-rail{min-width:0;max-width:100%;overflow-y:hidden;grid-area:rail;position:sticky;top:0;flex:none;border-color:var(--line)}
.has-app-rail .topbar{top:24px}.has-app-rail .sidebar{top:calc(var(--topbar-h) + 24px);height:calc(100vh - var(--topbar-h) - 24px)}
.has-app-rail .ph-day{top:calc(var(--topbar-h) + 24px)}
@media(max-width:52rem){body.app.has-app-rail{grid-template-areas:"rail" "top" "main"}}
@media print{.app-rail{display:none!important}}
