/* web-mo on Cobalt: the app-shell and pages of discordrive (MainLayout, AuthCard, Dashboard, FileTable,
 * UploadProgress, Settings, NotificationToasts), rebuilt without React/Tailwind. Values = the Tailwind
 * classes discordrive uses (comments name them), so the two apps look the same. Tokens: tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; font-size: 1rem; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--color-muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.label-mono { font: 500 .6875rem/1rem var(--font-mono); text-transform: uppercase; letter-spacing: .025em; color: var(--color-muted); }

/* ── controls ─────────────────────────────── */
/* primary: rounded-md bg-accent px-4 py-2 text-sm font-medium text-accent-ink hover:bg-accent-hover */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .375rem;
  padding: .5rem .75rem; border-radius: var(--radius-input); border: 1px solid var(--color-rule-2);
  background: var(--color-paper); color: var(--color-ink-2); font: 500 .875rem/1.25rem var(--font-body);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color var(--duration-short) var(--ease-out), color var(--duration-short) var(--ease-out), border-color var(--duration-short) var(--ease-out);
}
.btn:hover { background: var(--color-paper-2); color: var(--color-ink); }
.btn.primary { padding: .5rem 1rem; border-color: var(--color-accent); background: var(--color-accent); color: var(--color-accent-ink); }
.btn.primary:hover { border-color: var(--color-accent-hover); background: var(--color-accent-hover); }
.btn.primary:active { transform: translateY(1px); }
.btn.danger { border-color: color-mix(in oklch, var(--color-error) 50%, transparent); color: var(--color-error); }
.btn.danger:hover { background: color-mix(in oklch, var(--color-error) 10%, transparent); }
.btn:disabled, .btn[aria-disabled="true"] { cursor: not-allowed; opacity: .5; }
.btn[aria-busy="true"] { cursor: progress; opacity: .65; }
.btn.block { width: 100%; height: 2.75rem; }
.btn.tall { height: 2.75rem; }
.btn svg.i { width: 16px; height: 16px; }
/* IconButton: rounded-md p-2, icon 15 */
.iconbtn {
  display: inline-grid; place-items: center; padding: .5rem; border: 0; border-radius: var(--radius-input);
  background: transparent; color: var(--color-muted); cursor: pointer; transition: background-color var(--duration-short) var(--ease-out), color var(--duration-short) var(--ease-out);
}
.iconbtn svg.i { width: 15px; height: 15px; }
.iconbtn:hover { background: var(--color-paper-2); color: var(--color-ink); }
.iconbtn.accent { color: var(--color-accent); }
.iconbtn.accent:hover { background: color-mix(in oklch, var(--color-accent) 10%, transparent); color: var(--color-accent); }
.iconbtn.danger { color: var(--color-error); }
.iconbtn.danger:hover { background: color-mix(in oklch, var(--color-error) 10%, transparent); }
.iconbtn[aria-busy="true"] { cursor: progress; opacity: .6; }
.link { color: var(--color-accent); font-weight: 500; text-decoration: none; text-underline-offset: 2px; background: none; border: 0; padding: 0; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* authInputClass / authLabelClass */
.field { display: block; }
.field > .lab { display: block; margin-bottom: .375rem; font-size: .875rem; line-height: 1.25rem; font-weight: 500; color: var(--color-ink-2); }
.input, .codebox {
  width: 100%; height: 2.75rem; padding: 0 .75rem; border-radius: var(--radius-input); border: 1px solid var(--color-rule-2);
  background: var(--color-paper); color: var(--color-ink); font: 400 .875rem/1.25rem var(--font-body);
  outline: 2px solid transparent; outline-offset: 1px; transition: background-color var(--duration-short) var(--ease-out), outline-color var(--duration-short) var(--ease-out);
}
.input::placeholder, .codebox::placeholder { color: var(--color-muted); }
.input:hover, .codebox:hover { background: var(--color-paper-2); }
.input:focus, .codebox:focus, .input:focus-visible, .codebox:focus-visible { background: var(--color-paper); outline: 2px solid var(--color-focus); outline-offset: 1px; border-radius: var(--radius-input); }
.codebox { height: auto; min-height: 5.25rem; padding: .625rem .75rem; resize: vertical; font: 400 .75rem/1.5 var(--font-mono); word-break: break-all; background: var(--color-paper-2); }
.hint { display: block; margin-top: .375rem; font-size: .75rem; line-height: 1rem; color: var(--color-muted); }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.row-btns { display: flex; flex-wrap: wrap; gap: .5rem; }
.inline { display: flex; gap: .5rem; align-items: flex-end; }
.inline .field { flex: 1; min-width: 0; }
.error-text { font-size: .875rem; color: var(--color-error); }

/* notes: hairline box, left rule in a tone (the toast language of discordrive) */
.note { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .625rem; padding: .75rem 1rem; border: 1px solid var(--color-rule); border-left: 2px solid var(--color-accent); border-radius: var(--radius-card); font-size: .8125rem; line-height: 1.5; color: var(--color-ink-2); }
.note svg.i { margin-top: 2px; color: var(--color-accent); }
.note.warn { border-left-color: var(--color-warning); }
.note.warn svg.i { color: color-mix(in oklch, var(--color-warning) 70%, var(--color-ink)); }
.note strong, .note b { color: var(--color-ink); font-weight: 600; }

/* ColorModeToggle: inline-flex gap-0.5 rounded-md border border-rule-2 p-0.5; buttons h-7 w-7 rounded */
.modes { display: inline-flex; align-items: center; gap: .125rem; padding: .125rem; border: 1px solid var(--color-rule-2); border-radius: var(--radius-input); }
.modes button { display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; border: 0; border-radius: .25rem; background: none; color: var(--color-muted); cursor: pointer; transition: color var(--duration-micro) var(--ease-out); }
.modes button svg.i { width: 14px; height: 14px; stroke-width: 1.75; }
.modes button:hover { color: var(--color-ink-2); }
.modes button[aria-checked="true"] { background: var(--color-paper-2); color: var(--color-accent); }
/* EN/PL in the same frame */
.langs { display: inline-flex; gap: .125rem; padding: .125rem; border: 1px solid var(--color-rule-2); border-radius: var(--radius-input); }
.langs button { height: 1.75rem; min-width: 1.75rem; padding: 0 .375rem; border: 0; border-radius: .25rem; background: none; color: var(--color-muted); font: 500 .6875rem/1 var(--font-mono); letter-spacing: .06em; cursor: pointer; }
.langs button:hover { color: var(--color-ink-2); }
.langs button[aria-pressed="true"] { background: var(--color-paper-2); color: var(--color-accent); }
/* Settings → Appearance: rounded-md border px-4 py-2 text-sm font-medium; active border-accent bg-paper-2 text-ink */
.choice { display: flex; flex-wrap: wrap; gap: .5rem; }
.choice button { padding: .5rem 1rem; border: 1px solid var(--color-rule-2); border-radius: var(--radius-input); background: none; color: var(--color-ink-2); font: 500 .875rem/1.25rem var(--font-body); cursor: pointer; transition: background-color var(--duration-short) var(--ease-out); }
.choice button:hover { background: var(--color-paper-2); color: var(--color-ink); }
.choice button[aria-checked="true"], .choice button[aria-pressed="true"] { border-color: var(--color-accent); background: var(--color-paper-2); color: var(--color-ink); }

/* ── auth pages (AuthCard) ─────────────────── */
.auth { position: relative; display: flex; min-height: 100dvh; align-items: center; justify-content: center; padding: 2rem 1rem; background: var(--color-paper); }
.auth-tools { position: absolute; top: 1rem; right: 1rem; display: flex; gap: .5rem; }
@media (max-width: 767.98px) {
  /* Phone: the switches sit above the card instead of over it. */
  .auth { flex-direction: column; justify-content: flex-start; gap: 1rem; padding-top: 1rem; }
  .auth-tools { position: static; align-self: flex-end; }
}
.auth-card { width: 100%; max-width: 28rem; padding: 1.5rem; border: 1px solid var(--color-rule); border-radius: var(--radius-card); background: var(--color-paper); }
.auth-card.wide { max-width: 42rem; }
.auth-card > h1 { font: 600 1.5rem/2rem var(--font-display); color: var(--color-ink); }
.auth-card > .sub { margin-top: .25rem; font-size: .875rem; line-height: 1.25rem; color: var(--color-muted); }
.auth-body { margin-top: 1.5rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.auth-foot { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--color-rule); text-align: center; font-size: .875rem; color: var(--color-muted); display: grid; gap: .5rem; justify-items: center; }
.auth-foot .row-btns { justify-content: center; }
.wordmark { display: flex; align-items: center; gap: .625rem; }
.logo { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; flex: none; border-radius: var(--radius-input); background: var(--color-accent); color: var(--color-accent-ink); font: 600 13px/1 var(--font-display); }
.wordmark b { font: 600 1.125rem/1.75rem var(--font-display); color: var(--color-ink); }
.auth .wordmark { margin-bottom: 1.25rem; }
.qr { justify-self: center; display: grid; place-items: center; padding: .75rem; border: 1px solid var(--color-rule); border-radius: var(--radius-card); background: #fff; }
.qr svg { display: block; width: min(220px, 60vw); height: auto; }
.sas { display: grid; gap: .5rem; justify-items: center; padding: 1rem; border-radius: var(--radius-input); background: var(--color-paper-2); text-align: center; }
.sas-code { font: 500 2.25rem/1 var(--font-mono); letter-spacing: .22em; padding-left: .22em; color: var(--color-ink); font-variant-numeric: tabular-nums; }
.bar { height: .375rem; overflow: hidden; border-radius: 9999px; background: var(--color-paper-3); }
.bar > i { display: block; height: 100%; width: 0; border-radius: 9999px; background: var(--color-accent); transition: width var(--duration-short) var(--ease-out); }
.bar > i.done { background: var(--color-success); }
.bar > i.err { background: var(--color-error); }
.filecard { display: grid; gap: .25rem; }
.filecard b { font-weight: 500; color: var(--color-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filecard span { font: 400 .75rem/1rem var(--font-mono); color: var(--color-muted); }

/* onboarding (first run): steps as mono chips */
.steps { display: flex; flex-wrap: wrap; gap: .375rem; margin-bottom: 1rem; }
.steps .chip[aria-current="step"] { border-color: color-mix(in oklch, var(--color-accent) 40%, transparent); color: var(--color-accent); }
.steps .chip.done { border-color: color-mix(in oklch, var(--color-success) 40%, transparent); color: var(--color-success); }

/* ── app shell (MainLayout) ───────────────── */
.shell { min-height: 100dvh; background: var(--color-paper); color: var(--color-ink-2); }
.sidebar { display: flex; flex-direction: column; width: 16rem; flex: none; border-right: 1px solid var(--color-rule); background: var(--color-paper); }
.side-h { display: flex; align-items: center; justify-content: space-between; gap: .625rem; flex: none; padding: 1rem; border-bottom: 1px solid var(--color-rule); }
.nav { flex: 1; min-height: 0; overflow-y: auto; padding: .75rem; display: grid; align-content: start; gap: .125rem; }
.nav a { display: flex; align-items: center; gap: .75rem; padding: .625rem .75rem; border-radius: var(--radius-input); font-size: .875rem; line-height: 1.25rem; font-weight: 500; color: var(--color-ink-2); text-decoration: none; transition: background-color var(--duration-short) var(--ease-out), color var(--duration-short) var(--ease-out); }
.nav a svg.i { width: 17px; height: 17px; stroke-width: 1.75; color: var(--color-muted); }
.nav a:hover { background: var(--color-paper-2); color: var(--color-ink); }
.nav a[aria-current="page"] { background: var(--color-paper-2); color: var(--color-ink); }
.nav a[aria-current="page"] svg.i { color: var(--color-accent); }
.side-f { margin-top: auto; flex: none; padding: 1rem; border-top: 1px solid var(--color-rule); display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; }
.side-f .me { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.side-f .me p { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 .75rem/1rem var(--font-mono); color: var(--color-muted); }
.side-f .tools { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.topbar { position: sticky; top: 0; z-index: var(--z-sticky); display: flex; height: 3.5rem; align-items: center; justify-content: space-between; padding: 0 1rem; border-bottom: 1px solid var(--color-rule); background: var(--color-paper); }
.topbar b { font: 600 1rem/1.5rem var(--font-display); color: var(--color-ink); }
.topbar .iconbtn, .side-h .iconbtn { width: 2.5rem; height: 2.5rem; color: var(--color-ink-2); }
.topbar .iconbtn svg.i, .side-h .iconbtn svg.i { width: 20px; height: 20px; stroke-width: 1.75; }
.scrim { position: fixed; inset: 0; z-index: var(--z-modal); background: color-mix(in oklch, var(--color-ink) 40%, transparent); opacity: 0; pointer-events: none; transition: opacity var(--duration-short) var(--ease-out); }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page { flex: 1; padding: 1rem; }
.page.narrow { max-width: 42rem; }

@media (min-width: 768px) {
  .shell { display: flex; }
  .topbar, .scrim, .side-h [data-ddn-ui="nav-close"] { display: none; }
  .sidebar { position: sticky; top: 0; height: 100dvh; }
  .page { padding: 1.5rem; }
  .auth-card { padding: 2rem; }
}
@media (max-width: 767.98px) {
  /* MobileDrawer: fixed, w-72 max-w-[85vw], slides in from the left over a bg-ink/40 scrim */
  .sidebar { position: fixed; top: 0; left: 0; z-index: calc(var(--z-modal) + 1); height: 100%; width: 18rem; max-width: 85vw; transform: translateX(-100%); visibility: hidden; transition: transform var(--duration-short) var(--ease-out), visibility 0s linear var(--duration-short); box-shadow: 0 1px 2px oklch(24% 0.02 258 / 0.08); }
  .shell[data-drawer="open"] .sidebar { transform: none; visibility: visible; transition: transform var(--duration-short) var(--ease-out); }
  .shell[data-drawer="open"] .scrim { opacity: 1; pointer-events: auto; }
  .side-h .wordmark .logo { display: none; }
}

/* ── Files (Dashboard) ────────────────────── */
.files-h { display: flex; flex-direction: column; gap: .75rem; margin-bottom: 1.5rem; }
.files-h .titles { display: flex; min-width: 0; flex-direction: column; gap: .5rem; }
.crumbs { display: flex; align-items: center; gap: .25rem; min-width: 0; font-size: .875rem; line-height: 1.25rem; }
.crumbs a { color: var(--color-muted); text-decoration: none; max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs a:hover { color: var(--color-ink); }
.crumbs [aria-current="page"] { max-width: 20ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--color-ink); }
.crumbs svg.i { width: 14px; height: 14px; color: var(--color-muted); }
.crumbs .back { display: none; align-items: center; gap: .25rem; }
.files-h h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 600 var(--text-display)/1.1 var(--font-display); letter-spacing: -.02em; color: var(--color-ink); }
.files-h .meta { margin-top: .25rem; font: 400 .75rem/1rem var(--font-mono); color: var(--color-muted); font-variant-numeric: tabular-nums; }
.files-h .acts { display: flex; width: 100%; gap: .5rem; }
.upload-btn { position: relative; overflow: hidden; }
.upload-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.upload-btn:focus-within { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.upload-btn[aria-disabled="true"] input { cursor: not-allowed; }
.dropzone { display: none; margin-bottom: 1rem; padding: 1.25rem; border: 2px dashed var(--color-rule); border-radius: var(--radius-card); text-align: center; font-size: .875rem; color: var(--color-muted); cursor: pointer; transition: border-color var(--duration-short) var(--ease-out), background-color var(--duration-short) var(--ease-out), color var(--duration-short) var(--ease-out); }
.dropzone svg.i { display: block; width: 18px; height: 18px; margin: 0 auto .375rem; opacity: .6; }
.dropzone:hover { border-color: var(--color-rule-2); }
.dropzone.over { border-color: var(--color-accent); background: color-mix(in oklch, var(--color-accent) 10%, transparent); color: var(--color-accent); }
.need-channel { margin-bottom: 1rem; }
@media (min-width: 768px) {
  .files-h { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .files-h .acts { width: auto; justify-content: flex-end; }
  .dropzone { display: block; }
}
@media (max-width: 767.98px) {
  .files-h .acts .upload-btn { flex: 1; padding-top: .75rem; padding-bottom: .75rem; }
  .files-h .acts .btn { padding-top: .75rem; padding-bottom: .75rem; }
  .files-h .acts .btn .lbl-md { display: none; }
  .crumbs .desk { display: none; }
  .crumbs .back { display: inline-flex; }
}

/* UploadProgress */
.uploads { margin-bottom: 1.5rem; overflow: hidden; border: 1px solid var(--color-rule); border-radius: var(--radius-card); background: var(--color-paper); }
.uploads-h { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 1rem; }
.uploads-h .t b { display: block; font-size: .875rem; line-height: 1.25rem; font-weight: 500; color: var(--color-ink); }
.uploads-h .t span { display: block; font-size: .75rem; line-height: 1rem; color: var(--color-muted); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.uploads-h .iconbtn svg.i { width: 18px; height: 18px; }
.qlist { list-style: none; margin: 0; padding: .75rem; display: grid; gap: .5rem; border-top: 1px solid var(--color-rule); max-height: 22rem; overflow: auto; }
.qlist li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem .75rem; padding: .75rem; border-radius: var(--radius-input); background: var(--color-paper-2); font-size: .875rem; line-height: 1.25rem; }
.qlist .qname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-ink); }
.qstate { color: var(--color-muted); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.qstate.done { color: var(--color-success); }
.qstate.err { color: var(--color-error); }
.qlist .bar { grid-column: 1 / -1; }
.qlist .qfoot { grid-column: 1 / -1; font: 400 .75rem/1rem var(--font-mono); color: var(--color-muted); font-variant-numeric: tabular-nums; }
.uploads > .hint { margin: 0; padding: 0 1rem .75rem; }

/* FileTable */
.ftable-wrap { overflow: hidden; border: 1px solid var(--color-rule); border-radius: var(--radius-card); background: var(--color-paper); }
.ftable { width: 100%; border-collapse: collapse; }
.ftable th { padding: .75rem 1rem; text-align: left; font: 500 .75rem/1rem var(--font-mono); text-transform: uppercase; letter-spacing: .025em; color: var(--color-muted); border-bottom: 1px solid var(--color-rule); }
.ftable th.r, .ftable td.size { text-align: right; }
.ftable td { padding: .75rem 1rem; border-bottom: 1px solid var(--color-rule); vertical-align: middle; }
.ftable tbody tr:last-child td { border-bottom: 0; }
.ftable tbody tr { transition: background-color var(--duration-short) var(--ease-out); }
.ftable tbody tr:hover { background: var(--color-paper-2); }
.ftable .c-name { color: var(--color-ink); max-width: 0; width: 100%; }
.ftable .c-name .nm { display: inline-flex; align-items: center; gap: .625rem; max-width: 100%; min-width: 0; vertical-align: middle; }
.ftable .c-name .nm > span:last-child, .ftable .c-name a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ftable .c-name a { color: var(--color-ink); text-decoration: none; }
.ftable .c-name a:hover { text-decoration: underline; text-underline-offset: 3px; }
.ftable .c-name svg.i { color: var(--color-muted); }
.ftable td.size, .ftable td.c-date { font-size: .875rem; color: var(--color-muted); font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ftable td.c-acts { white-space: nowrap; text-align: right; padding-top: .5rem; padding-bottom: .5rem; }
.ftable .acts { display: inline-flex; justify-content: flex-end; gap: .25rem; }
.ftable .sub { display: none; font: 400 .75rem/1rem var(--font-mono); color: var(--color-muted); }
/* type badge: rounded-chip border px-1.5 py-0.5 font-mono text-[10px] font-semibold uppercase tracking-wide */
.badge { flex: none; padding: .125rem .375rem; border: 1px solid currentColor; border-radius: var(--radius-chip); font: 600 10px/14px var(--font-mono); text-transform: uppercase; letter-spacing: .025em; color: var(--color-ink); }
.badge.media { border-color: color-mix(in oklch, var(--color-accent) 40%, transparent); color: var(--color-accent); }
.badge.doc { border-color: color-mix(in oklch, var(--color-error) 40%, transparent); color: var(--color-error); }
.badge.sheet { border-color: color-mix(in oklch, var(--color-success) 40%, transparent); color: var(--color-success); }
.badge.archive { border-color: color-mix(in oklch, var(--color-warning) 40%, transparent); color: var(--color-warning); }
.empty { padding: 4rem 1rem; text-align: center; font-size: .875rem; color: var(--color-muted); display: grid; justify-items: center; }
.empty .ic { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; margin-bottom: .75rem; border-radius: 9999px; background: var(--color-paper-2); color: var(--color-muted); }
.empty .ic svg.i { width: 20px; height: 20px; }
.empty b { display: block; margin-bottom: .25rem; font-size: 1rem; font-weight: 500; color: var(--color-ink-2); }
.pager { display: flex; align-items: center; justify-content: center; gap: .75rem; margin-top: .75rem; font: 400 .875rem/1.25rem var(--font-mono); color: var(--color-muted); font-variant-numeric: tabular-nums; }
.pager .iconbtn svg.i { width: 18px; height: 18px; }
.pager .iconbtn:disabled { cursor: not-allowed; opacity: .3; }
@media (max-width: 767.98px) {
  /* Phone: FileCard / FolderCard (space-y-3, rounded-card border border-rule bg-paper p-4) instead of a table */
  .ftable-wrap { overflow: visible; border: 0; border-radius: 0; background: none; }
  .ftable, .ftable tbody { display: block; }
  .ftable tbody { display: grid; gap: .75rem; }
  .ftable thead { display: none; }
  .ftable tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border: 1px solid var(--color-rule); border-radius: var(--radius-card); background: var(--color-paper); }
  .ftable tbody tr:hover { border-color: var(--color-rule-2); background: var(--color-paper-2); }
  .ftable td { border-bottom: 0; padding: 1rem .5rem 1rem 1rem; }
  /* card body: type tile on the left over two lines, name + meta on the right (FileCard / FolderCard) */
  .ftable td.c-name { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: .75rem; align-items: center; }
  .ftable .c-name .nm { display: contents; }
  .ftable .c-name .nm > :first-child { grid-row: span 2; align-self: start; }
  .ftable .c-name a, .ftable .c-name .nm > span:last-child { grid-column: 2; font-size: .875rem; line-height: 1.25rem; font-weight: 500; }
  .ftable .c-name .sub { grid-column: 2; margin-top: .25rem; }
  /* FolderCard: rounded-md bg-paper-2 p-2 text-ink-2, icon 18 */
  .ftable .c-name .nm > svg.i { box-sizing: content-box; width: 18px; height: 18px; padding: .5rem; border-radius: var(--radius-input); background: var(--color-paper-2); color: var(--color-ink-2); }
  /* FileCard: rounded-md bg-paper-2 px-3 py-2 font-mono text-xs font-semibold uppercase tracking-wide text-ink-2 */
  .ftable .c-name .nm > .badge { min-width: 3.25rem; padding: .5rem .5rem; border: 0; border-radius: var(--radius-input); background: var(--color-paper-2); color: var(--color-ink-2); font-size: .6875rem; line-height: 1rem; text-align: center; }
  .ftable-wrap .empty { border: 1px dashed var(--color-rule); border-radius: var(--radius-card); background: var(--color-paper); padding: 2.5rem 1rem; }
  .ftable td.size, .ftable td.c-date { display: none; }
  .ftable .c-name { max-width: none; }
  .ftable .sub { display: block; margin-top: .125rem; }
  .ftable td.c-acts { padding-right: .75rem; }
}

/* ── Settings / Devices (spec sheets) ─────── */
.page-title { margin-bottom: 2rem; font: 600 1.5rem/2rem var(--font-display); color: var(--color-ink); }
/* Single-column grids get minmax(0, 1fr): an auto track grows to the widest nowrap row (device list on a phone)
 * and pushes the whole page past the screen edge. */
.sections { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; }
.sections > section { min-width: 0; }
.sections > section + section { padding-top: 2rem; border-top: 1px solid var(--color-rule); }
.sec-h { margin-bottom: .25rem; font: 600 1.125rem/1.75rem var(--font-body); color: var(--color-ink); display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.sec-h .chip { font-weight: 500; }
.sec-lead { margin-bottom: 1rem; font-size: .875rem; line-height: 1.25rem; color: var(--color-muted); }
.sec-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
/* channel slots: 4 hairline segments, filled ones in accent */
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: .25rem; }
.slots i { height: .375rem; border-radius: 9999px; background: var(--color-paper-3); }
.slots i.on { background: var(--color-accent); }
.slots-legend { display: flex; justify-content: space-between; margin-top: -.5rem; }
.list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--color-rule); border-radius: var(--radius-card); overflow: hidden; }
.list li { display: flex; align-items: center; gap: .75rem; min-height: 3rem; padding: .5rem .5rem .5rem 1rem; border-bottom: 1px solid var(--color-rule); font-size: .875rem; }
.list li:last-child { border-bottom: 0; }
.list li > svg.i { color: var(--color-muted); }
.list li .dname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-ink); font-weight: 500; }
.list li .when { margin-left: auto; white-space: nowrap; font: 400 .75rem/1rem var(--font-mono); color: var(--color-muted); font-variant-numeric: tabular-nums; }
.list li.empty-row { color: var(--color-muted); padding-right: 1rem; }
.advice { font-size: .875rem; line-height: 1.25rem; color: var(--color-ink-2); }
.advice.need { color: color-mix(in oklch, var(--color-warning) 70%, var(--color-ink)); }
details.howto > summary { cursor: pointer; font-size: .875rem; font-weight: 500; color: var(--color-accent); list-style: none; display: inline-flex; align-items: center; gap: .375rem; }
details.howto > summary::-webkit-details-marker { display: none; }
details.howto > summary svg.i { transition: transform var(--duration-short) var(--ease-out); }
details.howto[open] > summary svg.i { transform: rotate(90deg); }
.guide { counter-reset: g; list-style: none; margin: .75rem 0 0; padding: 0; display: grid; border: 1px solid var(--color-rule); border-radius: var(--radius-card); font-size: .875rem; line-height: 1.6; color: var(--color-ink-2); }
.guide li { counter-increment: g; position: relative; padding: .875rem 1rem .875rem 3rem; border-bottom: 1px solid var(--color-rule); }
.guide li:last-child { border-bottom: 0; }
.guide li::before { content: counter(g); position: absolute; left: 1rem; top: .875rem; width: 1.375rem; height: 1.375rem; display: grid; place-items: center; border: 1px solid var(--color-rule-2); border-radius: var(--radius-chip); font: 500 .6875rem/1 var(--font-mono); color: var(--color-muted); }
.guide li > b:first-child { display: block; color: var(--color-ink); font-weight: 600; }
.guide b { font-weight: 600; color: var(--color-ink); }
.guide-foot { margin-top: .5rem; }
.about { display: grid; border: 1px solid var(--color-rule); border-radius: var(--radius-card); overflow: hidden; }
.about > div { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: .25rem 1rem; padding: .75rem 1rem; border-bottom: 1px solid var(--color-rule); font-size: .875rem; line-height: 1.25rem; }
.about > div:last-child { border-bottom: 0; }
.about dt { padding-top: .125rem; }
.about dd { margin: 0; display: grid; gap: .25rem; justify-items: start; }
.about dd p { color: var(--color-muted); font-size: .8125rem; }
.about dd .val { color: var(--color-ink); overflow-wrap: anywhere; }
.limits { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; font-size: .875rem; line-height: 1.25rem; color: var(--color-muted); }
.limits b { display: block; color: var(--color-ink-2); font-weight: 500; }
@media (max-width: 559.98px) {
  .about > div { grid-template-columns: 1fr; }
  /* list rows wrap: name, chip and the action on the first line, the date under the name */
  .list li { flex-wrap: wrap; row-gap: .125rem; padding-top: .625rem; padding-bottom: .625rem; }
  .list li .when { order: 9; flex-basis: calc(100% - 1.75rem); margin-left: 1.75rem; }
  .list li > .iconbtn, .list li > span[aria-hidden="true"] { margin-left: auto; }
  /* field on its own line, the action full width under it (no half-width input, no wrapped label) */
  .inline { flex-wrap: wrap; }
  .inline .field { flex-basis: 100%; }
  .inline .btn { flex: 1; }
}

/* ── dialogs (NewFolderModal, ShareModal, rescue kit, player) ── */
dialog.modal { width: min(28rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); padding: 1.5rem; border: 1px solid var(--color-rule); border-radius: var(--radius-card); background: var(--color-paper); color: var(--color-ink-2); box-shadow: 0 1px 2px oklch(24% 0.02 258 / 0.08); overflow: auto; }
dialog.modal.lg { width: min(34rem, calc(100vw - 2rem)); }
dialog::backdrop { background: color-mix(in oklch, var(--color-ink) 40%, transparent); }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.modal-h h2 { display: flex; align-items: center; gap: .5rem; font: 600 1rem/1.5rem var(--font-display); color: var(--color-ink); }
.modal-h h2 svg.i { width: 18px; height: 18px; color: var(--color-muted); }
.modal-h .iconbtn { padding: .375rem; }
.modal-b { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.modal-b > .muted { font-size: .875rem; line-height: 1.5; }
.modal-acts { display: flex; gap: .5rem; }
.modal-acts .btn { flex: 1; }
.ack { display: flex; gap: .625rem; align-items: flex-start; padding: .75rem 1rem; border: 1px solid var(--color-rule); border-left: 2px solid var(--color-warning); border-radius: var(--radius-card); font-size: .8125rem; line-height: 1.5; }
.ack input { margin: .125rem 0 0; width: 1rem; height: 1rem; flex: none; accent-color: var(--color-accent); }
dialog.player { width: min(1000px, 96vw); padding: 0; border: 1px solid var(--color-rule); border-radius: var(--radius-card); background: #000; overflow: hidden; }
.player-h { display: flex; align-items: center; gap: .75rem; padding: .5rem .5rem .5rem 1rem; background: var(--color-paper); border-bottom: 1px solid var(--color-rule); }
.player-h b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .875rem; font-weight: 500; color: var(--color-ink); }
.player video { display: block; width: 100%; max-height: 76vh; background: #000; }

/* NotificationToasts (rounded-card border border-l-2 bg-paper px-4 py-3 text-sm shadow-lg), stacked bottom-right:
 * Undo toasts are snackbars, so they sit away from the page header (Upload, Empty trash) and at most 3 show (ui.ts). */
.toasts { position: fixed; z-index: var(--z-toast); right: 1rem; bottom: 1rem; display: flex; flex-direction: column; justify-content: flex-end; gap: .5rem; width: min(24rem, calc(100vw - 2rem)); pointer-events: none; }
.toast { position: relative; overflow: hidden; pointer-events: auto; display: flex; align-items: flex-start; gap: .625rem; padding: .75rem 1rem; border: 1px solid var(--color-rule); border-left: 2px solid var(--color-success); border-radius: var(--radius-card); background: var(--color-paper); color: var(--color-ink-2); font-size: .875rem; line-height: 1.25rem; box-shadow: 0 10px 15px -3px oklch(24% 0.02 258 / 0.1), 0 4px 6px -4px oklch(24% 0.02 258 / 0.1); animation: toast-in var(--duration-short) var(--ease-out); }
.toast > svg.i { margin-top: 2px; color: var(--color-success); }
.toast > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast.err { border-left-color: var(--color-error); }
.toast.err > svg.i { color: var(--color-error); }
.toast.info { border-left-color: var(--color-accent); }
.toast.info > svg.i { color: var(--color-accent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }
@media (max-width: 767.98px) {
  .toasts { left: 1rem; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); width: auto; }
}

@media print {
  body > *:not(dialog[open]) { display: none !important; }
  dialog.modal[open] { position: static; border: 0; box-shadow: none; width: auto; max-height: none; }
  .no-print { display: none !important; }
}

/* ── stage 3 (e2ee / plain) ───────────────── */
/* Upload queue, row 1 like discordrive's UploadProgress: name left; cancel + state right.
 * Cancel: rounded-md p-1.5, icon 13, text-muted, hover bg-paper-3 text-error. */
.qlist .qside { display: inline-flex; align-items: center; gap: .25rem; min-width: 0; }
.qlist .qcancel { padding: .375rem; margin: -.375rem 0; color: var(--color-muted); }
.qlist .qcancel svg.i { width: 13px; height: 13px; }
.qlist .qcancel:hover, .qlist .qcancel:focus-visible { background: var(--color-paper-3); color: var(--color-error); }
/* CANCELLED: the user's choice, not a failure: muted text, muted bar kept where it stopped (bg-muted) */
.qstate.cancel { color: var(--color-muted); }
.bar > i.cancel { background: var(--color-muted); }

/* Settings → Channels: the instance pool is a sentence (not a name): regular weight, wraps, Shared chip right */
.list li.pool-row { align-items: flex-start; padding-top: .75rem; padding-bottom: .75rem; padding-right: 1rem; }
.list li.pool-row > svg.i { margin-top: 2px; color: var(--color-accent); }
.list li.pool-row .ptext { flex: 1; min-width: 0; line-height: 1.25rem; color: var(--color-ink-2); }
.list li.pool-row .chip { flex: none; margin-top: 1px; }
/* Row actions that remove something (own channel, share link): muted at rest, error on hover (like cancel) */
.list .iconbtn.danger { color: var(--color-muted); }
.list .iconbtn.danger:hover, .list .iconbtn.danger:focus-visible { background: color-mix(in oklch, var(--color-error) 10%, transparent); color: var(--color-error); }

/* plain: thumbnail in place of the type badge. Desktop: the badge's slot at line height (no taller rows);
 * phone (below): exactly the FileCard type tile. Hairline frame so light frames do not melt into the paper. */
.thumb { flex: none; display: block; width: 2.25rem; height: 1.5rem; border-radius: var(--radius-chip); object-fit: cover; background: var(--color-paper-2); outline: 1px solid var(--color-rule); outline-offset: -1px; animation: thumb-in var(--duration-short) var(--ease-out); }
@keyframes thumb-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .thumb { animation: none; } }

/* plain: server search = discordrive's FileTable filter bar: full width over the table, h-11, Search 16 at
 * left-3, pl-10; plus a clear button on the right (search.clear) instead of WebKit's own cross. */
.search { position: relative; margin-bottom: .75rem; }
.search > svg.i { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--color-muted); pointer-events: none; }
.search .input { padding-left: 2.5rem; padding-right: 2.75rem; }
.search .input::-webkit-search-cancel-button, .search .input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.search .iconbtn { position: absolute; right: .25rem; top: 50%; transform: translateY(-50%); padding: .5rem; }
.search .iconbtn svg.i { width: 14px; height: 14px; }
@media (max-width: 767.98px) {
  .ftable .c-name .nm > .thumb { grid-row: span 2; align-self: start; width: 3.25rem; height: 2rem; border-radius: var(--radius-input); }
}

/* ── trash, row menu, selection, modals, toasts, Storage/Security, password sign-in (2026-10-13) ──
 * Everything on the Cobalt tokens; patterns from discordrive's FileTable / FolderActionMenu / RenameFolderModal. */

/* Small button (Restore in the trash): h-8, text-sm, like the row actions of FileTable */
.btn.sm { padding: .3125rem .625rem; font-size: .8125rem; line-height: 1.25rem; }
.btn.sm svg.i { width: 14px; height: 14px; }
.btn.danger.solid { border-color: var(--color-error); background: var(--color-error); color: var(--color-error-ink); }
.btn.danger.solid:hover { border-color: color-mix(in oklch, var(--color-error) 85%, var(--color-ink)); background: color-mix(in oklch, var(--color-error) 85%, var(--color-ink)); }
.btn.danger.solid:active { transform: translateY(1px); }
/* quiet destructive icon: muted at rest, error on hover (same as channel/share removal) */
.iconbtn.danger.quiet { color: var(--color-muted); }
.iconbtn.danger.quiet:hover, .iconbtn.danger.quiet:focus-visible { background: color-mix(in oklch, var(--color-error) 10%, transparent); color: var(--color-error); }

/* Selection column: discordrive bulk select (accent-color checkbox, 16px) */
.ftable th.c-sel, .ftable td.c-sel { width: 1%; padding-right: 0; }
.ftable input[type="checkbox"] { width: 1rem; height: 1rem; margin: 0; accent-color: var(--color-accent); cursor: pointer; vertical-align: middle; }
.ftable tbody tr.sel, .ftable tbody tr.sel:hover { background: color-mix(in oklch, var(--color-accent) 8%, transparent); }
.ftable tbody tr.sel td:first-child { box-shadow: inset 2px 0 0 var(--color-accent); }
.ftable tbody tr.drop-over, .crumbs a.drop-over { outline: 2px dashed var(--color-accent); outline-offset: -2px; background: color-mix(in oklch, var(--color-accent) 10%, transparent); }

/* Bulk bar: replaces the table head while something is selected; clear (×) and the count left, actions right */
.bulk { position: sticky; top: .5rem; z-index: calc(var(--z-dropdown) - 1); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .75rem; margin-bottom: .75rem; padding: .375rem .5rem; border: 1px solid color-mix(in oklch, var(--color-accent) 40%, transparent); border-radius: var(--radius-card); background: color-mix(in oklch, var(--color-accent) 7%, var(--color-paper)); box-shadow: 0 1px 2px oklch(24% 0.02 258 / 0.08); animation: toast-in var(--duration-short) var(--ease-out); }
.bulk-l { display: flex; align-items: center; gap: .25rem; }
.bulk-n { font: 500 .875rem/1.25rem var(--font-mono); color: var(--color-ink); font-variant-numeric: tabular-nums; }
.bulk .row-btns { align-items: center; }
.bulk .btn { padding-top: .375rem; padding-bottom: .375rem; }

/* Row menu (FolderActionMenu): min-w-44 card, rows px-4 py-3 text-sm, icon 16, danger in error after a hairline */
.menu { position: fixed; z-index: var(--z-dropdown); min-width: 11rem; max-height: calc(100dvh - 1rem); padding: .25rem 0; overflow: hidden auto; overscroll-behavior: contain; border: 1px solid var(--color-rule); border-radius: var(--radius-card); background: var(--color-paper); box-shadow: 0 10px 15px -3px oklch(24% 0.02 258 / 0.1), 0 4px 6px -4px oklch(24% 0.02 258 / 0.1); animation: menu-in var(--duration-micro, 120ms) var(--ease-out); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }
.menu button { display: flex; width: 100%; align-items: center; gap: .75rem; padding: .625rem 1rem; border: 0; background: none; text-align: left; font: 400 .875rem/1.25rem var(--font-body); color: var(--color-ink-2); cursor: pointer; transition: background-color var(--duration-short) var(--ease-out); }
.menu button svg.i { color: var(--color-muted); }
.menu button:hover, .menu button:focus-visible { background: var(--color-paper-2); color: var(--color-ink); outline: none; }
.menu button:hover svg.i, .menu button:focus-visible svg.i { color: var(--color-ink-2); }
.menu button.danger, .menu button.danger svg.i { color: var(--color-error); }
.menu button.danger:hover, .menu button.danger:focus-visible { background: color-mix(in oklch, var(--color-error) 10%, transparent); color: var(--color-error); }
.menu-sep { height: 1px; margin: .25rem 0; background: var(--color-rule); }
@media (max-width: 767.98px) { .menu button { min-height: 2.75rem; } }

/* Toast action (Undo): a real button, separated from the text; the hairline at the bottom counts the time down */
.toast-act { flex: none; display: inline-flex; align-items: center; gap: .3125rem; margin: -.25rem -.5rem -.25rem 0; padding: .25rem .5rem; border: 0; border-radius: var(--radius-input); background: none; color: var(--color-accent); font: 500 .875rem/1.25rem var(--font-body); cursor: pointer; }
.toast-act svg.i { width: 14px; height: 14px; }
.toast-act:hover, .toast-act:focus-visible { background: color-mix(in oklch, var(--color-accent) 10%, transparent); }
.toast.has-act::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: color-mix(in oklch, var(--color-accent) 35%, transparent); transform-origin: left; animation: toast-time var(--toast-ms, 8000ms) linear forwards; }
@keyframes toast-time { to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .toast.has-act::after { display: none; } }

/* Rename / Move / New folder modals: RenameFolderModal = max-w-sm p-6 */
.modal-b > .input { font-size: .9375rem; }
/* Move picker: crumbs in a strip, folder rows as buttons, destination line above the actions */
.picker-crumbs { flex-wrap: wrap; padding: .5rem .75rem; border-radius: var(--radius-input); background: var(--color-paper-2); }
.picker-crumbs .link { font-size: .875rem; font-weight: 400; color: var(--color-muted); }
.picker-crumbs .link:hover { color: var(--color-ink); text-decoration: none; }
.picker { max-height: min(18rem, 45dvh); overflow: auto; }
.picker li { padding: 0; min-height: 0; }
.picker li > button { display: flex; width: 100%; align-items: center; gap: .75rem; min-height: 2.75rem; padding: .5rem .75rem .5rem 1rem; border: 0; background: none; text-align: left; font: 400 .875rem/1.25rem var(--font-body); color: var(--color-ink); cursor: pointer; transition: background-color var(--duration-short) var(--ease-out); }
.picker li > button:hover, .picker li > button:focus-visible { background: var(--color-paper-2); outline: none; }
.picker li > button svg.i { color: var(--color-muted); }
.picker li > button svg.i:last-child { margin-left: auto; width: 14px; height: 14px; }
.picker li.empty-row { padding: 1rem; justify-content: center; font-size: .8125rem; }
.picker-dest { font-size: .8125rem; line-height: 1.25rem; color: var(--color-muted); }

/* Confirmation (cannot be undone): error icon in a soft circle, solid danger button (discordrive delete confirm) */
dialog.modal.confirm { width: min(24rem, calc(100vw - 2rem)); }
.confirm-h { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.confirm-ic { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; flex: none; border-radius: 9999px; background: color-mix(in oklch, var(--color-error) 12%, transparent); color: var(--color-error); }
.confirm-ic svg.i { width: 18px; height: 18px; }
.confirm-h h2 { font: 600 1rem/1.5rem var(--font-display); color: var(--color-ink); }
dialog.modal.confirm .modal-b { gap: 1.25rem; }

/* Trash: Deleted (date, mono) and Time left (chip) in their own columns; Restore with a label, delete quiet */
.trash-wrap { margin-top: 1rem; }
/* no column heads over an empty state */
.ftable:has(tbody:empty) thead { display: none; }
.ftable td.c-left { white-space: nowrap; }
.ftable td.c-left .chip { font-variant-numeric: tabular-nums; }
.trash-wrap .ftable .acts { align-items: center; gap: .375rem; }
.files-h .acts .btn:disabled { cursor: not-allowed; opacity: .5; }

@media (max-width: 767.98px) {
  .ftable td.c-sel { display: flex; align-items: center; align-self: stretch; padding: 0 0 0 .75rem; }
  .ftable td.c-sel input[type="checkbox"] { width: 1.125rem; height: 1.125rem; }
  .ftable tr:has(td.c-sel) { grid-template-columns: auto minmax(0, 1fr) auto; }
  .ftable th.c-sel { display: none; }
  .ftable tbody tr.sel, .ftable tbody tr.sel:hover { border-color: color-mix(in oklch, var(--color-accent) 45%, transparent); }
  .ftable tbody tr.sel td:first-child { box-shadow: none; }
  .ftable td.c-left { display: none; }
  .trash-wrap .btn.sm .lbl-md { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .trash-wrap .btn.sm { padding: .5rem; }
  .bulk { top: 4rem; }
  .bulk .row-btns { flex: 1; justify-content: flex-end; }
  /* icon-only on a phone; the label stays for screen readers */
  .bulk .btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .bulk .btn { padding: .5rem .625rem; }
}

/* Settings → Storage: the result of the last run as a note with a success rule */
.result { display: block; padding: .75rem 1rem; border: 1px solid var(--color-rule); border-left: 2px solid var(--color-success); border-radius: var(--radius-card); font-size: .8125rem; line-height: 1.5; color: var(--color-ink-2); }
.result:empty { display: none; }

/* Settings → Security */
.pw-current { display: flex; align-items: center; gap: .5rem; padding: .625rem 1rem; border-radius: var(--radius-input); background: var(--color-paper-2); font: 400 .8125rem/1.25rem var(--font-mono); color: var(--color-ink-2); overflow-wrap: anywhere; }
/* strength meter: label + verdict over 4 segments (like the channel slots), tone of the verdict */
.strength { display: grid; gap: .375rem; margin-top: -.25rem; }
.strength-h { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.strength-t { font: 500 .75rem/1rem var(--font-mono); text-transform: uppercase; letter-spacing: .025em; color: var(--color-muted); }
.strength-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: .25rem; }
.strength-bars i { height: .375rem; border-radius: 9999px; background: var(--color-paper-3); transition: background-color var(--duration-short) var(--ease-out); }
.strength[data-score="1"] .strength-bars i:nth-child(-n+1) { background: var(--color-error); }
.strength[data-score="2"] .strength-bars i:nth-child(-n+2) { background: var(--color-warning); }
.strength[data-score="3"] .strength-bars i:nth-child(-n+3) { background: var(--color-success); }
.strength[data-score="4"] .strength-bars i { background: var(--color-success); }
.strength[data-score="1"] .strength-t { color: var(--color-error); }
.strength[data-score="2"] .strength-t { color: color-mix(in oklch, var(--color-warning) 70%, var(--color-ink)); }
.strength[data-score="3"] .strength-t, .strength[data-score="4"] .strength-t { color: var(--color-success); }
/* risk acknowledgement: plain hairline box (the warning above stays the only amber block); amber once ticked off is needed */
.ack.plain { border-left-width: 1px; border-left-color: var(--color-rule); background: var(--color-paper-2); cursor: pointer; }
.ack.plain:has(input:checked) { border-color: color-mix(in oklch, var(--color-accent) 40%, transparent); background: color-mix(in oklch, var(--color-accent) 6%, var(--color-paper)); }

/* Sign-in screens: the three other ways in (pairing, rescue kit, password) as one column of equal buttons;
 * three in a row do not fit the 28rem card and wrapped 2 + 1. */
.signin-hint { margin-top: 0; text-align: center; }
.auth-foot .alt-ways { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; max-width: 20rem; }
.auth-foot .alt-ways .btn { width: 100%; padding-top: .625rem; padding-bottom: .625rem; }

/* ── file preview: the player dialog on paper; full screen on a phone ── */
dialog.preview { width: min(1100px, 96vw); height: min(90dvh, 900px); max-width: 100vw; max-height: 100dvh; background: var(--color-paper); color: var(--color-ink-2); flex-direction: column; }
dialog.preview[open] { display: flex; }
.preview .player-h { gap: .25rem; }
.preview .player-h b { margin-right: .5rem; }
.preview .player-h .iconbtn { padding: .5rem; }
.preview .player-h .iconbtn svg.i { width: 18px; height: 18px; }
.preview .player-h .iconbtn:disabled { cursor: not-allowed; opacity: .3; }
.preview .player-h .iconbtn:disabled:hover { background: none; }
/* prev / next as one pair, a hairline before download + close */
.preview .player-h [data-ddn="preview-download"] { margin-left: .5rem; position: relative; }
.preview .player-h [data-ddn="preview-download"]::before { content: ""; position: absolute; left: -.3125rem; top: .5rem; bottom: .5rem; width: 1px; background: var(--color-rule); }
.pv-body { flex: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; overflow: auto; }
.pv-loading { margin: auto; font: 400 .8125rem/1.25rem var(--font-mono); animation: pv-pulse 1.2s var(--ease-out) infinite alternate; }
@keyframes pv-pulse { from { opacity: .45; } }
.pv-msg { margin: auto; display: grid; justify-items: center; gap: 1rem; max-width: 28rem; padding: 2rem 1rem; text-align: center; font-size: .875rem; line-height: 1.5; color: var(--color-ink-2); }
/* tone mark over the message, the confirm dialog's soft circle: i = neutral (too big, no viewer), ! = warn / err */
.pv-msg::before { content: "i"; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 9999px; background: color-mix(in oklch, var(--color-accent) 12%, transparent); color: var(--color-accent); font: 600 1rem/1 var(--font-mono); }
.pv-msg.warn::before { content: "!"; background: color-mix(in oklch, var(--color-warning) 18%, transparent); color: color-mix(in oklab, var(--color-warning) 55%, var(--color-ink)); }
.pv-msg.err::before { content: "!"; background: color-mix(in oklch, var(--color-error) 12%, transparent); color: var(--color-error); }
.pv-note { flex: none; padding: .5rem 1rem; border-bottom: 1px solid var(--color-rule); background: var(--color-paper-2); font-size: .8125rem; line-height: 1.25rem; }
.pv-text { margin: 0; padding: 1.25rem 1.5rem 2rem; font: 400 .8125rem/1.6 var(--font-mono); color: var(--color-ink); white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4; }
.preview[data-kind="image"] .pv-body, .preview[data-kind="video"] .pv-body { background: var(--color-paper-2); }
.pv-img { display: block; margin: auto; max-width: calc(100% - 2rem); max-height: calc(100% - 2rem); object-fit: contain; outline: 1px solid var(--color-rule); }
.pv-img[data-placeholder] { width: 100%; height: 100%; filter: blur(6px); }
.pv-pdf { flex: 1; width: 100%; min-height: 0; border: 0; background: var(--color-paper-2); }
.pv-video { display: block; width: 100%; max-height: 100%; margin: auto; background: #000; }
.pv-audio { width: min(32rem, calc(100% - 2rem)); margin: auto; }
/* CSV / TSV: the table in a hairline card with breathing room, like the file table */
.pv-scroll { flex: none; align-self: flex-start; max-width: calc(100% - 2rem); margin: 1rem; overflow: auto; border: 1px solid var(--color-rule); border-radius: var(--radius-card); }
.pv-table, .pv-md table { border-collapse: collapse; font-size: .8125rem; line-height: 1.25rem; }
.pv-table { border-style: hidden; }
.pv-table td { color: var(--color-ink); }
.pv-table tbody tr:hover td { background: var(--color-paper-2); }
.pv-table th, .pv-table td, .pv-md th, .pv-md td { max-width: 40ch; padding: .375rem .75rem; border: 1px solid var(--color-rule); text-align: left; vertical-align: top; white-space: pre-wrap; overflow-wrap: anywhere; }
.pv-table th, .pv-md th { background: var(--color-paper-2); color: var(--color-ink); font-weight: 600; }
.pv-table thead th { position: sticky; top: 0; }
.pv-md { width: 100%; max-width: 46rem; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; font-size: .9375rem; line-height: 1.6; color: var(--color-ink); overflow-wrap: anywhere; }
.pv-md :is(h1, h2, h3, h4, h5, h6) { margin: 1.25em 0 .5em; font-family: var(--font-display); font-weight: 600; line-height: 1.3; color: var(--color-ink); }
.pv-md > :first-child { margin-top: 0; }
.pv-md h1 { font-size: 1.5rem; } .pv-md h2 { font-size: 1.25rem; } .pv-md h3 { font-size: 1.125rem; } .pv-md :is(h4, h5, h6) { font-size: 1rem; }
.pv-md :is(p, ul, ol, pre, blockquote, table) { margin: 0 0 .875em; }
.pv-md :is(ul, ol) { padding-left: 1.5em; }
.pv-md code { padding: .1em .3em; border-radius: var(--radius-chip); background: var(--color-paper-2); font: .85em var(--font-mono); }
.pv-md pre { padding: .75rem 1rem; border-radius: var(--radius-input); background: var(--color-paper-2); overflow: auto; }
.pv-md pre code { padding: 0; background: none; }
.pv-md blockquote { padding-left: 1rem; border-left: 2px solid var(--color-rule-2); color: var(--color-ink-2); }
.pv-md a { color: var(--color-accent); }
.pv-md hr { margin: 1.5em 0; border: 0; border-top: 1px solid var(--color-rule); }
.pv-md .md-img { color: var(--color-muted); font-style: italic; }
.ftable tbody tr.pv-row { cursor: pointer; }
@media (max-width: 767.98px) {
  dialog.preview { width: 100vw; height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .preview .player-h { padding-top: max(.5rem, env(safe-area-inset-top)); }
  .pv-text { padding: 1rem; font-size: .75rem; }
  .pv-md { padding: 1.25rem 1rem 2.5rem; }
}

/* ── channels: collapsible section, remove dialog, storage stats, unavailable rows
 * (polish by the frontend profile on the existing Cobalt tokens: list, chip, note, modal, ack, bar) ── */
/* Heading: chevron + title + count chip on the left, the one-line summary on the right (under the title on a phone).
 * The summary repeats the count, so the chip steps back while the summary is there; it stays when the summary is
 * empty (not set up yet: the warning-toned chip is then the only signal). */
.sec-h:has(.sec-toggle) { flex-wrap: wrap; align-items: center; justify-content: flex-start; column-gap: .625rem; row-gap: .125rem; }
.sec-h:has(.sec-sum:not(:empty)) [data-ddn-ui="hook-count"] { display: none; }
.sec-toggle { display: inline-flex; align-items: center; gap: .5rem; margin-left: -.375rem; padding: .125rem .5rem .125rem .375rem; border: 0; border-radius: var(--radius-input); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; transition: background-color var(--duration-short) var(--ease-out); }
.sec-toggle:hover { background: var(--color-paper-2); }
.sec-toggle svg.i { width: 16px; height: 16px; color: var(--color-muted); transition: transform var(--duration-short) var(--ease-out), color var(--duration-short) var(--ease-out); }
.sec-toggle:hover svg.i { color: var(--color-ink); }
.sec-toggle[aria-expanded="true"] svg.i { transform: rotate(90deg); }
.sec-sum { margin-left: auto; font: 400 .75rem/1.25rem var(--font-mono); color: var(--color-muted); font-variant-numeric: tabular-nums; }
.sec-sum:empty { display: none; }
@media (max-width: 559.98px) {
  .sec-sum { flex-basis: 100%; margin-left: 1.625rem; }
}

/* Channel rows: # name, chips, then stats and actions together on the right */
.list li [data-ddn="channel-critical"], .list li [data-ddn="channel-retired"] { flex: none; }
.list li .acts2 { margin-left: auto; display: inline-flex; align-items: center; gap: .25rem; flex: none; }
@media (min-width: 560px) { .list li .when + .acts2 { margin-left: .25rem; } }
/* a row with a text button (Use again) has no room for name + stats + actions on one line: the name keeps its
 * width and the stats go under it (as on a phone) instead of cutting the name to "ddn-st…" */
.list li[data-ddn="channel-row"]:has(.acts2 .btn) { flex-wrap: wrap; row-gap: .125rem; padding-top: .625rem; padding-bottom: .625rem; }
.list li[data-ddn="channel-row"]:has(.acts2 .btn) .when { order: 9; flex-basis: calc(100% - 1.75rem); margin-left: 1.75rem; }
.list li[data-ddn="channel-row"]:has(.acts2 .btn) .acts2 { margin-left: auto; }
.list li:has([data-ddn="channel-retired"]) .dname { color: var(--color-ink-2); font-weight: 400; }
.list li:has([data-ddn="channel-retired"]) > svg.i { opacity: .6; }

/* Move progress: a card with a rule in the state's tone, text over the bar */
[data-ddn="channel-move"] { gap: .625rem; padding: .875rem 1rem 1rem; border: 1px solid var(--color-rule); border-left: 2px solid var(--color-accent); border-radius: var(--radius-card); background: var(--color-paper); }
[data-ddn="channel-move"] .hint { margin: 0; font: 400 .8125rem/1.25rem var(--font-body); color: var(--color-ink-2); font-variant-numeric: tabular-nums; }
[data-ddn="channel-move"][data-state="done"] { border-left-color: var(--color-success); }
/* paused: continues by itself, so amber (the script paints the bar as an error for every non-running state) */
[data-ddn="channel-move"][data-state="paused"] { border-left-color: var(--color-warning); }
[data-ddn="channel-move"][data-state="paused"] .bar > i { background: var(--color-warning); }
[data-ddn="channel-move"][data-state="failed"] { border-left-color: var(--color-error); }
/* native radios / checkboxes of the new dialogs follow the dark palette (white discs on dark paper otherwise) */
[data-theme="dark"] :is(.choices input, label.ack input) { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) :is(.choices input, label.ack input) { color-scheme: dark; } }

/* Removed channels: what they hold under the name, recovery on the right */
[data-ddn="removed-block"] { display: grid; gap: .5rem; }
[data-ddn="removed-list"] li { flex-wrap: wrap; row-gap: .125rem; padding-top: .625rem; padding-bottom: .625rem; }
[data-ddn="removed-list"] li .dname { color: var(--color-ink-2); }
[data-ddn="removed-list"] li > svg.i { opacity: .6; }
[data-ddn="removed-list"] li .btn { order: 2; margin-left: auto; }
[data-ddn="removed-list"] li .when { order: 3; flex-basis: calc(100% - 1.75rem); margin-left: 1.75rem; white-space: normal; font: 400 .75rem/1.125rem var(--font-body); }

/* Remove dialog: impact sentence in ink, file list dense and scrollable, options as cards */
[data-ddn="channel-dialog"] [data-ddn="chd-impact"] { color: var(--color-ink-2); }
.list.scroll { max-height: min(14rem, 30dvh); overflow: auto; overscroll-behavior: contain; }
.list.scroll li { min-height: 2.5rem; padding-top: .375rem; padding-bottom: .375rem; padding-right: 1rem; }
.list.scroll li > svg.i { width: 14px; height: 14px; }
.list.scroll li.empty-row { min-height: 2.25rem; padding-left: calc(1rem + 14px + .75rem); font-size: .8125rem; }
fieldset.choices { min-width: 0; margin: 0; padding: 0; border: 0; display: grid; gap: .5rem; }
.choices .choice { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .75rem; align-items: start; padding: .75rem 1rem; border: 1px solid var(--color-rule); border-radius: var(--radius-card); background: var(--color-paper); cursor: pointer; transition: border-color var(--duration-short) var(--ease-out), background-color var(--duration-short) var(--ease-out); }
.choices .choice input { width: 1rem; height: 1rem; margin: .125rem 0 0; accent-color: var(--color-accent); cursor: inherit; }
.choices .choice:hover { border-color: var(--color-rule-2); background: var(--color-paper-2); }
.choices .choice:has(input:checked) { border-color: var(--color-accent); background: color-mix(in oklch, var(--color-accent) 6%, var(--color-paper)); }
.choices .choice:has(input[value="remove"]:checked) { border-color: var(--color-error); background: color-mix(in oklch, var(--color-error) 6%, var(--color-paper)); }
.choices .choice:has(input[value="remove"]) input { accent-color: var(--color-error); }
.choices .choice:has(input:focus-visible) { outline: 2px solid var(--color-focus); outline-offset: 1px; }
.choices .choice:has(input:disabled) { border-style: dashed; background: none; cursor: not-allowed; }
.choices .choice:has(input:disabled) b, .choices .choice:has(input:disabled) small { color: var(--color-muted); }
.choices .choice b { display: block; font-size: .875rem; line-height: 1.25rem; color: var(--color-ink); font-weight: 600; }
.choices .choice small { display: block; margin-top: .125rem; font-size: .8125rem; line-height: 1.4; color: var(--color-ink-2); }
/* "Remove anyway" cannot be undone without the webhook: solid error, like the other irreversible confirmations */
[data-ddn="chd-go"].danger { border-color: var(--color-error); background: var(--color-error); color: var(--color-error-ink); }
[data-ddn="chd-go"].danger:hover { border-color: color-mix(in oklch, var(--color-error) 85%, var(--color-ink)); background: color-mix(in oklch, var(--color-error) 85%, var(--color-ink)); }
[data-ddn="chd-ack-row"] { cursor: pointer; }

/* Settings → Storage: an amber value when files are unavailable; the switch is a switch, not a warning box */
.about dd p:empty { display: none; }
.about dd:has([data-ddn-ui="st-unavail-t"]:not(:empty)) .val { color: color-mix(in oklab, var(--color-warning) 55%, var(--color-ink)); font-weight: 500; }
[data-ddn="st-channels"] li .chip { flex: none; }
label.ack:has([data-ddn="show-unavailable"]) { align-items: center; gap: .75rem; border-left-width: 1px; border-left-color: var(--color-rule); font-size: .875rem; color: var(--color-ink); cursor: pointer; }
label.ack:has([data-ddn="show-unavailable"]) + .hint { margin-top: -.5rem; }
input[data-ddn="show-unavailable"] { -webkit-appearance: none; appearance: none; position: relative; width: 2.25rem; height: 1.25rem; margin: 0; flex: none; border-radius: 9999px; background: var(--color-paper-3); outline: 1px solid var(--color-rule-2); outline-offset: -1px; cursor: pointer; transition: background-color var(--duration-short) var(--ease-out); }
input[data-ddn="show-unavailable"]::before { content: ""; position: absolute; top: .1875rem; left: .1875rem; width: .875rem; height: .875rem; border-radius: 9999px; background: var(--color-paper); box-shadow: 0 1px 2px oklch(24% 0.02 258 / 0.25); transition: transform var(--duration-short) var(--ease-out); }
input[data-ddn="show-unavailable"]:checked { background: var(--color-accent); outline-color: var(--color-accent); }
input[data-ddn="show-unavailable"]:checked::before { transform: translateX(1rem); }
input[data-ddn="show-unavailable"]:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

/* File list: an unavailable file. The name and type step back (not the chip); a faint amber wash on the row;
 * the reason on its own line with an amber dot (a plain amber-ink mix reads olive green in oklch). */
.ftable tbody tr.unavail { background: color-mix(in oklch, var(--color-warning) 5%, transparent); }
.ftable tbody tr.unavail:hover { background: color-mix(in oklch, var(--color-warning) 9%, transparent); }
tr.unavail .nm > .badge, tr.unavail .nm > .thumb { opacity: .55; }
tr.unavail .nm > [data-ddn="preview-open"] { color: var(--color-ink-2); }
tr.unavail .nm > [data-ddn="unavailable-chip"] { flex: none; }
/* with the chip after it the name is no longer the last span: it keeps its ellipsis */
.ftable .c-name .nm > span[data-ddn="preview-open"] { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unav-why { display: block; max-width: 60ch; margin-top: .25rem; padding-left: .875rem; text-indent: -.875rem; font: 400 .75rem/1.125rem var(--font-body); color: var(--color-ink-2); white-space: normal; }
.unav-why::before { content: ""; display: inline-block; width: .375rem; height: .375rem; margin-right: .5rem; border-radius: 9999px; background: var(--color-warning); vertical-align: .0625rem; }
@media (max-width: 767.98px) {
  /* the chip is the last span of .nm here, so the card's "name = last span" rule would land on it: give the
   * name its card type back and keep the chip a chip */
  .ftable .c-name .nm > span[data-ddn="preview-open"] { grid-column: 2; font-size: .875rem; line-height: 1.25rem; font-weight: 500; }
  .ftable .c-name .nm > span[data-ddn="unavailable-chip"] { grid-column: 2; justify-self: start; margin-top: .25rem; font-size: .6875rem; line-height: 1rem; font-weight: 500; }
  .ftable .c-name .unav-why { grid-column: 2; }
  .ftable tbody tr.unavail { border-color: color-mix(in oklab, var(--color-warning) 45%, var(--color-rule)); }
}
/* Warning chips (Retired, Unavailable, a channel count that is not enough yet): mixed in oklab. In oklch the
 * amber (hue 80) and the blue ink (hue 258) meet halfway round the wheel and the text reads olive green. */
.chip--warning { color: color-mix(in oklab, var(--color-warning) 62%, var(--color-ink)); border-color: color-mix(in oklab, var(--color-warning) 55%, transparent); }
.note.warn svg.i, .advice.need { color: color-mix(in oklab, var(--color-warning) 62%, var(--color-ink)); }
.bar > i.paused { background: var(--color-warning); }

/* ── trash next to Download, context menu, List / Tiles, sortable column heads ──
 * Functional base on the Cobalt tokens (the look gets its polish from the frontend profile). */
/* Move to trash in the row: quiet (muted, error on hover). Phone list cards: in the menu (no room). */
@media (max-width: 767.98px) { .ftable-wrap:not([data-view="tiles"]) .row-trash { display: none; } }
/* Context menu: group labels and radio items (view / sort) */
.menu-label { padding: .5rem 1rem .25rem; font: 500 .6875rem/1rem var(--font-mono); text-transform: uppercase; letter-spacing: .04em; color: var(--color-muted); }
.menu button[aria-checked="true"] { color: var(--color-ink); font-weight: 500; }
.menu button[aria-checked="true"] svg.i { color: var(--color-accent); }
/* Sortable column heads: the head text is the button; the arrow shows the direction of the active one */
.th-sort { display: inline-flex; align-items: center; gap: .375rem; padding: 0; border: 0; background: none; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; cursor: pointer; }
.th-sort svg.i { width: 12px; height: 12px; opacity: 0; transition: opacity var(--duration-short) var(--ease-out); }
.th-sort:hover, .th-sort:focus-visible { color: var(--color-ink); }
.th-sort:hover svg.i, .th-sort:focus-visible svg.i { opacity: .5; }
th[aria-sort="ascending"] .th-sort, th[aria-sort="descending"] .th-sort { color: var(--color-ink-2); }
th[aria-sort="ascending"] .th-sort svg.i, th[aria-sort="descending"] .th-sort svg.i { opacity: 1; color: var(--color-accent); }
/* List / Tiles switch in the page head (the EN/PL segmented control) */
.view-toggle { align-self: center; }
.view-toggle button { display: inline-grid; place-items: center; }
.view-toggle svg.i { width: 15px; height: 15px; }
@media (max-width: 767.98px) { .view-toggle button { height: 2.25rem; min-width: 2.25rem; } }

/* Tiles: the same rows (same hooks, paging, selection, menus) laid out as a responsive grid. */
.ftable-wrap[data-view="tiles"] { overflow: visible; border: 0; border-radius: 0; background: none; }
.ftable-wrap[data-view="tiles"] .ftable, .ftable-wrap[data-view="tiles"] .ftable tbody { display: block; }
.ftable-wrap[data-view="tiles"] .ftable thead { display: none; }
.ftable-wrap[data-view="tiles"] .ftable tbody { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .75rem; }
.ftable-wrap[data-view="tiles"] .ftable tbody tr { position: relative; display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--color-rule); border-radius: var(--radius-card); background: var(--color-paper); }
.ftable-wrap[data-view="tiles"] .ftable tbody tr:hover { border-color: var(--color-rule-2); background: var(--color-paper-2); }
.ftable-wrap[data-view="tiles"] .ftable tbody tr.sel { border-color: color-mix(in oklch, var(--color-accent) 55%, transparent); }
.ftable-wrap[data-view="tiles"] .ftable tbody tr.sel td:first-child { box-shadow: none; }
.ftable-wrap[data-view="tiles"] .ftable td { display: block; padding: 0; border: 0; }
.ftable-wrap[data-view="tiles"] .ftable td.size, .ftable-wrap[data-view="tiles"] .ftable td.c-date { display: none; }
.ftable-wrap[data-view="tiles"] .ftable td.c-name { max-width: none; width: auto; padding: .5rem .5rem .75rem; }
.ftable-wrap[data-view="tiles"] .ftable .c-name .nm { display: flex; flex-direction: column; align-items: stretch; gap: .5rem; width: 100%; }
/* the preview area: thumbnail (plain), the type badge or the folder icon, 4:3 */
.ftable-wrap[data-view="tiles"] .ftable .c-name .nm > :first-child { box-sizing: border-box; display: grid; place-items: center; width: 100%; height: auto; aspect-ratio: 4 / 3; margin: 0; border: 0; border-radius: var(--radius-input); background: var(--color-paper-2); }
.ftable-wrap[data-view="tiles"] .ftable .c-name .nm > svg.i { padding: 26%; color: var(--color-ink-2); }
.ftable-wrap[data-view="tiles"] .ftable .c-name .nm > .badge { font-size: .8125rem; line-height: 1rem; color: var(--color-ink-2); }
.ftable-wrap[data-view="tiles"] .ftable .c-name .nm > .badge.media { color: var(--color-accent); }
.ftable-wrap[data-view="tiles"] .ftable .c-name .nm > .thumb { object-fit: cover; outline: 1px solid var(--color-rule); outline-offset: -1px; }
.ftable-wrap[data-view="tiles"] .ftable .c-name .nm > :is(a, span:last-child, [data-ddn="preview-open"]) { min-width: 0; padding: 0 .25rem; font-size: .875rem; line-height: 1.25rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ftable-wrap[data-view="tiles"] .ftable .c-name .nm > [data-ddn="unavailable-chip"] { align-self: flex-start; margin-left: .25rem; }
.ftable-wrap[data-view="tiles"] .ftable .sub { display: block; margin-top: .125rem; padding: 0 .25rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ftable-wrap[data-view="tiles"] .ftable .unav-why { display: none; }
/* selection box top left, actions top right: shown on hover / focus / selection (always on touch) */
.ftable-wrap[data-view="tiles"] .ftable td.c-sel { position: absolute; z-index: 1; top: .875rem; left: .875rem; display: grid; place-items: center; width: 1.75rem; height: 1.75rem; padding: 0; border-radius: var(--radius-input); background: color-mix(in oklch, var(--color-paper) 88%, transparent); box-shadow: 0 1px 2px oklch(24% 0.02 258 / 0.12); }
.ftable-wrap[data-view="tiles"] .ftable td.c-acts { position: absolute; z-index: 1; top: .875rem; right: .875rem; padding: .125rem; border-radius: var(--radius-input); background: color-mix(in oklch, var(--color-paper) 92%, transparent); box-shadow: 0 1px 2px oklch(24% 0.02 258 / 0.12); }
.ftable-wrap[data-view="tiles"] .ftable .acts { gap: 0; }
.ftable-wrap[data-view="tiles"] .ftable .acts :is([data-ddn="play"], [data-ddn="share"]) { display: none; }
.ftable-wrap[data-view="tiles"] .ftable :is(td.c-sel, td.c-acts) { opacity: 0; transition: opacity var(--duration-short) var(--ease-out); }
.ftable-wrap[data-view="tiles"] .ftable tr:is(:hover, :focus-within, .sel) :is(td.c-sel, td.c-acts),
.ftable-wrap[data-view="tiles"] .ftable tbody:has(tr.sel) td.c-sel,
.ftable-wrap[data-view="tiles"] .ftable tr:has([aria-expanded="true"]) td.c-acts { opacity: 1; }
@media (hover: none) { .ftable-wrap[data-view="tiles"] .ftable :is(td.c-sel, td.c-acts) { opacity: 1; } }
/* Trash in tiles: the days left and Restore / Delete under the name, always visible */
.ftable-wrap.trash-wrap[data-view="tiles"] .ftable td.c-left { display: block; padding: 0 .75rem .5rem; }
.ftable-wrap.trash-wrap[data-view="tiles"] .ftable td.c-acts { position: static; opacity: 1; padding: 0 .5rem .75rem; background: none; box-shadow: none; text-align: left; }
.ftable-wrap.trash-wrap[data-view="tiles"] .ftable .acts { display: flex; justify-content: space-between; }
@media (max-width: 767.98px) {
  .ftable-wrap[data-view="tiles"] .ftable tbody { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .5rem; }
  .ftable-wrap[data-view="tiles"] .ftable td.c-name { padding: .375rem .375rem .625rem; }
  .ftable-wrap[data-view="tiles"] .ftable td.c-sel { top: .625rem; left: .625rem; }
  .ftable-wrap[data-view="tiles"] .ftable td.c-acts { top: .625rem; right: .625rem; }
}
/* Long press opens the menu: no text selection / iOS callout on the rows */
@media (hover: none) { .ftable tbody tr { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; } }

/* Upload queue closes itself: a hairline counts down at the bottom of the panel
 * (paused on hover / focus); files that failed stay in a warning bar with Details and Retry. */
.uploads { position: relative; }
.uploads[data-closing]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: color-mix(in oklch, var(--color-accent) 35%, transparent); transform-origin: left; animation: toast-time var(--close-ms, 5000ms) linear forwards; }
.uploads[data-closing][data-result="err"]::after { background: color-mix(in oklch, var(--color-error) 45%, transparent); }
.uploads[data-closing][data-paused]::after { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .uploads[data-closing]::after { display: none; } }
.upfail { margin-bottom: 1rem; }
.upfail-b { display: grid; gap: .5rem; min-width: 0; }
.upfail-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.upfail-h .row-btns { align-items: center; gap: .375rem; }
.upfail-list { display: grid; gap: .25rem; margin: 0; padding: 0; list-style: none; font-size: .8125rem; }
.upfail-list li { display: flex; gap: .5rem; min-width: 0; }
.upfail-list .n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-ink); font-weight: 500; }
.upfail-list .why { flex: none; max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-muted); }

/* ── UI polish (frontend profile). CSS only, every data-ddn hook unchanged ── */
/* List / Tiles: the segmented control is as tall as the buttons beside it (38 px; 46 px on a phone) */
.files-h .view-toggle button { height: 2rem; min-width: 2.25rem; padding: 0 .5rem; }
.files-h .view-toggle svg.i { width: 16px; height: 16px; }
.files-h .view-toggle button[aria-pressed="true"] { background: var(--color-paper-3); }
@media (max-width: 767.98px) { .files-h .view-toggle button { height: 2.5rem; min-width: 2.5rem; } }

/* Sortable heads: one arrow, down = descending (biggest / newest first), turned up for ascending; a faint
 * hint on hover of a column that is not the sort; numbers column: the arrow sits before the text so the
 * head keeps its right edge on the figures */
.th-sort { margin: -.25rem -.375rem; padding: .25rem .375rem; border-radius: .25rem; }
.th-sort:hover { background: var(--color-paper-2); }
.th-sort svg.i { transition: opacity var(--duration-short) var(--ease-out), transform var(--duration-short) var(--ease-out); }
th.r .th-sort { flex-direction: row-reverse; }
th[aria-sort="ascending"] .th-sort svg.i { transform: rotate(180deg); }
th[aria-sort="none"] .th-sort:hover svg.i, th[aria-sort="none"] .th-sort:focus-visible svg.i { opacity: .45; }

/* Row trash: on a desktop list the folder's trash stands in the same column as the files' trash (files
 * carry Share after it, folders do not) */
@media (min-width: 768px) {
  .ftable-wrap:not([data-view="tiles"]) tbody:has([data-ddn="share"]) tr[data-kind="folder"] .row-trash { margin-right: calc(31px + .25rem); }
}

/* Context menu: view / sort radios are denser than actions (the area menu was ~540 px tall); a group
 * label right after a rule sits closer to it */
.menu button[role="menuitemradio"] { padding-top: .4375rem; padding-bottom: .4375rem; }
.menu-sep + .menu-label { padding-top: .375rem; }
.menu-label { padding-left: 2.75rem; letter-spacing: .06em; }
.menu button[role="menuitemradio"][aria-checked="false"] { color: var(--color-ink-2); }

/* Tiles: the phone card rule (.ftable tr { align-items: center }) also reached the tile's flex column and
 * shrank its cells to their content (trash actions centred, long names not cut): cells fill the tile */
.ftable-wrap[data-view="tiles"] .ftable tbody tr { align-items: stretch; }
/* Tiles: a card that lifts on hover (the preview no longer melts into a paper-2 card), a selection ring */
.ftable-wrap[data-view="tiles"] .ftable tbody tr { transition: border-color var(--duration-short) var(--ease-out), box-shadow var(--duration-short) var(--ease-out); }
.ftable-wrap[data-view="tiles"] .ftable tbody tr:hover { background: var(--color-paper); box-shadow: 0 1px 2px oklch(24% 0.02 258 / 0.06), 0 6px 16px -8px oklch(24% 0.02 258 / 0.18); }
.ftable-wrap[data-view="tiles"] .ftable tbody tr:hover .c-name .nm > :first-child:not(.badge) { background-color: var(--color-paper-3); }
.ftable-wrap[data-view="tiles"] .ftable tbody tr.sel,
.ftable-wrap[data-view="tiles"] .ftable tbody tr.sel:hover { border-color: var(--color-accent); background: color-mix(in oklch, var(--color-accent) 5%, var(--color-paper)); box-shadow: 0 0 0 1px var(--color-accent); }
.ftable-wrap[data-view="tiles"] .ftable tbody tr.sel .c-name .nm > :first-child:not(.badge) { background-color: color-mix(in oklch, var(--color-accent) 9%, var(--color-paper-2)); }
.ftable-wrap[data-view="tiles"] .ftable tbody tr.drop-over { outline-offset: -1px; }
/* the preview: folder drawn thin (a 16 px icon blown up to ~50 px reads heavy at stroke 2), set below the
 * corner controls */
.ftable-wrap[data-view="tiles"] .ftable .c-name .nm > svg.i { padding: 26% 34% 12%; stroke-width: 1.25; color: var(--color-muted); transition: background-color var(--duration-short) var(--ease-out); }
/* a file without a thumbnail: a sheet in the type's tone with the type under it (the list colours kept) */
.ftable-wrap[data-view="tiles"] .ftable .c-name .nm > .badge { display: grid; place-content: center; justify-items: center; gap: .375rem; padding: 1.75rem 0 0; border: 0; color: var(--color-ink-2); font: 600 .6875rem/1rem var(--font-mono); letter-spacing: .08em; transition: background-color var(--duration-short) var(--ease-out); }
.ftable-wrap[data-view="tiles"] .ftable .c-name .nm > .badge::before { content: ""; width: 2.25rem; height: 2.75rem; border-radius: .25rem; background: currentColor; opacity: .16; clip-path: polygon(0 0, 66% 0, 100% 26%, 100% 100%, 0 100%); }
.ftable-wrap[data-view="tiles"] .ftable .c-name .nm > .badge.media { color: var(--color-accent); background-color: color-mix(in oklab, var(--color-accent) 6%, var(--color-paper-2)); }
.ftable-wrap[data-view="tiles"] .ftable .c-name .nm > .badge.doc { color: var(--color-error); background-color: color-mix(in oklab, var(--color-error) 6%, var(--color-paper-2)); }
.ftable-wrap[data-view="tiles"] .ftable .c-name .nm > .badge.sheet { color: var(--color-success); background-color: color-mix(in oklab, var(--color-success) 6%, var(--color-paper-2)); }
.ftable-wrap[data-view="tiles"] .ftable .c-name .nm > .badge.archive { color: color-mix(in oklab, var(--color-warning) 70%, var(--color-ink)); background-color: color-mix(in oklab, var(--color-warning) 8%, var(--color-paper-2)); }
.ftable-wrap[data-view="tiles"] .ftable tbody tr:hover .c-name .nm > .badge { background-image: linear-gradient(oklch(50% 0 0 / 0.04), oklch(50% 0 0 / 0.04)); }
.ftable-wrap[data-view="tiles"] .ftable .c-name .nm > .thumb { animation: none; }
/* name + size · date */
.ftable-wrap[data-view="tiles"] .ftable td.c-name { padding: .375rem .375rem .75rem; }
.ftable-wrap[data-view="tiles"] .ftable .c-name .nm { gap: .625rem; }
.ftable-wrap[data-view="tiles"] .ftable .c-name .nm > :is(a, span:last-child, [data-ddn="preview-open"]) { color: var(--color-ink); }
.ftable-wrap[data-view="tiles"] .ftable .sub { margin-top: .125rem; font-size: .6875rem; }
/* corner controls: the box and the actions pill the same height (30 px), tighter icon buttons */
.ftable-wrap[data-view="tiles"] .ftable td.c-sel { top: .75rem; left: .75rem; width: 1.875rem; height: 1.875rem; border: 1px solid var(--color-rule); box-shadow: 0 1px 2px oklch(24% 0.02 258 / 0.08); }
.ftable-wrap[data-view="tiles"] .ftable td.c-acts { top: .75rem; right: .75rem; padding: 0 .0625rem; border: 1px solid var(--color-rule); box-shadow: 0 1px 2px oklch(24% 0.02 258 / 0.08); background: color-mix(in oklch, var(--color-paper) 94%, transparent); }
.ftable-wrap[data-view="tiles"] .ftable td.c-acts .iconbtn { padding: .375rem; }
.ftable-wrap[data-view="tiles"] .ftable td.c-acts .acts { display: flex; height: 1.75rem; align-items: center; }
.ftable-wrap[data-view="tiles"] .ftable tr.sel td.c-sel { border-color: var(--color-accent); }
/* Trash tiles: the controls sit in the card, not over the preview: days left as a chip, Restore + delete */
.ftable-wrap.trash-wrap[data-view="tiles"] .ftable .c-name .nm > .badge { padding-top: 0; }
.ftable-wrap.trash-wrap[data-view="tiles"] .ftable .c-name .nm > svg.i { padding: 22% 34%; }
.ftable-wrap.trash-wrap[data-view="tiles"] .ftable td.c-name { padding-bottom: .5rem; }
/* the sub-line already says the days left: the chip stays only as the warning (3 days or less) */
.ftable-wrap.trash-wrap[data-view="tiles"] .ftable td.c-left { padding: 0 .625rem .625rem; }
.ftable-wrap.trash-wrap[data-view="tiles"] .ftable td.c-left:not(:has(.chip--warning)) { display: none; }
.ftable-wrap.trash-wrap[data-view="tiles"] .ftable td.c-acts { margin-top: auto; padding: .5rem .5rem .5rem .625rem; border: 0; border-top: 1px solid var(--color-rule); border-radius: 0; background: none; box-shadow: none; }
.ftable-wrap.trash-wrap[data-view="tiles"] .ftable td.c-acts .acts { height: auto; align-items: center; }
.ftable-wrap.trash-wrap[data-view="tiles"] .ftable td.c-acts .iconbtn { padding: .5rem; }
.ftable-wrap.trash-wrap[data-view="tiles"] .ftable .sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (max-width: 767.98px) {
  .ftable-wrap[data-view="tiles"] .ftable td.c-name { padding: .3125rem .3125rem .625rem; }
  .ftable-wrap[data-view="tiles"] .ftable td.c-sel { top: .625rem; left: .625rem; }
  .ftable-wrap[data-view="tiles"] .ftable td.c-acts { top: .625rem; right: .625rem; }
  .ftable-wrap[data-view="tiles"] .ftable td.c-sel input[type="checkbox"] { width: 1rem; height: 1rem; }
  .ftable-wrap[data-view="tiles"] .ftable .c-name .nm > .badge { padding-top: 2rem; gap: .25rem; }
  .ftable-wrap[data-view="tiles"] .ftable .c-name .nm > .badge::before { width: 1.75rem; height: 2.125rem; }
  .ftable-wrap.trash-wrap[data-view="tiles"] .ftable .c-name .nm > .badge { padding-top: 0; }
  /* the trash tile on a phone shows the days in the sub-line; Restore keeps its label (there is room) */
  .ftable-wrap.trash-wrap[data-view="tiles"] .btn.sm .lbl-md { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
  .ftable-wrap.trash-wrap[data-view="tiles"] .btn.sm { padding: .3125rem .625rem; }
}
@media (hover: none) {
  .ftable-wrap[data-view="tiles"] .ftable tbody tr:hover { box-shadow: none; }
  .ftable-wrap[data-view="tiles"] .ftable tbody tr:hover .c-name .nm > :first-child:not(.badge) { background-color: var(--color-paper-2); }
  .ftable-wrap[data-view="tiles"] .ftable tbody tr:hover .c-name .nm > .badge { background-image: none; }
}
@media (prefers-reduced-motion: reduce) {
  .th-sort svg.i, .ftable-wrap[data-view="tiles"] .ftable tbody tr { transition: none; }
}
