/* Famille media — "premium minimal with a playful spark".
   Near-monochrome surfaces, hairlines, one tangerine accent. */

@font-face {
  font-family: "Geist";
  src: url("/static/geist.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---- tokens -------------------------------------------------------------------- */
:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f4f4f3;
  --surface-3: #ececea;
  --line: rgb(24 24 27 / .08);
  --line-2: rgb(24 24 27 / .14);
  --text: #18181b;
  --text-2: #52525b;
  --text-3: #6b6b72;
  --ink: #18181b;          /* inverse surfaces (primary button, action bar) */
  --ink-text: #fafaf9;
  --ink-text-2: #a1a1aa;
  --accent: #ff6a2b;       /* the spark */
  --accent-strong: #f0561a;
  --accent-ink: #1c0a02;   /* text on accent */
  --accent-text: #c2410c;  /* accent as text on light surfaces (AA) */
  --accent-soft: rgb(255 106 43 / .09);
  --accent-softer: rgb(255 106 43 / .05);
  --hover: rgb(24 24 27 / .035);
  --danger: #b42318;
  --danger-soft: #fef1ef;
  --glow: rgb(255 106 43 / .10);
  --glow-edge: rgb(255 106 43 / .45);
  --shadow-sm: 0 1px 2px rgb(24 24 27 / .05);
  --shadow: 0 1px 2px rgb(24 24 27 / .04), 0 6px 20px -6px rgb(24 24 27 / .08);
  --shadow-lg: 0 2px 4px rgb(24 24 27 / .06), 0 24px 48px -12px rgb(24 24 27 / .22);
  --dots: rgb(24 24 27 / .09);
  --thumb: #ffffff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09090b;
    --surface: #111113;
    --surface-2: #19191c;
    --surface-3: #232327;
    --line: rgb(255 255 255 / .07);
    --line-2: rgb(255 255 255 / .13);
    --text: #ededef;
    --text-2: #a8a8b0;
    --text-3: #8c8c95;
    --ink: #f4f4f5;
    --ink-text: #111113;
    --ink-text-2: #5c5c66;
    --accent: #ff7a3d;
    --accent-strong: #ff8a52;
    --accent-ink: #1c0a02;
    --accent-text: #ff9a66;
    --accent-soft: rgb(255 122 61 / .13);
    --accent-softer: rgb(255 122 61 / .06);
    --hover: rgb(255 255 255 / .035);
    --danger: #ff8a80;
    --danger-soft: rgb(255 90 80 / .12);
    --glow: rgb(255 122 61 / .09);
    --glow-edge: rgb(255 122 61 / .55);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px -8px rgb(0 0 0 / .6);
    --shadow-lg: 0 2px 4px rgb(0 0 0 / .4), 0 24px 56px -12px rgb(0 0 0 / .8);
    --dots: rgb(255 255 255 / .07);
  --thumb: #2a2a2f;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #09090b;
  --surface: #111113;
  --surface-2: #19191c;
  --surface-3: #232327;
  --line: rgb(255 255 255 / .07);
  --line-2: rgb(255 255 255 / .13);
  --text: #ededef;
  --text-2: #a8a8b0;
  --text-3: #8c8c95;
  --ink: #f4f4f5;
  --ink-text: #111113;
  --ink-text-2: #5c5c66;
  --accent: #ff7a3d;
  --accent-strong: #ff8a52;
  --accent-ink: #1c0a02;
  --accent-text: #ff9a66;
  --accent-soft: rgb(255 122 61 / .13);
  --accent-softer: rgb(255 122 61 / .06);
  --hover: rgb(255 255 255 / .035);
  --danger: #ff8a80;
  --danger-soft: rgb(255 90 80 / .12);
  --glow: rgb(255 122 61 / .09);
  --glow-edge: rgb(255 122 61 / .55);
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 24px -8px rgb(0 0 0 / .6);
  --shadow-lg: 0 2px 4px rgb(0 0 0 / .4), 0 24px 56px -12px rgb(0 0 0 / .8);
  --dots: rgb(255 255 255 / .07);
  --thumb: #2a2a2f;
  color-scheme: dark;
}

/* ---- base ---------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-gutter: stable; } /* no sideways jump when a long folder gets a scrollbar */
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 "Geist", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  font-feature-settings: "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
::selection { background: var(--accent-soft); }
.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;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }

.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---- buttons ------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 10px;
  font-size: 14px; font-weight: 550; letter-spacing: -.005em;
  transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(.98); }
.btn .ico { width: 18px; height: 18px; }
.btn-primary { background: var(--ink); color: var(--ink-text); box-shadow: var(--shadow-sm), inset 0 1px 0 rgb(255 255 255 / .12); }
.btn-primary:hover { box-shadow: var(--shadow), inset 0 1px 0 rgb(255 255 255 / .12); }
.btn-ghost { border-color: var(--line-2); background: var(--surface); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; height: 44px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 10px; background: transparent; color: var(--text-2);
  transition: background-color .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn .ico { width: 18px; height: 18px; }

/* ---- logo ---------------------------------------------------------------------- */
.logo { width: 28px; height: 28px; flex: none; overflow: visible; }
.logo-bg { fill: var(--ink); }
.logo-fg { fill: var(--ink-text); }
.logo-band { fill: none; stroke: var(--ink); stroke-width: .75; stroke-linecap: round; opacity: .55; }
.logo-clasp { fill: var(--accent); }
/* the trunk's lid lifts a little on hover – "La Malle" opening */
.logo-lid { transform-box: fill-box; transform-origin: 8% 100%; transition: transform .38s cubic-bezier(.3,1.6,.5,1); }
.brand:hover .logo-lid { transform: translateY(-.8px) rotate(-7deg); }

/* ---- theme toggle -------------------------------------------------------------- */
.theme-toggle {
  --seg: 32px;
  position: relative; display: inline-flex; padding: 2px; gap: 0;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2);
}
.theme-toggle button {
  position: relative; z-index: 1;
  display: grid; place-items: center;
  width: var(--seg); height: calc(var(--seg) - 4px); padding: 0;
  border: 0; border-radius: 999px; background: transparent; color: var(--text-3);
  transition: color .2s ease;
}
.theme-toggle button:hover { color: var(--text); }
.theme-toggle button[aria-pressed="true"] { color: var(--text); }
.theme-toggle .ico { width: 16px; height: 16px; }
.theme-thumb {
  position: absolute; top: 2px; left: 2px;
  width: var(--seg); height: calc(var(--seg) - 4px);
  border-radius: 999px; background: var(--thumb);
  box-shadow: 0 0 0 1px var(--line), var(--shadow-sm);
  transition: transform .32s cubic-bezier(.3,1.3,.5,1);
}
:root[data-theme-pref="light"] .theme-thumb { transform: translateX(var(--seg)); }
:root[data-theme-pref="dark"] .theme-thumb { transform: translateX(calc(var(--seg) * 2)); }
.theme-toggle button[data-set-theme="light"][aria-pressed="true"] .ico { animation: spin-in .45s cubic-bezier(.3,1.4,.5,1); }
.theme-toggle button[data-set-theme="dark"][aria-pressed="true"] .ico { animation: tilt-in .45s cubic-bezier(.3,1.4,.5,1); }

/* View-transition circle reveal for theme switches (driven from theme.js). */
html.theme-vt::view-transition-old(root),
html.theme-vt::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
html.theme-vt::view-transition-old(root) { z-index: 1; }
html.theme-vt::view-transition-new(root) { z-index: 2; }

/* Soft cross-fade between pages (same-origin navigations). */

/* ---- top bar ------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 920px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 60px; padding: 0 24px;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; letter-spacing: -.015em; min-height: 40px; }
.topbar-end { display: flex; align-items: center; gap: 12px; }
.userbox { display: flex; align-items: center; gap: 8px; padding-left: 12px; border-left: 1px solid var(--line); }
.avatar {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text);
  font-size: 12.5px; font-weight: 650; text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgb(255 106 43 / .25);
}
.username { font-size: 14px; color: var(--text-2); text-transform: capitalize; }

/* ---- page / hero --------------------------------------------------------------- */
.page {
  max-width: 920px; margin: 0 auto;
  padding: 48px 24px 120px;
  padding-left: max(24px, env(safe-area-inset-left));
  padding-right: max(24px, env(safe-area-inset-right));
}
.hero { margin-bottom: 28px; animation: rise .4s cubic-bezier(.2,.8,.2,1) both; }
.eyebrow { font-size: 13px; font-weight: 550; color: var(--text-3); letter-spacing: .01em; margin-bottom: 8px; }
/* The first hero line (date on the home page, folder path elsewhere) and the title line have
   fixed heights so everything below stays exactly in place when moving between folders. */
.hero .eyebrow, .hero .crumbs { height: 28px; display: flex; align-items: center; }
.greeting, .folder-title {
  font-size: clamp(28px, 4.2vw, 38px); line-height: 1.12; font-weight: 650; letter-spacing: -.032em;
  text-wrap: balance; overflow-wrap: anywhere;
}
.greeting .who { text-transform: capitalize; }
.wave { display: inline-block; transform-origin: 70% 75%; animation: wave 1.4s .35s ease-in-out both; }
.hero-sub { margin-top: 10px; color: var(--text-3); font-size: 14.5px; font-variant-numeric: tabular-nums; }
.hero-sub .dot { margin: 0 4px; opacity: .6; }

.crumbs {
  display: flex; align-items: center; gap: 2px; margin: 0 0 8px -6px;
  font-size: 13.5px; color: var(--text-3);
  overflow-x: auto; white-space: nowrap; scrollbar-width: none;
}
.crumbs::-webkit-scrollbar { display: none; }
.crumbs a { padding: 4px 6px; border-radius: 6px; font-weight: 500; transition: color .15s ease, background-color .15s ease; }
.crumbs a:hover { color: var(--text); background: var(--hover); }
.crumbs .sep { opacity: .5; padding: 0 1px; }

/* ---- toolbar ------------------------------------------------------------------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 10px; padding-left: 7px; }
.select-all-label { display: inline-flex; align-items: center; gap: 2px; cursor: pointer; color: var(--text-2); font-size: 13.5px; font-weight: 500; padding-right: 10px; border-radius: 10px; }
.select-all-label:hover { color: var(--text); }

.seg {
  --w: 76px;
  position: relative; display: inline-flex; padding: 3px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2);
}
.seg a {
  position: relative; z-index: 1;
  display: grid; place-items: center; width: var(--w); height: 30px;
  border-radius: 8px; font-size: 13.5px; font-weight: 550; color: var(--text-3);
  transition: color .2s ease;
}
.seg a:hover, .seg a.active { color: var(--text); }
.seg-thumb {
  position: absolute; top: 3px; left: 3px; width: var(--w); height: 30px; border-radius: 8px;
  background: var(--thumb); box-shadow: 0 0 0 1px var(--line), var(--shadow-sm);
}
.seg.is-date .seg-thumb { transform: translateX(var(--w)); }

/* ---- checkbox ------------------------------------------------------------------ */
.check { position: relative; display: grid; place-items: center; width: 44px; height: 44px; flex: none; cursor: pointer; }
.check input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.box {
  position: relative; width: 18px; height: 18px; border-radius: 6px; pointer-events: none;
  border: 1.5px solid var(--line-2); background: var(--surface);
  transition: background-color .15s ease, border-color .15s ease, transform .2s cubic-bezier(.3,1.6,.5,1), box-shadow .15s ease;
}
.check:hover .box { border-color: var(--text-3); }
.box::after {
  content: ""; position: absolute; inset: 0;
  background: var(--accent-ink);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M4.5 9.2l3 3 6-6.4' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M4.5 9.2l3 3 6-6.4' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 100% no-repeat;
  clip-path: inset(0 100% 0 0);
  transition: clip-path .22s cubic-bezier(.4,0,.2,1) .04s;
}
.check input:checked + .box,
.check input:indeterminate + .box { background: var(--accent); border-color: var(--accent); transform: scale(1.06); }
.check input:checked + .box::after { clip-path: inset(0 0 0 0); }
.check input:indeterminate + .box::after {
  -webkit-mask: none; mask: none; clip-path: none;
  inset: 7px 4px; border-radius: 2px;
}
.check input:focus-visible + .box { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); }
.check input:active + .box { transform: scale(.9); }

/* ---- list card + spotlight ----------------------------------------------------- */
.card {
  position: relative; isolation: isolate;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow);
}
.list-card { --mx: -500px; --my: -500px; }
.list-card::before, .list-card::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  opacity: 0; transition: opacity .3s ease;
}
.list-card::before {
  z-index: -1;
  background: radial-gradient(320px circle at var(--mx) var(--my), var(--glow), transparent 70%);
}
/* A glowing hairline that follows the cursor along the card edge. */
.list-card::after {
  padding: 1px;
  background: radial-gradient(220px circle at var(--mx) var(--my), var(--glow-edge), transparent 70%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.list-card:hover::before, .list-card:hover::after { opacity: 1; }

.list { list-style: none; margin: 0; padding: 4px; }
.row {
  position: relative;
  display: flex; align-items: center; gap: 0;
  min-height: 60px; padding: 0 6px 0 2px;
  border-radius: 11px;
  transition: background-color .15s ease;
  animation: rise .36s cubic-bezier(.2,.8,.2,1) both;
}
.row + .row::before {
  content: ""; position: absolute; top: 0; left: 102px; right: 14px; height: 1px; background: var(--line);
  transition: opacity .15s ease;
}
.row:hover, .row.selected, .row:focus-within { background: var(--hover); }
.row:hover::before, .row:hover + .row::before,
.row.selected::before, .row.selected + .row::before { opacity: 0; }
.row.selected { background: var(--accent-soft); }
/* Runs of selected rows merge into one soft block. */
.row.selected + .row.selected { border-top-left-radius: 0; border-top-right-radius: 0; }
.row.selected:has(+ .row.selected) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.row.selected:hover { background: color-mix(in srgb, var(--accent-soft), var(--accent) 6%); }

.name {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 14px;
  align-self: stretch; padding: 10px 8px 10px 4px; border-radius: 10px;
}
.name:focus-visible { outline-offset: -2px; }
.tile {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none;
  border-radius: 10px; background: var(--surface-2); color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .25s cubic-bezier(.3,1.5,.5,1), color .2s ease, background-color .2s ease, box-shadow .2s ease;
}
.tile .ico { width: 19px; height: 19px; }
.tile-folder { background: var(--surface-3); color: var(--text); }
.tile-folder .ico { fill: currentColor; fill-opacity: .14; }
@media (hover: hover) {
  .row:hover .tile { transform: translateY(-1px) rotate(-4deg); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--line-2); }
  .row:hover .chev { color: var(--text); transform: translateX(3px); }
}
.row.selected .tile { background: var(--accent-soft); color: var(--accent-text); box-shadow: inset 0 0 0 1px rgb(255 106 43 / .35); }

.label { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.title {
  font-weight: 520; font-size: 15px; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.meta { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; display: flex; gap: 6px; }
.meta .dot { opacity: .6; }

.dl, .chev {
  display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 10px; color: var(--text-3);
  transition: color .15s ease, background-color .15s ease, transform .2s ease;
}
.dl:hover { color: var(--accent-text); background: var(--accent-soft); }
.dl .ico { width: 19px; height: 19px; }
.chev .ico { width: 17px; height: 17px; }
.row.dropping .dl .ico { animation: drop .6s cubic-bezier(.3,1.3,.5,1); color: var(--accent-text); }

/* Desktop: size and date become aligned columns. */
@media (min-width: 720px) {
  .label { flex-direction: row; align-items: center; gap: 16px; }
  .title { flex: 1; }
  .meta { display: contents; }
  .meta .dot { display: none; }
  .m-size, .m-date { flex: none; text-align: right; font-size: 13.5px; color: var(--text-3); }
  .m-size { width: 84px; }
  .m-date { width: 104px; }
}

/* Stagger the first rows in. */
.row:nth-child(2) { animation-delay: 20ms; }
.row:nth-child(3) { animation-delay: 40ms; }
.row:nth-child(4) { animation-delay: 60ms; }
.row:nth-child(5) { animation-delay: 80ms; }
.row:nth-child(6) { animation-delay: 100ms; }
.row:nth-child(7) { animation-delay: 120ms; }
.row:nth-child(8) { animation-delay: 140ms; }
.row:nth-child(9) { animation-delay: 160ms; }
.row:nth-child(n+10) { animation-delay: 180ms; }

/* ---- floating action bar ------------------------------------------------------- */
.actionbar {
  position: fixed; z-index: 30; left: 0; right: 0;
  bottom: calc(20px + env(safe-area-inset-bottom));
  display: flex; justify-content: center; pointer-events: none;
}
.actionbar[hidden] { display: none; }
.actionbar-inner {
  display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 8px 0 10px; overflow: hidden; white-space: nowrap;
  border-radius: 999px; background: var(--ink); color: var(--ink-text);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgb(255 255 255 / .06) inset;
  opacity: 0; transform: translateY(24px) scale(.92);
  transition: opacity .2s ease, transform .32s cubic-bezier(.3,1.35,.5,1);
}
.actionbar.open .actionbar-inner { opacity: 1; transform: none; pointer-events: auto; }
.count {
  display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 9px; overflow: hidden;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums;
}
#selection-count { display: block; }
.selection-visual { display: flex; align-items: baseline; gap: 6px; padding-right: 6px; font-size: 14px; font-variant-numeric: tabular-nums; }
.sel-word { color: color-mix(in srgb, var(--ink-text) 70%, transparent); }
.sel-detail { font-weight: 600; }
.sel-detail:empty { display: none; }
.sel-detail::before { content: "·"; margin-right: 6px; font-weight: 400; color: color-mix(in srgb, var(--ink-text) 45%, transparent); }
.actions { display: flex; align-items: center; gap: 4px; padding-left: 10px; border-left: 1px solid color-mix(in srgb, var(--ink-text) 16%, transparent); }
.ab-clear, .ab-zip {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border: 0; border-radius: 999px; font-size: 14px; font-weight: 550;
  transition: background-color .15s ease, transform .15s ease;
}
.ab-clear { background: transparent; color: var(--ink-text); opacity: .78; }
.ab-clear .ico { display: none; width: 18px; height: 18px; }
.ab-clear:hover { opacity: 1; background: color-mix(in srgb, var(--ink-text) 10%, transparent); }
.ab-zip { background: var(--accent); color: var(--accent-ink); padding: 0 16px 0 13px; }
.ab-zip:hover { background: var(--accent-strong); }
.ab-zip:active, .ab-clear:active { transform: scale(.97); }
.ab-zip .ico { width: 18px; height: 18px; stroke-width: 2; }
.actionbar :focus-visible { outline-color: var(--accent); outline-offset: 2px; border-radius: 999px; }

/* ---- empty / not found --------------------------------------------------------- */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  padding: 56px 24px 64px;
  border: 1px dashed var(--line-2); border-radius: 20px;
  background: radial-gradient(ellipse 55% 65% at 50% 0%, var(--accent-softer), transparent);
  animation: rise .4s cubic-bezier(.2,.8,.2,1) both;
}
.empty h1, .empty h2 { font-size: 20px; font-weight: 650; letter-spacing: -.02em; margin-top: 6px; }
.empty p { color: var(--text-3); max-width: 340px; font-size: 14.5px; }
.empty .btn { margin-top: 14px; }

.empty-art { width: 168px; height: 126px; overflow: visible; }
.ea-shadow { fill: var(--text); opacity: .07; transform-origin: 80px 106px; animation: shadow 3.2s ease-in-out infinite; }
.ea-float { animation: bob 3.2s ease-in-out infinite; }
.ea-back { fill: var(--surface-3); stroke: var(--line-2); stroke-width: 1.2; }
.ea-paper { transform-box: fill-box; transform-origin: 50% 100%; }
.ea-paper rect { fill: var(--surface); stroke: var(--line-2); stroke-width: 1.2; }
.ea-pic { fill: none; stroke: var(--text-3); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .7; }
.ea-sun { fill: var(--accent); }
.ea-paper-1 { animation: peek-1 3.2s ease-in-out infinite; }
.ea-paper-2 { animation: peek-2 3.2s ease-in-out infinite; }
.ea-front { fill: var(--ink); }
.ea-face { fill: none; stroke: var(--ink-text); stroke-width: 2.4; stroke-linecap: round; }
.ea-spark { fill: var(--accent); transform-box: fill-box; transform-origin: center; animation: twinkle 2.4s ease-in-out infinite; }
.ea-spark-2 { animation-delay: .8s; }
.ea-spark-3 { animation-delay: 1.5s; }

/* ---- login --------------------------------------------------------------------- */
.login-page {
  display: grid; place-items: center; align-content: center; gap: 20px;
  padding: 80px 16px 40px; position: relative; overflow-x: hidden;
}
.login-page::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(var(--dots) 1px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-mask: radial-gradient(ellipse 60% 55% at 50% 45%, #000 30%, transparent 75%);
  mask: radial-gradient(ellipse 60% 55% at 50% 45%, #000 30%, transparent 75%);
}
.login-page::after {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
  width: 520px; height: 520px; left: 50%; top: 42%; translate: -50% -50%;
  border-radius: 50%; background: radial-gradient(circle, var(--glow), transparent 65%);
  filter: blur(10px);
}
.login-corner { position: fixed; top: 16px; right: 16px; top: max(16px, env(safe-area-inset-top)); }
.login-card {
  width: 100%; max-width: 380px;
  padding: 36px 32px 32px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow-lg);
  animation: rise .45s cubic-bezier(.2,.8,.2,1) both;
}
.login-mark { margin-bottom: 22px; }
.login-mark .logo { width: 44px; height: 44px; }
.login-mark .logo-lid { animation: lid-peek 1.1s .35s cubic-bezier(.3,1.4,.5,1) both; }
.login-card h1 { font-size: 26px; font-weight: 650; letter-spacing: -.03em; line-height: 1.15; }
.login-lede { margin-top: 6px; color: var(--text-3); font-size: 14.5px; }
.login-form { display: grid; gap: 14px; margin-top: 26px; }
.login-form .btn-block { margin-top: 8px; }
.field { display: grid; gap: 6px; }
.field span { font-size: 13px; font-weight: 550; color: var(--text-2); }
.field input {
  height: 44px; padding: 0 13px;
  border: 1px solid var(--line-2); border-radius: 11px; background: var(--bg);
  font-size: 15px; outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.field input:hover { border-color: color-mix(in srgb, var(--text) 25%, transparent); }
.field input:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 4px var(--accent-soft); }
.alert {
  margin-top: 18px; padding: 10px 12px; border-radius: 10px;
  background: var(--danger-soft); color: var(--danger); font-size: 14px; font-weight: 500;
  animation: shake .4s cubic-bezier(.36,.07,.19,.97) both;
}
.login-foot { font-size: 12.5px; color: var(--text-3); }

/* ---- small screens ------------------------------------------------------------- */
@media (max-width: 719px) {
  .topbar-inner { height: 56px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .topbar-end { gap: 8px; }
  .username { display: none; }
  .userbox { padding-left: 8px; gap: 4px; }
  .icon-btn { width: 40px; height: 40px; }
  .theme-toggle { --seg: 38px; }
  .page { padding: 28px 16px 120px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .hero { margin-bottom: 20px; }
  .toolbar { padding-left: 3px; }
  .seg { --w: 72px; }
  .seg a, .seg-thumb { height: 34px; }
  .list { padding: 2px; }
  .row { padding: 0 2px 0 0; min-height: 64px; }
  .row + .row::before { left: 98px; right: 10px; }
  .name { gap: 12px; padding-left: 2px; }
  .tile { width: 40px; height: 40px; }
  .dl, .chev { width: 44px; height: 44px; }
  .actionbar { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .actionbar-inner { width: 100%; padding: 0 6px 0 8px; gap: 8px; }
  .selection-visual { flex: 1; min-width: 0; overflow: hidden; font-size: 13.5px; }
  .actions { padding-left: 4px; gap: 2px; }
  .ab-clear { width: 40px; padding: 0; justify-content: center; }
  .ab-clear .ico { display: block; }
  .ab-clear span { display: none; }
  .ab-zip { padding: 0 14px 0 11px; }
  .login-card { padding: 30px 22px 24px; border-radius: 20px; }
}
@media (max-width: 380px) {
  .ab-zip span { display: none; }
  .ab-zip { width: 44px; padding: 0; justify-content: center; }
}
@media (pointer: coarse) {
  .theme-toggle { --seg: 40px; }
}

/* ---- keyframes ----------------------------------------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes wave {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(14deg); } 30% { transform: rotate(-8deg); }
  45% { transform: rotate(14deg); } 60% { transform: rotate(-4deg); } 75% { transform: rotate(10deg); }
}
@keyframes spin-in { from { transform: rotate(-90deg) scale(.6); } }
@keyframes tilt-in { from { transform: rotate(40deg) scale(.6); } }
@keyframes drop { 0% { transform: none; } 35% { transform: translateY(5px); opacity: 0; } 36% { transform: translateY(-8px); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes shadow { 0%, 100% { transform: scaleX(1); opacity: .08; } 50% { transform: scaleX(.86); opacity: .05; } }
@keyframes peek-1 { 0%, 100% { transform: rotate(-6deg) translateY(0); } 50% { transform: rotate(-9deg) translateY(-4px); } }
@keyframes peek-2 { 0%, 100% { transform: rotate(5deg) translateY(0); } 50% { transform: rotate(8deg) translateY(-6px); } }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: 1; } 50% { transform: scale(.5) rotate(45deg); opacity: .4; } }
@keyframes lid-peek { 0%, 100% { transform: none; } 35%, 55% { transform: translateY(-1px) rotate(-12deg); } }
@keyframes twinkle-once { 0% { transform: scale(0) rotate(-120deg); } 100% { transform: none; } }
@keyframes shake { 20%, 80% { transform: translateX(-2px); } 40%, 60% { transform: translateX(3px); } }

/* ---- reduced motion ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important;
    transition-duration: 1ms !important; transition-delay: 0s !important;
  }
  .list-card::before, .list-card::after { display: none; }
}

/* ---- back button ------------------------------------------------------------------ */
.title-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.title-row .folder-title { min-width: 0; }
.back-btn {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2);
  box-shadow: var(--shadow-sm); transition: color .15s ease, border-color .15s ease, transform .2s cubic-bezier(.3,1.6,.5,1);
}
.back-btn .ico { width: 19px; height: 19px; transition: transform .2s cubic-bezier(.3,1.6,.5,1); }
.back-btn:hover { color: var(--text); border-color: var(--text-3); }
.back-btn:hover .ico { transform: translateX(-2px); }
.back-btn:active { transform: scale(.94); }
.back-btn { position: relative; }
.back-btn::after { content: ""; position: absolute; inset: -6px; }
@media (max-width: 600px) { .back-btn { width: 30px; height: 30px; border-radius: 9px; } .back-btn .ico { width: 17px; height: 17px; } }

/* ---- in-place folder navigation (app.js) ---------------------------------------- */
/* The page itself swaps instantly; only these parts animate. The toolbar and the list frame
   are the same on both pages, so they stay perfectly still – the frame just grows/shrinks
   to the new number of rows while the text inside cross-fades. */
html.nav-vt::view-transition-old(root), html.nav-vt::view-transition-new(root) { animation: none; }
html.nav-vt .hero { view-transition-name: hero; }
html.nav-vt .toolbar { view-transition-name: toolbar; }
html.nav-vt #list-card, html.nav-vt .empty { view-transition-name: list; }
/* default cross-fade (plus-lighter): pixels that are identical on both pages stay perfectly still */
html.nav-vt::view-transition-group(*) { animation-duration: .26s; animation-timing-function: cubic-bezier(.2,.8,.2,1); }
main.page.swapped .hero, main.page.swapped .row, main.page.swapped .toolbar, main.page.swapped .card, main.page.swapped .empty { animation: none; }
@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  html.nav-vt::view-transition-group(*), html.nav-vt::view-transition-old(*), html.nav-vt::view-transition-new(*) { animation: none !important; }
}

/* ---- admin tools (admin.js) ------------------------------------------------------ */
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; gap: 7px; }
.btn-sm .ico { width: 16px; height: 16px; }
.btn-danger { background: var(--danger); color: #fff; box-shadow: var(--shadow-sm); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }

/* Positioned so the hero keeps exactly the same height as for everyone else. */
.hero { position: relative; }
.admin-actions { position: absolute; right: 0; bottom: -6px; display: flex; gap: 8px; }
@media (max-width: 600px) {
  .admin-actions .btn { width: 34px; padding: 0; }
  .admin-actions .btn span { display: none; }
}

.more {
  display: grid; place-items: center; width: 34px; height: 40px; flex: none; margin-left: -2px;
  border: 0; border-radius: 10px; background: transparent; color: var(--text-3);
  opacity: 0; transition: opacity .15s ease, color .15s ease, background-color .15s ease;
}
.row:hover .more, .more:focus-visible, .more[aria-expanded="true"] { opacity: 1; }
.more:hover, .more[aria-expanded="true"] { color: var(--text); background: var(--hover); }
.more .ico { width: 18px; height: 18px; }
@media (hover: none) { .more { opacity: 1; } }

.row-menu {
  position: fixed; z-index: 60; left: var(--x, 0); top: var(--y, 0); min-width: 168px; padding: 5px;
  border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface);
  box-shadow: var(--shadow-lg); animation: menu-in .14s cubic-bezier(.2,.8,.2,1);
}
.row-menu[hidden] { display: none; }
.row-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 14px; text-align: left;
}
.row-menu-item:hover, .row-menu-item:focus-visible { background: var(--hover); outline: none; }
.row-menu-item .ico { width: 17px; height: 17px; color: var(--text-3); }
.row-menu-item.danger, .row-menu-item.danger .ico { color: var(--danger); }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

.ab-del {
  display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px;
  border: 0; border-radius: 999px; background: transparent; color: #ff8a80; font-size: 14px; font-weight: 550;
  transition: background-color .15s ease;
}
.ab-del:hover { background: color-mix(in srgb, #ff8a80 14%, transparent); }
.ab-del .ico { width: 17px; height: 17px; }
@media (max-width: 600px) { .ab-del { width: 40px; padding: 0; justify-content: center; } .ab-del span { display: none; } }

/* dialog */
.dlg { padding: 0; border: 0; background: transparent; color: var(--text); max-width: calc(100vw - 32px); }
.dlg::backdrop { background: rgb(9 9 11 / .38); backdrop-filter: blur(3px); }
.dlg[open] .dlg-card { animation: dlg-in .2s cubic-bezier(.2,.9,.3,1.2); }
.dlg-card {
  width: 380px; max-width: 100%; padding: 22px; border: 1px solid var(--line-2); border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow-lg);
}
.dlg-title { font-size: 17px; font-weight: 650; letter-spacing: -.015em; }
.dlg-text { margin-top: 6px; color: var(--text-2); font-size: 14px; line-height: 1.45; }
.dlg-input {
  width: 100%; height: 42px; margin-top: 16px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 15px;
}
.dlg-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dlg-error { margin-top: 10px; color: var(--danger); font-size: 13.5px; }
.dlg-error:empty { display: none; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.97); } }

/* drag & drop overlay */
.drop-overlay {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; transition: opacity .15s ease, visibility .15s;
}
.drop-overlay.show { opacity: 1; visibility: visible; }
.drop-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 44px; text-align: center;
  border: 2px dashed var(--accent); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-lg);
  transform: scale(.96); transition: transform .25s cubic-bezier(.3,1.5,.5,1);
}
.drop-overlay.show .drop-card { transform: none; }
.drop-card .ico { width: 34px; height: 34px; color: var(--accent); animation: bob 1.6s ease-in-out infinite; }
.drop-title { font-size: 17px; font-weight: 650; }
.drop-sub { color: var(--text-3); font-size: 13.5px; }

/* upload panel – lives on <body>, so it survives folder navigation */
.uploads {
  position: fixed; z-index: 40; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); width: 340px;
  border: 1px solid var(--line-2); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-lg);
  overflow: hidden; animation: dlg-in .25s cubic-bezier(.2,.9,.3,1.2);
  transition: bottom .3s cubic-bezier(.2,.8,.2,1);
}
body.has-selection .uploads { bottom: calc(92px + env(safe-area-inset-bottom)); }
.uploads-head { display: flex; align-items: center; gap: 2px; height: 48px; padding: 0 6px 0 16px; border-bottom: 1px solid var(--line); }
.uploads-title { flex: 1; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.uploads-toggle .ico { transform: rotate(90deg); transition: transform .2s ease; }
.uploads.collapsed .uploads-toggle .ico { transform: rotate(-90deg); }
.uploads.collapsed .uploads-list { display: none; }
.uploads.collapsed .uploads-head { border-bottom: 0; }
.uploads-list { list-style: none; max-height: 300px; overflow-y: auto; padding: 6px 0; }
.upl { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 16px; }
.upl-name { font-size: 13.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upl-where { font-size: 12px; color: var(--text-3); white-space: nowrap; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.upl-bar { grid-column: 1 / -1; height: 4px; margin: 5px 0 3px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.upl-fill { display: block; height: 100%; width: 100%; border-radius: inherit; background: var(--accent); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform .25s ease; }
.upl-bar { --p: 0; }
.upl-fill { transform: scaleX(var(--p)); }
.upl-status { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.upl-retry { grid-row: 3; grid-column: 2; width: 28px; height: 28px; margin: -6px -6px -6px 0; }
.upl-retry .ico { width: 15px; height: 15px; }
.upl.processing .upl-fill { animation: pulse 1s ease-in-out infinite; }
.upl.done .upl-fill { background: #22a06b; }
.upl.done .upl-status { color: #22a06b; }
.upl.error .upl-fill { background: var(--danger); }
.upl.error .upl-status { color: var(--danger); }
.upl.retrying .upl-status { color: var(--accent-text); }
@keyframes pulse { 50% { opacity: .45; } }
@media (max-width: 600px) {
  .uploads { left: 12px; right: 12px; width: auto; bottom: calc(12px + env(safe-area-inset-bottom)); }
  body.has-selection .uploads { bottom: calc(80px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) { .drop-card .ico, .upl.processing .upl-fill { animation: none; } }
.upl-retry[hidden] { display: none; }
