:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e2e5ea;
  --text: #1c2430;
  --muted: #626b80;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  /* Filled controls carry white text, so their colors are tuned for 4.5:1 in each theme. */
  --accent-fill: #2563eb;
  --accent-fill-hover: #1d4ed8;
  --danger-fill: #c62828;
  --on-fill: #ffffff;
  --accent-soft: #e8efff;
  --danger: #c62828;
  --warn-bg: #fff6e0;
  --warn-text: #7a5300;
  --folder: #e0a526;
  /* Logo: box faces, inside, flaps/files, folder */
  --logo-1: #2563eb;
  --logo-2: #1d4ed8;
  --logo-3: #93b4f8;
  --logo-4: #183c8f;
  --logo-5: #e0a526;
  --logo-6: #ffffff;
  --radius: 8px;
  --shadow: 0 8px 28px rgb(16 24 40 / 0.14);
  --shadow-lift: 0 18px 44px rgb(16 24 40 / 0.2); /* the focused search bar, lifted off the page */
  --dial-mix: 16%; /* how strongly the search dial is tinted with the accent */
  --scrim: rgb(10 14 20 / 0.42); /* dims the page behind Spotlight */
  /* File types, like colored labels on files. Used only for file icons and their search
     filters. --ft-*-fill is the solid version, which carries a white icon. */
  --ft-pdf: #d03a3f;
  --ft-sheet: #1e8449;
  --ft-doc: #2f6b92;
  --ft-image: #8048c4;
  --ft-slide: #cc5520;
  --ft-archive: #6b6150;
  --ft-pdf-fill: #d03a3f;
  --ft-sheet-fill: #1e8449;
  --ft-doc-fill: #2f6b92;
  --ft-image-fill: #8048c4;
  --ft-tint: 13%; /* how much of the type color fills the page shape */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #181c22;
    --surface-2: #20252d;
    --border: #2c323b;
    --text: #e6e9ee;
    --muted: #9aa3af;
    --accent: #5b8def;
    --accent-hover: #7aa3f3;
    --accent-fill: #3b6fd9;
    --accent-fill-hover: #2f5cc0;
    --danger-fill: #c23b3b;
    --accent-soft: #1f2b44;
    --danger: #f06262;
    --warn-bg: #3a2e12;
    --warn-text: #f3cf7a;
    --folder: #e8b84a;
    --logo-1: #5b8def;
    --logo-2: #3f6fd6;
    --logo-3: #a9c3fa;
    --logo-4: #1e3a74;
    --logo-5: #e8b84a;
    --logo-6: #dce5f5;
    --shadow: 0 8px 28px rgb(0 0 0 / 0.5);
    --shadow-lift: 0 18px 44px rgb(0 0 0 / 0.6);
    --dial-mix: 28%;
    --scrim: rgb(0 0 0 / 0.55);
    --ft-pdf: #f2696e;
    --ft-sheet: #4cc285;
    --ft-doc: #74afd8;
    --ft-image: #b892f2;
    --ft-slide: #f0905c;
    --ft-archive: #b3a68e;
    --ft-pdf-fill: #c2363b;
    --ft-sheet-fill: #1d7a44;
    --ft-doc-fill: #2b6489;
    --ft-image-fill: #7a45bb;
    --ft-tint: 20%;
    --chip-tint: 26%;
    color-scheme: dark;
  }
}

/* Archivo, the app's one family. A variable font: width (62–125%) and weight (100–900)
   come from these two files. Bundled, not loaded from Google, so Obox works on a LAN with
   no internet. SIL Open Font License: see fonts/Archivo-OFL.txt.
   The latin-ext file only downloads if a page shows characters from its range. */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("fonts/archivo-var-latin.woff2") format("woff2");
  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;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("fonts/archivo-var-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 0.9375rem/1.45 "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-stretch: 100%;
}

/* Titles take the wordmark's wider cut; everything else stays at normal width. */
:root { --title-stretch: 112%; }

svg { width: 18px; height: 18px; flex: none; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-underline-offset: 0.15em; }

/* Browser-drawn surfaces follow the palette too. */
html { scrollbar-color: color-mix(in srgb, var(--muted) 45%, transparent) transparent; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--text); }
input, textarea { caret-color: var(--accent); }
::placeholder { color: var(--muted); opacity: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Top bar ---------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}
/* Set like a stamped equipment or records label: expanded, uppercase, widely tracked. */
.brand .wordmark {
  font-stretch: var(--title-stretch);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.brand .logo { width: 34px; height: 34px; margin-block: -4px; overflow: visible; }

/* Logo animation. app.js adds .play on page load and when the logo is hovered:
   the front flaps fold open, the files are flipped through, and the amber
   folder lifts as if found, then everything settles. At rest the logo is complete. */
.logo .lg-flap, .logo .lg-flap-front, .logo .lg-body, .logo .lg-sift, .logo .lg-pick { transform-box: fill-box; }
.logo .lg-flap-front { transform-origin: 50% 0%; }
.logo .lg-body, .logo .lg-sift, .logo .lg-pick { transform-origin: 50% 100%; }

@keyframes lg-flap-in {
  0% { transform: translateY(9px); opacity: 0; }
  60% { transform: translateY(-2px); opacity: 1; }
  100% { transform: none; opacity: 1; }
}
@keyframes lg-flap-out {
  0% { transform: scaleY(0.2); opacity: 0; }
  60% { transform: scaleY(1.12); opacity: 1; }
  100% { transform: none; opacity: 1; }
}
@keyframes lg-settle {
  from { transform: translateY(3px); }
  to { transform: none; }
}
@keyframes lg-sift {
  0% { transform: none; }
  18% { transform: translateY(-4px) rotate(-8deg); }
  40% { transform: translateY(-1px) rotate(6deg); }
  62% { transform: rotate(-2.5deg); }
  80% { transform: rotate(1deg); }
  100% { transform: none; }
}
@keyframes lg-pick {
  0% { transform: none; }
  14% { transform: translateY(-3px) rotate(-7deg); }
  32% { transform: rotate(5deg); }
  55% { transform: translateY(-9px) rotate(0deg); }
  72% { transform: translateY(-9px); }
  88% { transform: translateY(1px); }
  100% { transform: none; }
}

.logo.play .lg-flap { animation: lg-flap-in 620ms 160ms ease-out both; }
.logo.play .lg-flap.lg-later { animation-delay: 240ms; }
.logo.play .lg-body { animation: lg-settle 700ms cubic-bezier(0.22, 1, 0.36, 1) both; }
.logo.play .lg-flap-front { animation: lg-flap-out 600ms 60ms ease-out both; }
.logo.play .lg-flap-front.lg-later { animation-delay: 140ms; }
.logo.play .lg-sift { animation: lg-sift 1050ms ease-in-out both; }
.logo.play .lg-pick { animation: lg-pick 1500ms ease-in-out both; }
.logo.play .lg-t1 { animation-delay: 150ms; }
.logo.play .lg-t2 { animation-delay: 270ms; }
.logo.play .lg-t3 { animation-delay: 390ms; }
.logo.play .lg-t4 { animation-delay: 510ms; }

@media (prefers-reduced-motion: reduce) {
  .logo.play * { animation: none !important; }
}

/* Search ------------------------------------------------------------------ */
/* The top bar holds a trigger that looks like a search field. It opens Spotlight: a large
   centered search bar with the file-type dial on its right end, live results below, over a
   dimmed page. */

.search-trigger {
  flex: 1;
  min-width: 0;
  max-width: 520px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 12px;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--muted);
  text-align: left;
  cursor: text;
}
.search-trigger:hover { background: var(--surface); border-color: var(--border); }
.search-trigger.has-search { color: var(--text); }
.search-trigger-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trigger-chip {
  flex: none;
  padding: 2px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ft, var(--accent)) var(--chip-tint, 14%), var(--surface));
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 500;
}
.search-icon { fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

/* Spotlight ---------------------------------------------------------------- */

.spotlight {
  --spot-top: 14vh;
  width: min(720px, calc(100vw - 32px));
  max-width: none;
  max-height: none;
  margin: var(--spot-top) auto 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  overflow: visible;
}
.spotlight::backdrop { background: var(--scrim, rgb(10 14 20 / 0.42)); backdrop-filter: blur(4px); }

/* The bar. Geometry: its rounded end is a semicircle of radius --cap. The dial is a half ring
   around that end: buttons sit on a circle of radius --btn-ring (just clear of the bar), and
   the tinted ring under them is exactly one button wide. */
.spot-bar {
  --bar-h: 60px;
  --cap: calc(var(--bar-h) / 2);
  --btn: 38px;
  --btn-ring: calc(var(--cap) + 2px + var(--btn) / 2);
  --dial-r: calc(var(--btn-ring) + var(--btn) / 2);
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--bar-h);
  margin-right: calc(var(--dial-r) - var(--cap)); /* bar plus dial span the panel's width */
  padding: 0 12px 0 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-lift);
}
.spot-bar .search-icon { width: 24px; height: 24px; }
.spot-bar input {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: none;
  font-size: 1.375rem;
}
/* No browser clear (×) button: Esc clears, and it would crowd the filter tag. */
.spot-bar input::-webkit-search-cancel-button { display: none; }

/* Active filter tag inside the bar ("PDFs ×"); clicking it removes the filter. */
.filter-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 8px 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ft, var(--accent)) var(--chip-tint, 14%), var(--surface));
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
}
.filter-chip:hover { border-color: var(--accent); }
.filter-chip svg { width: 13px; height: 13px; fill: none; stroke: var(--muted); stroke-width: 2.4; stroke-linecap: round; }

.dial {
  position: absolute;
  top: 50%;
  right: calc(var(--cap) - var(--dial-r)); /* the ring's centre sits on the bar end's centre */
  width: calc(var(--dial-r) * 2);
  height: calc(var(--dial-r) * 2);
  margin-top: calc(var(--dial-r) * -1);
  pointer-events: none; /* only the buttons take clicks; the box overlaps the bar */
}
.dial-ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
/* The ring runs through the button centres and is exactly one button wide, from the top
   button (-75°) to the bottom one (+75°). Its rounded ends are therefore concentric with
   those buttons, so the tint ends where they do. The circle is turned 180° so its path
   starts at 9 o'clock, inside the dash gap, and the visible arc has no seam.
   Path units are degrees (pathLength 360): 150° drawn, 210° gap, starting 105° in. */
.dial-ring circle {
  cx: 50%;
  cy: 50%;
  r: var(--btn-ring);
  fill: none;
  stroke: color-mix(in srgb, var(--accent) var(--dial-mix), var(--surface));
  stroke-width: var(--btn);
  stroke-linecap: round;
  stroke-dasharray: 150 210;
  stroke-dashoffset: 255;
  transform: rotate(180deg);
  transform-box: fill-box;
  transform-origin: center;
}
.dial-btn {
  --a: 0deg;
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--btn);
  height: var(--btn);
  margin: calc(var(--btn) / -2) 0 0 calc(var(--btn) / -2);
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--accent);
  cursor: pointer;
  pointer-events: auto;
  transform: translate(calc(cos(var(--a)) * var(--btn-ring)), calc(sin(var(--a)) * var(--btn-ring)));
}
.dial-btn:nth-of-type(1) { --a: -75deg; }
.dial-btn:nth-of-type(2) { --a: -25deg; }
.dial-btn:nth-of-type(3) { --a: 25deg; }
.dial-btn:nth-of-type(4) { --a: 75deg; }
.dial-btn:hover { background: var(--surface); }
.dial-btn { color: var(--ft, var(--accent)); }
.dial-btn[aria-pressed="true"] { background: var(--ft-fill, var(--accent-fill)); color: var(--on-fill); }
.dial-btn:focus-visible { outline-offset: 1px; }
.dial-btn svg {
  width: calc(var(--btn) * 0.62);
  height: calc(var(--btn) * 0.62);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dial-btn text {
  fill: currentColor;
  stroke: none;
  font-size: 7.4px;
  font-weight: 800;
  font-stretch: 85%;
  letter-spacing: 0.2px;
}

/* Results, below the bar (and below the dial's lowest button). */
.spot-panel {
  margin-top: 48px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lift);
}
.spot-results {
  margin: 0;
  padding: 6px;
  /* As tall as the screen allows below the bar and dial, keeping room for the footer; at most 30rem. */
  max-height: min(30rem, calc(100dvh - var(--spot-top) - 60px - 48px - 7rem));
  overflow-y: auto;
  list-style: none;
}
.spot-results:empty { display: none; }
.spot-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius);
  cursor: pointer;
}
.spot-row[aria-selected="true"] { background: var(--accent-soft); }
.spot-row > svg { width: 22px; height: 22px; }
.spot-text { flex: 1; display: grid; min-width: 0; }
.spot-name { overflow-wrap: anywhere; }
.spot-name mark { background: none; color: inherit; font-weight: 700; }
.spot-where { font-size: 0.8125rem; color: var(--muted); overflow-wrap: anywhere; }
.spot-row .badge { flex: none; }
.spot-row kbd { visibility: hidden; }
.spot-row[aria-selected="true"] kbd { visibility: visible; }
.spot-status { margin: 0; padding: 22px 20px; color: var(--muted); text-align: center; }
.spot-status:empty { display: none; }
.spot-retry-row { margin: -10px 0 0; padding-bottom: 18px; text-align: center; }
.spot-retry-row:has([hidden]) { display: none; }
.spot-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  padding: 8px 10px 8px 18px;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--muted);
}
.spot-keys { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.spot-keys kbd:not(:first-child) { margin-left: 2px; }

/* Opening: the bar drops in, the dial swings out of its end, the results follow. */
.spotlight .spot-bar,
.spotlight .spot-panel {
  opacity: 0;
  transform: translateY(-14px) scale(0.97);
  transition: opacity 200ms ease-out, transform 380ms cubic-bezier(0.22, 1, 0.36, 1);
}
.spotlight .dial {
  opacity: 0;
  transform: rotate(-35deg) scale(0.8);
  transition: opacity 200ms ease-out 90ms, transform 420ms cubic-bezier(0.22, 1, 0.36, 1) 90ms;
}
.spotlight .spot-panel { transition-delay: 60ms; }
.spotlight.is-open .spot-bar,
.spotlight.is-open .spot-panel,
.spotlight.is-open .dial { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .spotlight .spot-bar, .spotlight .spot-panel, .spotlight .dial { transform: none !important; transition: opacity 120ms linear; }
}

.account { margin-left: auto; display: flex; align-items: center; gap: 12px; }
/* Same height as the search field, so the top bar's controls share one edge. */
.account .btn { min-height: 2.5rem; padding: 0 14px; font-size: 0.875rem; font-weight: 500; }
.account .btn svg, .who svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.account .btn svg { color: var(--muted); }
.account .btn:hover svg { color: var(--text); }
.who { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.875rem; }
.who:empty { display: none; }
.who strong { color: var(--text); font-weight: 600; }

/* Buttons ---------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-fill); }
.btn.primary:hover { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); }
.btn.danger { background: var(--danger-fill); border-color: var(--danger-fill); color: var(--on-fill); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Main ------------------------------------------------------------------- */

main { max-width: 1100px; margin: 0 auto; padding: 20px; }

.bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }

.crumbs { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px; font-size: 1.0625rem; min-height: 36px; }
.crumbs a { color: var(--muted); text-decoration: none; padding: 4px 6px; border-radius: 6px; }
.crumbs a:hover { background: var(--surface-2); color: var(--text); }
.crumbs .current { margin: 0; font-size: 1.375rem; line-height: 1.25; font-weight: 650; font-stretch: var(--title-stretch); padding: 4px 6px; overflow-wrap: anywhere; }
.crumbs .sep { color: var(--muted); }
.crumbs .clear-search { align-self: center; margin-left: 10px; padding: 4px 10px; font-size: 0.8125rem; }

.banner {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--warn-bg);
  color: var(--warn-text);
}

.table-wrap {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.listing { width: 100%; border-collapse: collapse; }

/* Shown only when a folder takes more than a moment to load (slow shares). */
.table-wrap.loading #listing-body { opacity: 0.5; transition: opacity 150ms ease-out; }
.table-wrap.loading::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: 35%;
  height: 2px;
  background: var(--accent);
  animation: loading-slide 1.1s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}
@keyframes loading-slide {
  from { transform: translateX(-100%); }
  to { transform: translateX(300%); }
}
@media (prefers-reduced-motion: reduce) {
  .table-wrap.loading::before { width: 100%; opacity: 0.6; animation: none; }
}
.listing th {
  text-align: left;
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.listing td { padding: 6px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.listing tbody tr:last-child td { border-bottom: 0; }
.listing tbody tr:hover { background: var(--surface-2); }
.listing .num, .listing .date { color: var(--muted); font-size: 0.875rem; white-space: nowrap; width: 1%; font-variant-numeric: tabular-nums; }
.listing .actions { width: 1%; white-space: nowrap; text-align: right; }
.listing .location a { color: var(--muted); font-size: 0.875rem; text-decoration: none; }
.listing .location a:hover { text-decoration: underline; }
.listing tr.is-hidden .name-link { color: var(--muted); }
.listing tr.is-hidden .name-link svg { opacity: 0.6; }

.name-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 4px 0;
  color: var(--text);
  text-decoration: none;
}
.name-link:hover .name { text-decoration: underline; }
.name-text { display: grid; min-width: 0; }
.name-line { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; min-width: 0; }
.name { min-width: 0; overflow-wrap: anywhere; }
/* File names can be in any script. Isolating them stops a right-to-left name (Arabic, Hebrew)
   from reordering the text around it (badges, size and date, "+ 2 more"). */
.name, .spot-name, .spot-where, .cat-peek li span, .cat-link, .crumbs a, .crumbs .current, .upload-row .label { unicode-bidi: isolate; }
.loc-inline { display: none; }
.meta-inline { display: none; font-size: 0.8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.name-link svg { width: 20px; height: 20px; }
.ico-dir { fill: var(--folder); }
.fi { --ft: var(--muted); fill: none; stroke: var(--ft); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.fi .pg { fill: color-mix(in srgb, var(--ft) var(--ft-tint), var(--surface)); }
.fi-other .pg { fill: none; }
.fi .gf { fill: var(--ft); stroke: none; }

/* File types ------------------------------------------------------------- */
/* One color per type (The File Label Rule): the file icon, its Spotlight dial button,
   and its filter tag. The mark inside each icon differs too, so color is never the only cue. */
.fi-pdf, [data-type="pdf"] { --ft: var(--ft-pdf); --ft-fill: var(--ft-pdf-fill); }
.fi-sheet, [data-type="spreadsheet"] { --ft: var(--ft-sheet); --ft-fill: var(--ft-sheet-fill); }
.fi-doc, [data-type="document"] { --ft: var(--ft-doc); --ft-fill: var(--ft-doc-fill); }
.fi-image, [data-type="image"] { --ft: var(--ft-image); --ft-fill: var(--ft-image-fill); }
.fi-slide { --ft: var(--ft-slide); }
.fi-archive { --ft: var(--ft-archive); }

.badge {
  font-size: 0.75rem;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn-text);
  white-space: nowrap;
}

.banner.note { background: var(--surface-2); color: var(--muted); }

.empty { margin: 0; padding: 40px 20px; text-align: center; color: var(--muted); }

/* Trash ------------------------------------------------------------------ */

.trash-name { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 0; }
.trash-name svg { width: 20px; height: 20px; flex: none; }
.trash-meta { font-size: 0.8125rem; color: var(--muted); overflow-wrap: anywhere; }
.account .btn[aria-current="page"] { background: var(--surface-2); }

/* Radio choices in dialogs (restore conflicts, merging an uploaded folder). */
.choices { margin: 0; padding: 0; border: 0; display: grid; gap: 8px; min-width: 0; }
.choices legend { padding: 0; margin-bottom: 4px; font-size: 0.875rem; color: var(--muted); }
.dlg-body label.choice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
}
.dlg-body label.choice:has(input:checked) { border-color: var(--accent); }
.dlg-body .choice input { width: auto; margin: 3px 0 0; padding: 0; accent-color: var(--accent); }
.choice > span { display: grid; gap: 2px; }
.choice strong { font-weight: 600; }
.choice span span { color: var(--muted); }
.empty-msg { margin: 0 0 12px; }

/* Categories (Home) ------------------------------------------------------ */
/* Top-level folders are the plant's departments. On Home each is a drawer label:
   a manila tab (it's a container you open, per The Manila Rule), the name set like
   the wordmark, what's inside, and when it last changed. */

.cats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 24px 14px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.cats.loading { opacity: 0.5; transition: opacity 150ms ease-out; }

.cat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 16px 16px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.cat::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 14px;
  width: 54px;
  height: 7px;
  background: var(--folder);
  border-radius: 4px 4px 0 0;
}
.cat:hover { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cat:has(.cat-link:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.cat-name {
  margin: 0;
  padding-right: 36px; /* room for the admin ⋯ button */
  font-size: 1rem;
  font-weight: 700;
  font-stretch: var(--title-stretch);
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
/* The whole label opens the category; the link's hit area is stretched over it. */
.cat-link { color: var(--text); text-decoration: none; }
.cat-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.cat-link:focus-visible { outline: none; }

.cat-more { position: absolute; top: 8px; right: 8px; z-index: 1; }
.cat .badge { align-self: flex-start; }
.cat.is-hidden::before { opacity: 0.5; }
.cat.is-hidden .cat-link { color: var(--muted); }

.cat-meta { margin: 0; font-size: 0.8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cat-peek { display: grid; gap: 3px; margin: 2px 0 0; padding: 0; list-style: none; font-size: 0.8125rem; }
.cat-peek li { display: flex; align-items: center; gap: 7px; min-width: 0; }
.cat-peek li span { overflow-wrap: anywhere; }
.cat-peek svg { width: 14px; height: 14px; }
.cat-peek .more { padding-left: 21px; color: var(--muted); }
.cat-updated {
  margin: auto 0 0;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.section-title {
  margin: 28px 0 10px;
  font-size: 1rem;
  font-weight: 650;
  font-stretch: var(--title-stretch);
}

/* Uploads ---------------------------------------------------------------- */

.uploads {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
}
.upload-batch { display: grid; gap: 8px; }
.upload-batch + .upload-batch { border-top: 1px solid var(--border); padding-top: 10px; }
.upload-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 2rem; }
.upload-head strong { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; overflow-wrap: anywhere; unicode-bidi: isolate; }
.upload-head svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.upload-head .btn { flex: none; padding: 3px 12px; font-size: 0.8125rem; }
.upload-batch.has-errors .upload-head strong { color: var(--danger); }
/* A big folder lists hundreds of files; keep the panel from pushing the listing off the screen. */
.upload-list { display: grid; gap: 8px; max-height: 14rem; overflow-y: auto; }
.upload-row { display: grid; grid-template-columns: 1fr 160px; gap: 12px; align-items: center; font-size: 0.875rem; }
.upload-row .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-row .status { color: var(--muted); text-align: right; }
.upload-row.error .status { color: var(--danger); }
.upload-row progress { width: 100%; accent-color: var(--accent); }

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 3px dashed var(--accent);
  pointer-events: none;
}
.drop-label {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 48px);
  padding: 18px 26px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 1.125rem;
  color: var(--text);
}
.drop-label svg, .dropzone svg { flex: none; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.drop-label svg { width: 28px; height: 28px; }
.dz-target { font-weight: 650; color: var(--text); overflow-wrap: anywhere; unicode-bidi: isolate; }

/* Admins: a standing reminder under the listing that files and folders can be dragged in. */
.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-top: 12px;
  padding: 18px 20px;
  border: 1px dashed color-mix(in srgb, var(--muted) 60%, transparent);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}
.dropzone[hidden] { display: none; }
.dropzone svg { width: 22px; height: 22px; }
.dropzone strong { color: var(--text); font-weight: 600; }
.dropzone:hover { background: var(--surface); border-color: var(--accent); }
.dropzone:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* What was just uploaded, until you leave the folder: a blue wash plus an "Uploaded" tag. */
.listing tbody tr.is-fresh, .listing tbody tr.is-fresh:hover { background: var(--accent-soft); }
.cat.is-fresh { border-color: var(--accent); background: var(--accent-soft); }
.badge.fresh {
  background: var(--surface);
  color: var(--accent-hover);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent);
}

/* Row menu --------------------------------------------------------------- */

.menu {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 6px;
  min-width: 180px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.menu button {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.menu button:hover:not(:disabled), .menu button:focus-visible { background: var(--surface-2); outline: none; }
.menu button:disabled { color: var(--muted); cursor: default; }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }

/* Dialog ----------------------------------------------------------------- */

.dlg {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.dlg.wide { width: min(960px, calc(100vw - 32px)); }
.dlg::backdrop { background: var(--scrim, rgb(10 14 20 / 0.42)); }
.dlg form { padding: 20px; }
.dlg h2 { margin: 0 0 14px; font-size: 1.125rem; font-weight: 650; font-stretch: var(--title-stretch); overflow-wrap: anywhere; }
.dlg-body { display: grid; gap: 12px; }
.dlg-body p { margin: 0; overflow-wrap: anywhere; }
.dlg-body label { display: grid; gap: 4px; font-size: 0.875rem; color: var(--muted); }
.dlg-body input, .dlg-body select, .dlg-body textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}
.dlg-body input:focus, .dlg-body select:focus, .dlg-body textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.dlg-body textarea {
  height: min(65vh, 640px);
  resize: vertical;
  font: 0.8125rem/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace;
  tab-size: 4;
}
.dlg-error { color: var(--danger); margin: 10px 0 0; min-height: 0; }
.dlg-error:empty { display: none; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* Toast ------------------------------------------------------------------ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 30;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow);
}
.toast.error { background: var(--danger-fill); color: var(--on-fill); }

/* Windows High Contrast ------------------------------------------------- */
/* Forced colors drop backgrounds, so states shown by a fill get a system-colored outline too. */
@media (forced-colors: active) {
  .dial-btn[aria-pressed="true"] { outline: 3px solid Highlight; outline-offset: 1px; }
  .spot-row[aria-selected="true"] { outline: 2px solid Highlight; outline-offset: -2px; }
  .listing tbody tr:hover, .cat:hover { outline: 1px solid Highlight; }
  .cat::before { forced-color-adjust: none; background: CanvasText; }
  .filter-chip, .trigger-chip, .badge { border: 1px solid CanvasText; }
  .table-wrap.loading::before { forced-color-adjust: none; background: Highlight; }
}

/* Touch screens ---------------------------------------------------------- */

@media (pointer: coarse) {
  .btn { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .crumbs a, .crumbs .current { padding: 10px 8px; }
  .menu button { padding: 12px; }
  .dropzone:not([hidden]) { display: none; } /* nothing to drag on a touch screen; the toolbar buttons remain */
}

/* Small screens ---------------------------------------------------------- */

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .search-trigger { order: 3; flex-basis: 100%; max-width: none; }
  .search-trigger kbd { display: none; }
  .spotlight { --spot-top: 52px; width: calc(100vw - 24px); } /* leaves room for the dial's top button */
  .crumbs .current { font-size: 1.25rem; }
  .spot-bar { --bar-h: 52px; --btn: 36px; padding-left: 16px; }
  .spot-bar input { font-size: 1.125rem; }
  .spot-panel { margin-top: 44px; }
  .spot-keys { display: none; }
  main { padding: 16px; }
  .toolbar { margin-left: 0; width: 100%; }
  .listing .num, .listing .date, .listing th.num, .listing th.date { display: none; }
  .meta-inline { display: block; }
  .cats { gap: 20px; }
  .cat-peek { display: none; }
  .listing .location { display: none; }
  .loc-inline {
    display: block;
    padding: 2px 0 8px 30px; /* lines up with the name; keeps the tap target over 24px tall */
    margin-top: -4px;
    font-size: 0.8125rem;
    color: var(--muted);
    text-decoration: none;
    overflow-wrap: anywhere;
  }
  .listing td, .listing th { padding-left: 10px; padding-right: 10px; }
  .upload-row { grid-template-columns: 1fr 90px; }
}

/* Narrow phones: the Trash button keeps only its icon so the top bar fits on one line. */
@media (max-width: 480px) {
  .account .btn-label { display: none; }
  .account #trash-link { padding: 0 10px; }
}
