/* Stash design system. 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: 3.1rem; 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 { 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; }

.files { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.files th { text-align: left; padding: .6rem .75rem; 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; }
.files th a { text-decoration: none; display: inline-flex; align-items: center; gap: .25rem; }
.files th a:hover { color: var(--text); }
.files td { padding: .5rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.files tbody tr:last-child td { border-bottom: 0; }
.files tbody tr { transition: background-color .1s; }
.files tbody tr:hover { background: var(--surface-2); }
.files tbody tr:has(.row-check:checked) { background: var(--accent-soft); }
.files .col-check { width: 2.5rem; padding-right: 0; }
.files .col-menu { width: 3rem; text-align: right; }
.files .col-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); }
.files .col-date { white-space: nowrap; color: var(--muted); }
.files .col-who { color: var(--muted); max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-cell { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.name-cell a { font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.name-cell a:hover { text-decoration: underline; }
.name-cell .star { color: var(--gold); fill: var(--gold); width: .95rem; height: .95rem; }
.name-cell .sub { display: block; font-size: .8125rem; color: var(--muted); font-weight: 400; }
.row-check { width: 1.125rem; height: 1.125rem; accent-color: var(--accent); cursor: pointer; }
.kebab { display: inline-grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 999px; color: var(--muted); border: 0; background: none; cursor: pointer; }
.kebab:hover, details[open] > .kebab { background: var(--surface-3); color: var(--text); }
.menu-wrap .panel { right: 0; left: auto; top: calc(100% + .25rem); }

.bulkbar { display: none; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .6rem .875rem; margin-bottom: 1rem; background: var(--navy); color: #eef3ff; border-radius: var(--radius); box-shadow: var(--shadow-md); position: sticky; top: calc(var(--topbar-h) + .5rem); z-index: 20; }
form:has(.row-check:checked) .bulkbar { display: flex; }
.bulkbar .btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.2); color: #eef3ff; box-shadow: none; }
.bulkbar .btn:hover { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.35); }
.bulkbar .btn-danger { background: #c4352a; border-color: #c4352a; color: #fff; }
.bulkbar .count { font-weight: 650; margin-right: .5rem; }

.section-title { margin: 1.25rem 0 .6rem; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.section-title:first-child { margin-top: 0; }
.cards { display: grid; gap: .875rem; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); }
.fcard { position: relative; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, transform .15s; }
.fcard:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.fcard:has(.row-check:checked) { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.fcard-thumb { display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--surface-2); border-bottom: 1px solid var(--line); overflow: hidden; text-decoration: none; }
.fcard-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fcard-foot { display: flex; align-items: center; gap: .5rem; padding: .55rem .5rem .55rem .75rem; min-width: 0; }
.fcard-foot a { flex: 1; min-width: 0; font-weight: 600; font-size: .875rem; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcard .pick { position: absolute; top: .5rem; left: .5rem; z-index: 2; width: 1.5rem; height: 1.5rem; display: grid; place-items: center; border-radius: 7px; background: color-mix(in srgb, var(--surface) 85%, transparent); border: 1px solid var(--line-strong); opacity: 0; transition: opacity .12s; }
.fcard:hover .pick, .fcard:focus-within .pick, .fcard:has(.row-check:checked) .pick { opacity: 1; }
.cards-folders { grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
.fcard-folder { flex-direction: row; align-items: center; }
.fcard-folder .fcard-foot { padding: .75rem; flex: 1; }
.empty { text-align: center; padding: 3.5rem 1.5rem; color: var(--muted); }
.empty .status-icon { margin-bottom: .75rem; }
.empty h2 { color: var(--text); margin-bottom: .25rem; }
.dropzone { position: fixed; inset: 0; z-index: 80; display: none; place-items: center; background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(6px); }
.dropzone.on { display: grid; }
.dropzone-box { display: grid; gap: .5rem; place-items: center; padding: 3rem 4rem; border: 2px dashed var(--accent); border-radius: var(--radius-lg); background: var(--surface); color: var(--accent); font-weight: 650; box-shadow: var(--shadow-lg); }
.dropzone-box .icon { width: 2.5rem; height: 2.5rem; }

/* upload panel */
.uploads { position: fixed; z-index: 70; right: 1.25rem; bottom: 1.25rem; width: min(24rem, calc(100vw - 2rem)); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); overflow: hidden; }
.uploads-head { display: flex; align-items: center; gap: .5rem; padding: .7rem .875rem; background: var(--navy); color: #eef3ff; font-weight: 650; font-size: .9rem; }
.uploads-head button { background: none; border: 0; color: inherit; cursor: pointer; display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 6px; }
.uploads-head button:hover { background: rgba(255,255,255,.14); }
.uploads-list { max-height: 15rem; overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.uploads-list li { padding: .6rem .875rem; border-bottom: 1px solid var(--line); font-size: .85rem; }
.uploads-list li:last-child { border-bottom: 0; }
.uploads-list .nm { display: flex; justify-content: space-between; gap: .75rem; }
.uploads-list .nm span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploads-list .st { color: var(--muted); white-space: nowrap; }
.uploads-list .st.ok { color: var(--success); } .uploads-list .st.bad { color: var(--danger); }
.progress { height: .3rem; background: var(--surface-3); border-radius: 999px; margin-top: .4rem; overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--gold)); transition: width .15s; }
.uploads.min .uploads-list { display: none; }

/* dialogs */
dialog { padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(28rem, calc(100vw - 2rem)); }
dialog::backdrop { background: rgba(5, 10, 24, .55); backdrop-filter: blur(3px); }
.dialog-form { padding: 1.5rem; }
.dialog-form h2 { font-size: 1.2rem; margin-bottom: 1rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.25rem; }

/* ---------- Photos ---------- */
.ph-day { position: sticky; top: var(--topbar-h); z-index: 5; display: flex; align-items: center; gap: .75rem; margin: 0 0 .5rem; padding: .6rem 0; font-size: .9375rem; font-weight: 650; background: linear-gradient(var(--bg) 70%, transparent); }
.ph-day small { color: var(--muted); font-weight: 500; }
.ph-grid { display: grid; gap: 4px; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); margin-bottom: 1.5rem; }
.ph-tile { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: var(--surface-3); }
.ph-tile a { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); text-decoration: none; }
.ph-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.ph-tile:hover img { transform: scale(1.04); }
.ph-tile .badge-v { position: absolute; right: .4rem; bottom: .4rem; display: inline-flex; align-items: center; gap: .2rem; padding: .1rem .45rem; border-radius: 999px; background: rgba(6, 12, 26, .72); color: #fff; font-size: .72rem; font-weight: 650; }
.ph-tile .badge-v .icon { width: .75rem; height: .75rem; fill: currentColor; }
.ph-tile .star-mark { position: absolute; left: .4rem; bottom: .4rem; color: var(--gold-light); fill: var(--gold-light); width: 1rem; height: 1rem; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.ph-tile .pick { position: absolute; top: .4rem; left: .4rem; width: 1.5rem; height: 1.5rem; display: grid; place-items: center; border-radius: 999px; background: rgba(6, 12, 26, .5); border: 1.5px solid rgba(255,255,255,.85); opacity: 0; transition: opacity .12s; }
.ph-tile:hover .pick, .ph-tile:focus-within .pick, .ph-tile:has(.row-check:checked) .pick { opacity: 1; }
.ph-tile:has(.row-check:checked) { outline: 3px solid var(--accent); outline-offset: -3px; }
.ph-tile:has(.row-check:checked) img { transform: scale(.92); border-radius: 6px; }
.pick .row-check { width: 100%; height: 100%; margin: 0; opacity: 0; position: absolute; inset: 0; }
.pick .icon { color: #fff; width: .9rem; height: .9rem; opacity: 0; }
.pick:has(.row-check:checked) { background: var(--accent); border-color: var(--accent); }
.pick:has(.row-check:checked) .icon { opacity: 1; color: var(--on-accent); }
.albums { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); }
.album-card { display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s, border-color .15s; }
.album-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--line-strong); }
.album-cover { display: grid; place-items: center; aspect-ratio: 4 / 3; background: linear-gradient(135deg, var(--surface-3), var(--surface-2)); color: var(--muted); }
.album-cover img { width: 100%; height: 100%; object-fit: cover; }
.album-card .meta { padding: .75rem .9rem; }
.album-card .meta strong { display: block; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-card .meta span { font-size: .8125rem; color: var(--muted); }
.more { display: flex; justify-content: center; margin: 1rem 0 2rem; }

/* lightbox */
.lb { position: fixed; inset: 0; z-index: 100; display: none; flex-direction: column; background: rgba(4, 8, 18, .96); color: #eef3ff; }
.lb.on { display: flex; }
.lb-top { display: flex; align-items: center; gap: .5rem; padding: .6rem .9rem; background: linear-gradient(rgba(0,0,0,.65), transparent); position: absolute; inset: 0 0 auto 0; z-index: 2; }
.lb-title { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-title small { display: block; font-weight: 400; color: #aab7d3; }
.lb button, .lb a.lb-btn { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 999px; background: rgba(255,255,255,.08); border: 0; color: #fff; cursor: pointer; text-decoration: none; }
.lb button:hover, .lb a.lb-btn:hover { background: rgba(255,255,255,.2); }
.lb .icon { width: 1.3rem; height: 1.3rem; }
.lb-stage { flex: 1; display: grid; place-items: center; padding: 3.5rem 4rem; min-height: 0; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; }
.lb-prev { left: .9rem; } .lb-next { right: .9rem; }
.lb-star.on .icon { fill: var(--gold-light); color: var(--gold-light); }
.lb-count { color: #aab7d3; font-size: .85rem; margin-right: .5rem; }

/* ---------- File page ---------- */
.file-layout { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr) 21rem; align-items: start; }
.preview { display: grid; place-items: center; min-height: 14rem; padding: 1rem; background: var(--surface-2); border-radius: var(--radius); overflow: hidden; }
.preview img, .preview video { max-width: 100%; max-height: 72vh; border-radius: 6px; }
.preview audio { width: 100%; }
.preview iframe { width: 100%; height: 72vh; border: 0; border-radius: 6px; background: #fff; }
.preview pre { margin: 0; width: 100%; max-height: 72vh; overflow: auto; padding: 1rem 1.25rem; background: var(--surface); border-radius: 6px; border: 1px solid var(--line); font: .8125rem/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; }
.preview .none { display: grid; gap: .75rem; place-items: center; padding: 3rem 1rem; color: var(--muted); text-align: center; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .5rem 1.25rem; margin: 0; font-size: .9rem; }
.kv dt { color: var(--muted); font-weight: 550; }
.kv dd { margin: 0; word-break: break-word; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain > li { display: flex; align-items: center; gap: .75rem; padding: .65rem 1.25rem; border-bottom: 1px solid var(--line); font-size: .9rem; }
.list-plain > li:last-child { border-bottom: 0; }
.list-plain .grow { flex: 1; min-width: 0; }
.list-plain .grow > strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-plain .grow > span { display: block; font-size: .8125rem; color: var(--muted); }
.secret { display: block; font-family: var(--mono); font-size: .8125rem; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: .75rem 1rem; overflow-x: auto; word-break: break-all; user-select: all; margin: 0; }
.secret-once { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 9%, var(--surface)); }
.paircode { font-family: var(--mono); font-size: 2rem; font-weight: 700; letter-spacing: .12em; text-align: center; padding: 1.25rem; border-radius: var(--radius); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), color-mix(in srgb, var(--gold) 12%, var(--surface))); border: 1px solid var(--line-strong); user-select: all; }

/* ---------- Tables (admin etc.) ---------- */
.table-wrap { overflow-x: auto; position: relative; }
.table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.table th { text-align: left; padding: .6rem 1.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; }
.table td { padding: .7rem 1.1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .nowrap { white-space: nowrap; }
.table tr.is-off td { color: var(--muted); }
.cell-user { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.cell-user strong { display: block; font-weight: 600; }
.cell-user span { display: block; font-size: .8125rem; color: var(--muted); }
.stats { list-style: none; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); margin: 0 0 1.25rem; }
.stat { display: flex; align-items: center; gap: .875rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.125rem; box-shadow: var(--shadow-sm); }
.stat-icon { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); flex: none; }
.stat-label { display: block; font-size: .8125rem; color: var(--muted); font-weight: 550; }
.stat-value { display: block; font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat.alert .stat-icon { color: var(--danger); background: var(--danger-bg); }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; gap: .75rem; align-items: flex-start; padding: .75rem 1.25rem; border-bottom: 1px solid var(--line); font-size: .9375rem; }
.checks li:last-child { border-bottom: 0; }
.checks li .icon { margin-top: .15rem; }
.checks li.ok .icon { color: var(--success); }
.checks li.warn { background: var(--warn-bg); } .checks li.warn .icon { color: var(--warn); }
.checks li.info .icon { color: var(--info); }
.device { display: flex; align-items: center; gap: 1rem; }
.device-icon { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 12px; background: var(--accent-soft); color: var(--accent); flex: none; }

/* ---------- Public pages ---------- */
body.public { background: var(--bg); }
.pub-top { display: flex; align-items: center; gap: 1rem; padding: .75rem 1.25rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.pub-top .grow { flex: 1; font-size: .875rem; color: var(--muted); }
.pub-main { max-width: 62rem; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }
.pub-foot { text-align: center; padding: 2rem 1rem; font-size: .8125rem; color: var(--muted); }

.pub-card { max-width: 30rem; margin: 3rem auto; }
.mb { margin-bottom: 1rem; }
.form-actions.center { justify-content: center; }
body.noscroll { overflow: hidden; }
.spacer { flex: 1; }

/* ---------- Small screens ---------- */
@media (max-width: 60rem) {
  .file-layout { grid-template-columns: 1fr; }
}
@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.6rem; }
  .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; }
  .uploads { bottom: 5rem; right: .75rem; }
  .col-who, .col-date-hide { display: none; }
  .lb-stage { padding: 3.5rem .5rem; }
  .lb-nav { 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; }
  .files .col-size { display: none; }
  .js-hide-sm { display: none; }
  .ph-grid { grid-template-columns: repeat(3, 1fr); gap: 2px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: 1fr 1fr; gap: .75rem; }
  .kv { grid-template-columns: 1fr; gap: .125rem; } .kv dd { margin-bottom: .6rem; }
  .page-actions { width: 100%; }
  .paircode { font-size: 1.5rem; }
  .searchbox { min-width: 0; }
}
@media (hover: none) {
  .fcard .pick, .ph-tile .pick { opacity: 1; }
}

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