/* ==========================================================================
   haolang-li.com — macOS Finder UI (dark, orange accent)
   Reference: user's own Finder, macOS Sequoia, dark mode
   ========================================================================== */

:root {
  --accent: #FF9F0A;
  --accent-sel: #C87A2C;          /* selected label pill / list row */
  --accent-menu: #CB7B1D;         /* menu hover highlight */

  --desktop-bg: #1a1c24;
  --menubar-bg: rgba(24, 24, 26, .62);
  --menubar-fg: #E9E9EC;

  --win-bg: #202022;
  --sidebar-bg: rgba(40, 40, 43, .82);
  --sidebar-fg: #DFDFE2;
  --sidebar-sec: #85858B;
  --sidebar-sel: rgba(255, 255, 255, .13);

  --toolbar-fg: #A9A9AE;
  --title-fg: #E8E8EA;
  --text: #E8E8EA;
  --text-dim: #98989D;
  --hairline: rgba(255, 255, 255, .085);
  --row-alt: rgba(255, 255, 255, .032);
  --icon-hilite: rgba(255, 255, 255, .16);

  --menu-bg: rgba(44, 44, 47, .76);
  --menu-fg: #E8E8EA;
  --menu-dim: #7C7C82;

  --folder: #7FA9D6;              /* navy family, legible on dark chrome */
  --app-plate: #EDE8DC;           /* cream plate, near-black mark */
  --app-mark: #16161A;

  --icon-size: 72px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
/* dvh tracks the browser chrome on phones, so the status bar never falls off-screen */
@supports (height: 100dvh) { html, body { height: 100dvh; } }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--desktop-bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}
/* no double-tap zoom, no 300ms tap delay — every control answers on the first tap */
button, .desk-item, .icon-item, .lv-row, .col-row, .gal-thumb, .dr-row, .side-item, .dg-item {
  touch-action: manipulation;
}
button { font-family: inherit; background: none; border: 0; color: inherit; cursor: default; }
svg { display: block; }

/* ================= desktop wallpaper ================= */
.desktop {
  position: fixed; inset: 25px 0 0 0;
  background:
    radial-gradient(120% 90% at 75% 10%, #3d3348 0%, transparent 55%),
    radial-gradient(110% 100% at 20% 95%, #17323e 0%, transparent 60%),
    linear-gradient(160deg, #23222d 0%, #14151c 55%, #0d0e13 100%);
  overflow: hidden;
}

/* ================= menu bar ================= */
.menubar {
  position: fixed; top: 0; left: 0; right: 0; height: 25px;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 8px;
  background: var(--menubar-bg);
  backdrop-filter: blur(30px) saturate(1.6);
  -webkit-backdrop-filter: blur(30px) saturate(1.6);
  color: var(--menubar-fg);
  font-size: 13px;
  z-index: 500;
}
.mb-left, .mb-right { display: flex; align-items: center; height: 100%; gap: 2px; }
.mb-left { min-width: 0; flex: 0 1 auto; overflow: hidden; }
.mb-right { min-width: 0; flex: 0 0 auto; }
.mb-name {
  height: 100%; padding: 0 10px;
  display: flex; align-items: center; border-radius: 5px;
  font-size: 12.5px; font-weight: 700;
  letter-spacing: .14em;            /* small type wants positive tracking */
  color: var(--menubar-fg);
}
.mb-name:hover { background: rgba(255, 255, 255, .14); }
.mb-theme {
  height: 20px; width: 26px; margin-right: 2px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 5px; color: var(--menubar-fg);
}
.mb-theme:hover { background: rgba(255, 255, 255, .14); }
.mb-theme svg { width: 15px; height: 15px; }
.mb-theme .ic-moon { display: none; }
[data-theme="light"] .mb-theme .ic-sun { display: none; }
[data-theme="light"] .mb-theme .ic-moon { display: block; }
.mb-clock { padding: 0 8px 0 6px; font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ================= dropdown menus ================= */
.dropdown {
  position: fixed;
  min-width: 210px;
  padding: 5px;
  background: var(--menu-bg);
  backdrop-filter: blur(50px) saturate(1.8);
  -webkit-backdrop-filter: blur(50px) saturate(1.8);
  border: .5px solid rgba(255, 255, 255, .14);
  border-radius: 8px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .45), 0 0 0 .5px rgba(0, 0, 0, .5);
  z-index: 600;
  font-size: 13px;
  color: var(--menu-fg);
  /* materialize: blur + scale arrive together, anchored to the summoning point */
  animation: dd-in .14s ease-out;
  will-change: transform, opacity, filter;
}
@keyframes dd-in {
  from { opacity: 0; transform: scale(.96); filter: blur(5px); }
  to   { opacity: 1; transform: scale(1); filter: blur(0); }
}
.dd-item {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 3px 9px; min-height: 22px;
  border-radius: 5px; white-space: nowrap;
}
.dd-item .kbd { color: var(--menu-dim); font-size: 12.5px; letter-spacing: .06em; }
.dd-item:not(.disabled):hover { background: var(--accent-menu); color: #fff; }
.dd-item:not(.disabled):hover .kbd { color: rgba(255, 255, 255, .75); }
.dd-item.disabled { color: var(--menu-dim); }
.dd-item .check { width: 14px; display: inline-block; }
.dd-sep { height: 1px; margin: 5px 10px; background: rgba(255, 255, 255, .14); }
.dd-tags { display: flex; gap: 7px; padding: 5px 9px; }
.dd-tags i {
  width: 13px; height: 13px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,.25);
}

/* ================= window ================= */
.window {
  position: absolute;
  left: max(20px, calc(50% - 620px)); top: 3.5%;
  width: min(1240px, calc(100% - 40px));
  height: min(780px, 88%);
  border-radius: 11px;
  box-shadow:
    0 0 0 .5px rgba(0, 0, 0, .65),
    inset 0 0 0 .5px rgba(255, 255, 255, .14),
    0 24px 68px rgba(0, 0, 0, .55),
    0 8px 22px rgba(0, 0, 0, .35);
  overflow: hidden;
  will-change: transform;
}
.window.fullscreen { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; }
.window.fullscreen .resize-handle { display: none; }
.window.win-gone { visibility: hidden; pointer-events: none; }
body.has-fullscreen .dock-wrap { display: none; }
.win-body { display: flex; height: 100%; }

/* ---- sidebar ---- */
.sidebar {
  width: 190px; flex: 0 0 auto;
  background: var(--sidebar-bg);
  backdrop-filter: blur(40px) saturate(1.5);
  -webkit-backdrop-filter: blur(40px) saturate(1.5);
  border-right: 1px solid rgba(0, 0, 0, .38);
  display: flex; flex-direction: column;
  transition: margin-left .22s ease;
}
.sidebar.collapsed { margin-left: -190px; }
.traffic { display: flex; gap: 8px; padding: 19px 0 14px 20px; flex: 0 0 auto; cursor: default; }
.tl {
  width: 12px; height: 12px; border-radius: 50%; padding: 0;
  display: flex; align-items: center; justify-content: center;
}
.tl svg { width: 12px; height: 12px; opacity: 0; }
.traffic:hover .tl svg { opacity: 1; }
.tl:active { filter: brightness(.82); }
.tl-close { background: #FF5F57; box-shadow: inset 0 0 0 .5px rgba(0,0,0,.15); }
.tl-min   { background: #FEBC2E; box-shadow: inset 0 0 0 .5px rgba(0,0,0,.15); }
.tl-zoom  { background: #28C840; box-shadow: inset 0 0 0 .5px rgba(0,0,0,.15); }

.side-scroll { flex: 1; overflow-y: auto; padding: 0 10px 14px; }

/* build footer: reload past the cache, and show which build is loaded */
.side-foot { flex: 0 0 auto; padding: 8px 10px 12px; border-top: 1px solid var(--hairline); }
.side-refresh {
  display: flex; align-items: center; gap: 7px;
  width: 100%; height: 28px; padding: 0 8px;
  border-radius: 6px;
  font-size: 12px; color: var(--text-dim);
}
.side-refresh svg { width: 15px; height: 15px; flex: 0 0 auto; }
.side-refresh:hover { background: rgba(255, 255, 255, .06); color: var(--sidebar-fg); }
.side-refresh.spin svg { animation: sf-spin .6s linear infinite; }
@keyframes sf-spin { to { transform: rotate(360deg); } }
.sf-build { margin-left: auto; font-variant-numeric: tabular-nums; opacity: .7; }
[data-theme="light"] .side-refresh:hover { background: rgba(0, 0, 0, .05); }
@media (prefers-reduced-motion: reduce) { .side-refresh.spin svg { animation: none; } }
.side-sec {
  font-size: 11px; font-weight: 700; color: var(--sidebar-sec);
  padding: 12px 8px 4px; letter-spacing: .01em;
}
.side-item {
  display: flex; align-items: center; gap: 7px;
  width: 100%; height: 28px; padding: 0 8px;
  border-radius: 6px;
  font-size: 13px; color: var(--sidebar-fg);
  text-align: left; white-space: nowrap; overflow: hidden;
}
.side-item svg { width: 17px; height: 17px; flex: 0 0 auto; color: var(--folder); }
.side-item span { overflow: hidden; text-overflow: ellipsis; }
.side-item.active { background: var(--sidebar-sel); }
.side-item:not(.active):hover { background: rgba(255, 255, 255, .06); }
.side-item .tagdot {
  width: 11px; height: 11px; border-radius: 50%; margin: 0 3px;
  border: .5px solid rgba(0,0,0,.3); flex: 0 0 auto;
}

/* ---- main column ---- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--win-bg); }

/* ---- toolbar ---- */
.toolbar {
  height: 52px; flex: 0 0 auto;
  display: flex; align-items: center; gap: 2px;
  padding: 0 12px 0 10px;
}
.tb-btn {
  height: 28px; min-width: 30px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center; gap: 1px;
  border-radius: 6px; color: var(--toolbar-fg);
}
.tb-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .07); }
.tb-btn:active:not(:disabled) { background: rgba(255, 255, 255, .12); }
.tb-btn:disabled { color: #5A5A5E; }
.tb-btn svg { width: 17px; height: 17px; }
.tb-btn .tb-chev { width: 11px; height: 11px; margin-left: 1px; }
.tb-nav { display: flex; gap: 6px; margin-right: 10px; }
.tb-nav .tb-btn svg { width: 19px; height: 19px; }
.tb-title {
  font-size: 15px; font-weight: 600; color: var(--title-fg);
  letter-spacing: -0.01em;   /* negative tracking as type grows */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-spacer { flex: 1; }
.tb-actions { display: flex; gap: 6px; }
.tb-sidebar-toggle { display: none; margin-right: 4px; }

/* ---- content ---- */
.content {
  flex: 1; position: relative; overflow: auto; outline: none;
}
.content::-webkit-scrollbar { width: 14px; height: 14px; }
.content::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.22); border-radius: 7px;
  border: 4px solid transparent; background-clip: padding-box;
}
.content::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.35); border: 4px solid transparent; background-clip: padding-box; }

/* icon view */
.icon-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(calc(var(--icon-size) + 44px), 1fr));
  align-content: start;
  gap: 18px 6px;
  padding: 14px 10px 24px;
  min-height: 100%;
}
.icon-item {
  justify-self: center;
  width: calc(var(--icon-size) + 40px);
  display: flex; flex-direction: column; align-items: center;
  gap: 3px;
}
.icon-item .ic-frame {
  width: calc(var(--icon-size) + 16px); height: calc(var(--icon-size) + 8px);
  display: flex; align-items: center; justify-content: center;
  border-radius: 5px;
}
.icon-item svg.file-icon { width: var(--icon-size); height: var(--icon-size); filter: drop-shadow(0 1px 2px rgba(0,0,0,.3)); }
.icon-item .ic-label {
  max-width: 100%;
  padding: 1px 6px; border-radius: 4px;
  font-size: 13px; line-height: 16px; text-align: center;
  color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.icon-item.selected .ic-frame { background: var(--icon-hilite); }
.icon-item.selected .ic-label { background: var(--accent-sel); color: #fff; }
.icon-item .ic-label input {
  font: inherit; color: #000; background: #fff;
  border: 0; outline: 2px solid var(--accent); border-radius: 2px;
  text-align: center; width: 120px;
}

/* ================= digital: a justified photo wall =================
   Every frame keeps its own aspect ratio — nothing is cropped. Rows are
   solved in JS (renderDigital) so each row's tiles land flush with both
   edges; only the last, partial row sits unstretched. One view only: no
   labels, no kind tags, no icon/list/columns fallback. */
.digital-view { min-height: 100%; padding: 3px; background: #0b0b0c; }
/* gallery-wall placard: room to breathe before the wall of prints starts */
.dg-caption { padding: 34px 22px 26px; }
.dg-caption-title {
  font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: rgba(255,255,255,.92);
}
.dg-caption-sub { margin-top: 5px; font-size: 12px; letter-spacing: .02em; color: rgba(255,255,255,.48); }
.dg-rows { display: flex; flex-direction: column; }
.dg-row { display: flex; }
.dg-item {
  position: relative; flex: 0 0 auto; overflow: hidden;
  padding: 0; border: 0; cursor: default; background: #0b0b0c;
}
.dg-item img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  transition: transform .3s cubic-bezier(.2,.8,.2,1), filter .2s;
}
.dg-item:hover img { transform: scale(1.03); }
.dg-item.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.dg-item.selected img { filter: brightness(.94); }
@media (max-width: 740px) {
  .digital-view { padding: 2px; }
  .dg-caption { padding: 22px 14px 18px; }
}

/* list view */
.list-view { min-height: 100%; font-size: 13px; }
.lv-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; height: 25px; align-items: center;
  background: var(--win-bg);
  border-bottom: 1px solid var(--hairline);
  color: var(--text-dim); font-size: 11px;
}
.lv-col { padding: 0 8px; display: flex; align-items: center; gap: 4px; height: 100%; border-left: 1px solid var(--hairline); }
.lv-col:first-child { border-left: 0; padding-left: 24px; flex: 1 1 44%; min-width: 160px; }
.lv-col.c-date { flex: 0 0 26%; } .lv-col.c-size { flex: 0 0 12%; justify-content: flex-end; } .lv-col.c-kind { flex: 1 1 18%; }
.lv-col .sort-arrow { font-size: 9px; }
.lv-row { display: flex; height: 24px; align-items: center; }
.lv-row:nth-child(even) { background: var(--row-alt); }
.lv-row.selected { background: var(--accent-sel); color: #fff; }
.lv-row.selected .lv-dim { color: rgba(255,255,255,.8); }
.lv-cell { padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lv-cell.c-name { flex: 1 1 44%; min-width: 160px; display: flex; align-items: center; gap: 6px; }
.lv-cell.c-name svg { width: 16px; height: 16px; flex: 0 0 auto; }
.lv-cell.c-date { flex: 0 0 26%; } .lv-cell.c-size { flex: 0 0 12%; text-align: right; } .lv-cell.c-kind { flex: 1 1 18%; }
.lv-dim { color: var(--text-dim); }

/* ================= desk: the Desktop's own arrangement =================
   Restrained: one navy, one cream, wide tracking, generous air. The portrait
   is the only thing that moves. */
/* Top band reads left to right: the papers, then who wrote them, then where he is.
   Rows below span the full width. */
.desk-view {
  min-height: 100%;
  padding: 30px 30px 34px;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  grid-template-rows: auto auto auto;
  column-gap: 30px; row-gap: 30px;
  align-content: start;
}
/* the portrait sits straight after the papers */
.desk-view > .portrait {
  grid-column: 2; grid-row: 1;
  justify-self: start;
  border-left: 1px solid var(--hairline); padding-left: 30px;
}

/* -- left: the papers -- */
.desk-aside {
  grid-column: 1; grid-row: 1;
  display: flex; flex-direction: column; gap: 24px;
  min-width: 300px; max-width: 360px;   /* keep the rows readable, not stretched */
}

/* -- right corner: the two clocks -- */
.wx {
  grid-column: 3; grid-row: 1;
  justify-self: end; align-self: start;
  width: min(300px, 100%);
  display: flex; flex-direction: column; gap: 2px;
}
.wx-row {
  display: grid; grid-template-columns: 1fr auto auto;
  align-items: baseline; gap: 14px;
  padding: 7px 0;
  border-bottom: 1px solid var(--hairline);
}
.wx-city {
  font-size: 11px; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--text-dim);
}
.wx-time { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.wx-temp {
  font-size: 20px; font-weight: 300; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; color: var(--text);
  min-width: 46px; text-align: right;
}

.desk-files { list-style: none; display: flex; flex-direction: column; }
.desk-file {
  display: grid; grid-template-columns: 42px 1fr auto;
  align-items: center; gap: 16px;
  padding: 14px 12px; border-radius: 10px;
  border-bottom: 1px solid var(--hairline);
}
.desk-file:last-child { border-bottom: 0; }
.desk-file svg { width: 42px; height: 42px; }
.df-name { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.df-kind {
  font-size: 10px; font-weight: 700; letter-spacing: .14em;
  color: var(--text-dim); text-transform: uppercase;
}
.desk-file:hover { background: rgba(255, 255, 255, .05); }
.desk-file.selected { background: var(--accent-sel); color: #fff; }
.desk-file.selected .df-kind { color: rgba(255, 255, 255, .78); }

/* -- right: the rotating portrait -- */
.portrait { grid-column: 2; grid-row: 1; margin: 0; display: flex; flex-direction: column; gap: 9px; }
.pt-frame {
  position: relative;
  width: 194px; aspect-ratio: 4 / 5;
  overflow: hidden; border-radius: 3px;
  background: #16324F;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .07), 0 14px 34px rgba(0, 0, 0, .32);
}
.pt-frame img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 1.1s ease;
}
.pt-frame img.on { opacity: 1; }
.pt-frame.empty { display: flex; align-items: center; justify-content: center; }
.pt-mono {
  font-size: 30px; font-weight: 300; letter-spacing: .22em;
  color: #EDE8DC; opacity: .34; padding-left: .22em;
}
.pt-cap {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  font-size: 10px; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; color: var(--text-dim);
}
.pt-dots { display: flex; gap: 4px; }
.pt-dots i {
  width: 4px; height: 4px; border-radius: 50%;
  background: currentColor; opacity: .3; transition: opacity .5s ease;
}
.pt-dots i.on { opacity: .9; }

/* ================= guest book mode =================
   The desktop itself becomes the page. */
.mb-mode {
  height: 20px; padding: 0 7px; margin-right: 2px;
  display: flex; align-items: center; gap: 5px;
  border-radius: 5px; color: var(--menubar-fg); font-size: 12px;
}
.mb-mode:hover { background: rgba(255, 255, 255, .14); }
.mb-mode svg { width: 14px; height: 14px; }
.mb-mode .mb-chev { width: 11px; height: 11px; opacity: .7; }
[data-theme="light"] .mb-mode:hover { background: rgba(0, 0, 0, .07); }

.gb-layer { position: absolute; inset: 0; z-index: 40; background: #000; }
.gb-canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
body.gb-on .dock-wrap { display: none; }
.gb-live {
  font-size: 11px; color: var(--text-dim); letter-spacing: .02em;
  margin-right: 4px; white-space: nowrap;
}

.gb-tools {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px;
  max-width: calc(100% - 32px);
  background: var(--menu-bg);
  backdrop-filter: blur(36px) saturate(1.7);
  -webkit-backdrop-filter: blur(36px) saturate(1.7);
  border: .5px solid rgba(255, 255, 255, .14);
  border-radius: 13px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
  flex-wrap: wrap; justify-content: center;
}
.gb-group { display: flex; align-items: center; gap: 5px; }
.gb-group + .gb-group { border-left: 1px solid var(--hairline); padding-left: 9px; }
.gb-tool {
  width: 30px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 7px; color: var(--text-dim);
}
.gb-tool svg { width: 17px; height: 17px; }
.gb-tool:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.gb-tool.on { background: rgba(255, 255, 255, .14); color: var(--text); }
.gb-inks { gap: 6px; }
.gb-ink { width: 17px; height: 17px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.gb-ink.on { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25), 0 0 0 2px var(--accent); }
.gb-btn {
  height: 28px; padding: 0 11px; border-radius: 7px;
  font-size: 12px; color: var(--text);
  background: rgba(255, 255, 255, .08);
  display: flex; align-items: center; gap: 6px;
}
.gb-btn:hover { background: rgba(255, 255, 255, .15); }
.gb-btn.primary { background: #2E5077; color: #fff; }
.gb-btn.primary:hover { background: #38618f; }
.gb-btn:active, .gb-tool:active { transform: scale(.96); transition: transform 80ms ease-out; }
.gb-n {
  padding: 1px 6px; border-radius: 9px;
  background: rgba(255, 255, 255, .12);
  font-size: 10px; font-variant-numeric: tabular-nums;
}
[data-theme="light"] .gb-btn { background: rgba(0, 0, 0, .07); }
[data-theme="light"] .gb-btn:hover { background: rgba(0, 0, 0, .12); }
[data-theme="light"] .gb-btn.primary { background: #2E5077; color: #fff; }
[data-theme="light"] .gb-tool:hover { background: rgba(0, 0, 0, .06); }
[data-theme="light"] .gb-tool.on { background: rgba(0, 0, 0, .1); }

.gb-caret { position: absolute; z-index: 5; transform: translateY(-50%); }
.gb-text-in {
  min-width: 200px; padding: 3px 6px;
  background: transparent; border: 0;
  border-bottom: 2px solid currentColor;
  font: 600 26px var(--font);
  outline: none;
}
.gb-toast {
  position: absolute; left: 50%; bottom: 84px; transform: translate(-50%, 8px);
  padding: 7px 14px; border-radius: 9px;
  background: var(--menu-bg);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: .5px solid rgba(255, 255, 255, .14);
  font-size: 12px; color: var(--text);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.gb-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* name-it dialog */
.nd-wrap {
  position: fixed; inset: 0; z-index: 720;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .3);
}
.nd-card {
  width: min(320px, 88vw); padding: 18px;
  background: var(--menu-bg);
  backdrop-filter: blur(40px) saturate(1.8);
  -webkit-backdrop-filter: blur(40px) saturate(1.8);
  border: .5px solid rgba(255, 255, 255, .16);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
}
.nd-title { font-size: 13px; font-weight: 600; color: var(--text); padding-bottom: 12px; }
.nd-input {
  width: 100%; height: 32px; padding: 0 10px;
  border-radius: 7px; border: 1px solid var(--hairline);
  background: rgba(255, 255, 255, .07);
  font: inherit; font-size: 13px; color: var(--text);
  outline: none;
}
.nd-input:focus { border-color: var(--accent); }
.nd-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 14px; }
.dp-btn.danger { background: #B23B3B; color: #fff; }
.dp-btn.danger:hover { background: #c74747; }

/* ================= admin ================= */
#mb-admin.on-admin { color: #57C785; }        /* lock turns green when signed in */
body.admin-on #mb-admin { color: #57C785; }

/* a small control cluster pinned to each editable folder */
.fadmin {
  position: absolute; top: 6px; left: 6px;
  display: none; gap: 3px; z-index: 4;
  padding: 3px; border-radius: 8px;
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
body.admin-on .desk-block .fadmin,
body.admin-on .icon-item .fadmin { display: flex; }
.fa-btn {
  width: 20px; height: 20px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #EDE8DC; line-height: 1;
}
.fa-btn:hover { background: rgba(255, 255, 255, .18); }
.desk-block { }
.icon-item { position: relative; }

/* the "New folder" affordances */
.desk-block.new-folder {
  align-items: center; justify-content: center;
  background: transparent;
  border: 1.5px dashed var(--hairline);
  color: var(--text-dim); font-size: 22px; font-weight: 300;
}
.desk-block.new-folder::before { display: none; }
.desk-block.new-folder .db-name { font-size: 10px; letter-spacing: .12em; opacity: .8; }
.desk-block.new-folder:hover { background: rgba(255, 255, 255, .04); color: var(--text); transform: none; }
.icon-item.new-folder .ic-frame {
  font-size: 34px; font-weight: 300; color: var(--text-dim);
  border: 1.5px dashed var(--hairline); border-radius: 10px;
  width: calc(var(--icon-size) + 8px); height: calc(var(--icon-size) + 8px);
}
.icon-item.new-folder:hover .ic-frame { color: var(--text); }

/* materials panel extras (reuses .gwin / .gw-* ) */
.up-head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--hairline);
}
.up-note { font-size: 11px; color: var(--text-dim); }
.up-file {
  width: 100%; aspect-ratio: 5 / 3; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  background: #2E5077; color: #EDE8DC; font-size: 12px; font-weight: 700; letter-spacing: .1em;
}

/* shared toast */
.hl-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 8px);
  z-index: 900; padding: 9px 16px; border-radius: 10px;
  background: var(--menu-bg); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  border: .5px solid rgba(255, 255, 255, .14);
  font-size: 12.5px; color: var(--text);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
}
.hl-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* the book, as a floating window */
.gwin {
  position: fixed; z-index: 700;
  left: max(8px, calc(50% - 300px)); top: 14%;
  width: min(600px, calc(100% - 16px)); height: min(460px, 74vh);
  background: var(--win-bg);
  border-radius: 11px;
  box-shadow: 0 0 0 .5px rgba(0, 0, 0, .65), inset 0 0 0 .5px rgba(255, 255, 255, .14),
    0 24px 68px rgba(0, 0, 0, .55);
  display: flex; flex-direction: column; overflow: hidden;
  will-change: transform, opacity;
}
.gw-title {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-right: 22px;
  font-size: 13px; font-weight: 600; color: var(--text);
}
.gw-n {
  padding: 1px 7px; border-radius: 9px;
  background: rgba(255, 255, 255, .1);
  font-size: 10px; font-weight: 500; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.gw-body { flex: 1; overflow-y: auto; padding: 16px; }
.gw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 14px; }
.gw-card { position: relative; margin: 0; }
.gw-card img {
  width: 100%; aspect-ratio: 5 / 3; object-fit: cover;
  border-radius: 4px;                       /* the wallpaper is baked in */
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .09);
}
.gw-card figcaption {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  padding-top: 6px;
}
.gw-name { font-size: 12px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gw-when { font-size: 10px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.gw-del {
  position: absolute; top: 6px; right: 6px;
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(0, 0, 0, .5); color: #fff;
  font-size: 14px; line-height: 1;
  opacity: 0; transition: opacity .15s ease;
}
.gw-card:hover .gw-del { opacity: 1; }
.gw-empty { padding: 44px 20px; text-align: center; font-size: 13px; color: var(--text-dim); line-height: 1.7; }
.gw-note {
  padding: 8px 11px; margin-bottom: 14px;
  border-radius: 7px; background: rgba(255, 255, 255, .06);
  font-size: 11.5px; color: var(--text-dim);
}
.gw-card.pending img { opacity: .58; }
.gw-flag {
  position: absolute; left: 6px; top: 6px;
  padding: 2px 7px; border-radius: 6px;
  background: rgba(0, 0, 0, .62); color: #EDE8DC;
  font-size: 9.5px; font-weight: 600; letter-spacing: .06em;
}
[data-theme="light"] .gw-note { background: rgba(0, 0, 0, .05); }

[data-theme="light"] .gb-n, [data-theme="light"] .gw-n { background: rgba(0, 0, 0, .08); }
[data-theme="light"] .nd-input { background: rgba(0, 0, 0, .04); }

/* -- the folders, as blocks -- */
.desk-folders {
  grid-column: 1 / -1; grid-row: 2;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(98px, 126px));
  justify-content: start;
  gap: 26px;
  padding-top: 26px;
  border-top: 1px solid var(--hairline);
}
.desk-block {
  position: relative;
  aspect-ratio: 1 / .84;
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 11px;
  background: #24456B;
  border-radius: 12px;
  text-align: left;
  overflow: hidden;
  transition: background .18s ease, transform .18s ease;
}
.desk-block::before {          /* the sleeve's cut corner — the folder, abstracted */
  content: ""; position: absolute; top: 0; left: 0;
  width: 46%; height: 11px;
  background: #16324F;
  border-bottom-right-radius: 5px;
}
.db-name {
  font-size: 12.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #EDE8DC;
  line-height: 1.25;
}
.db-count {
  position: absolute; top: 9px; right: 11px;
  font-size: 11px; font-variant-numeric: tabular-nums;
  color: #EDE8DC; opacity: .45;
}
.desk-block:hover { background: #2C5480; transform: translateY(-2px); }
.desk-block.selected { background: #2C5480; box-shadow: inset 0 0 0 2px var(--accent); }

/* -- recently updated: derived from the tree, never hand-kept -- */
.desk-recent {
  grid-column: 1 / -1; grid-row: 3;
  padding-top: 22px;
  border-top: 1px solid var(--hairline);
}
.dr-head {
  font-size: 10px; font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase; color: var(--text-dim);
  padding-bottom: 4px;
}
.dr-list { list-style: none; }
.dr-row {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto 42px;
  align-items: center; gap: 12px;
  padding: 9px 6px;
  border-bottom: 1px solid var(--hairline);
  border-radius: 5px;
}
.dr-row:last-child { border-bottom: 0; }
.dr-row svg { width: 20px; height: 20px; }
.dr-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-where {
  font-size: 10px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-dim);
}
.dr-when {
  font-size: 11px; color: var(--text-dim);
  font-variant-numeric: tabular-nums; text-align: right;
}
.dr-row:hover { background: rgba(255, 255, 255, .05); }

@media (prefers-reduced-motion: reduce) {
  .pt-frame img { transition: none; }
  .desk-block { transition: none; }
  .desk-block:hover { transform: none; }
}
[data-theme="light"] .desk-file:hover,
[data-theme="light"] .dr-row:hover { background: rgba(0, 0, 0, .05); }
[data-theme="light"] .pt-frame { box-shadow: 0 0 0 1px rgba(0, 0, 0, .08), 0 14px 34px rgba(0, 0, 0, .16); }

/* Below this the three top zones can't share a row without crushing the clocks,
   so the clocks take a row of their own — still hugging the right edge. */
@media (max-width: 940px) {
  .desk-view { grid-template-columns: auto minmax(0, 1fr); grid-template-rows: repeat(4, auto); }
  .wx { grid-column: 1 / -1; grid-row: 2; row-gap: 0; }
  .desk-folders { grid-row: 3; }
  .desk-recent { grid-row: 4; }
}

/* one column: the portrait leads, then the clocks, then the papers */
@media (max-width: 660px) {
  .desk-view { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(5, auto); }
  .desk-view > .portrait { grid-column: 1; grid-row: 1; justify-self: start; border-left: 0; padding-left: 0; }
  .wx { grid-column: 1; grid-row: 2; justify-self: stretch; width: auto; }
  .desk-aside { grid-column: 1; grid-row: 3; min-width: 0; }
  .desk-folders { grid-row: 4; }
  .desk-recent { grid-row: 5; }
  /* a percentage width here would resolve against a shrink-to-fit track and collapse */
  .pt-frame { width: min(220px, 62vw); }
}

/* columns view — the hierarchy laid out left to right */
.columns-view { display: flex; height: 100%; align-items: stretch; }
.col {
  flex: 0 0 220px; min-width: 220px;
  border-right: 1px solid var(--hairline);
  overflow-y: auto; padding: 6px;
}
.col-row {
  display: flex; align-items: center; gap: 7px;
  height: 26px; padding: 0 7px; border-radius: 6px;
  font-size: 13px; white-space: nowrap;
}
.col-row svg { width: 17px; height: 17px; flex: 0 0 auto; }
.col-row span { overflow: hidden; text-overflow: ellipsis; }
.col-row .chev { margin-left: auto; color: var(--text-dim); font-size: 11px; }
.col-row:hover { background: rgba(255,255,255,.06); }
.col-row.on-path { background: var(--sidebar-sel); }
.col-row.selected { background: var(--accent-sel); color: #fff; }
.col-row.selected .chev { color: rgba(255,255,255,.8); }
.col-empty { padding: 10px 12px; font-size: 12px; color: var(--text-dim); }
/* the preview column that trails a selected file */
.col-preview {
  flex: 1 1 auto; min-width: 200px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 20px; text-align: center;
}
.col-preview svg { width: 96px; height: 96px; }
.col-preview .cp-name { font-size: 13px; font-weight: 600; }
.col-preview .cp-meta { font-size: 11px; color: var(--text-dim); }

/* gallery view — one large subject, the rest as a filmstrip */
.gallery-view { display: flex; flex-direction: column; height: 100%; }
.gal-stage {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 24px;
}
.gal-stage svg { width: min(190px, 34vh); height: min(190px, 34vh); }
.gal-stage .gal-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.gal-stage .gal-meta { font-size: 12px; color: var(--text-dim); }
.gal-strip {
  flex: 0 0 auto; height: 96px;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; overflow-x: auto;
  border-top: 1px solid var(--hairline);
}
.gal-thumb {
  flex: 0 0 auto; width: 62px; height: 74px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 4px; border-radius: 7px;
}
.gal-thumb svg { width: 44px; height: 44px; }
.gal-thumb span {
  font-size: 10px; max-width: 100%; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gal-thumb:hover { background: rgba(255,255,255,.06); }
.gal-thumb.selected { background: var(--accent-sel); color: #fff; }

/* rubber band */
.rubber-band {
  position: absolute; z-index: 5;
  background: rgba(160, 160, 165, .18);
  border: 1px solid rgba(255, 255, 255, .35);
  pointer-events: none;
}

/* ---- path bar ---- */
.pathbar {
  height: 24px; flex: 0 0 auto;
  display: flex; align-items: center;
  padding: 0 10px;
  border-top: 1px solid var(--hairline);
  font-size: 11px; color: var(--text-dim);
  overflow: hidden; white-space: nowrap;
}
.pb-item { display: flex; align-items: center; gap: 4px; padding: 1px 4px; border-radius: 4px; }
.pb-item svg { width: 13px; height: 13px; }
.pb-item:hover { background: rgba(255,255,255,.07); }
.pb-sep { margin: 0 2px; color: #5F5F64; }

/* ---- status bar ---- */
.statusbar {
  height: 27px; flex: 0 0 auto;
  display: grid; grid-template-columns: 1fr auto; align-items: center;
  border-top: 1px solid var(--hairline);
  padding: 0 12px;
  position: relative;
}
.status-text {
  grid-column: 1 / -1; grid-row: 1;
  text-align: center; font-size: 11px; color: var(--text-dim);
}
.size-slider {
  grid-column: 2; grid-row: 1;
  width: 74px; -webkit-appearance: none; appearance: none;
  height: 3px; border-radius: 2px; background: rgba(255,255,255,.25);
  outline: none;
}
.size-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: #CFCFD4; box-shadow: 0 .5px 2px rgba(0,0,0,.5);
}

/* ---- resize handle ---- */
.resize-handle { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; }

/* ================= quick look ================= */
.qlook {
  position: fixed; z-index: 700;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(680px, 86vw); height: min(560px, 80vh);
  background: rgba(38, 38, 40, .92);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: 10px;
  box-shadow: 0 0 0 .5px rgba(255,255,255,.16), 0 30px 80px rgba(0,0,0,.6);
  display: flex; flex-direction: column; overflow: hidden;
  font-size: 13px;
}
.ql-bar { height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 12px; flex: 0 0 auto; }
.ql-close { width: 12px; height: 12px; border-radius: 50%; background: #FF5F57; flex: 0 0 auto; }
.ql-title { flex: 1; text-align: center; font-size: 13px; font-weight: 600; color: var(--text); margin-right: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ql-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 0 24px 24px; min-height: 0; }
.ql-body svg { width: 180px; height: 180px; }
.ql-body iframe, .ql-body img { width: 100%; height: 100%; border: 0; border-radius: 4px; background: #fff; object-fit: contain; }
.ql-meta { text-align: center; color: var(--text-dim); font-size: 12px; padding-bottom: 18px; }

/* photo viewer: chrome-free, full frame, arrows either side.
   A scrim sits behind it — dims the room in as the photo grows out of its
   tile, click-to-close like any lightbox. */
.ql-backdrop {
  position: fixed; inset: 0; z-index: 699;
  background: rgba(6, 6, 7, .82);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.qlook-photo {
  width: min(92vw, 1200px); height: min(88vh, 820px);
  background: rgba(14, 14, 16, .96);
  display: block; padding: 0;
}
.qlook-photo .ql-body { position: absolute; inset: 0; padding: 0; }
.qlook-photo .ql-img { background: transparent; border-radius: 0; }
.qlook-photo .ql-close {
  position: absolute; top: 16px; left: 16px; z-index: 2;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.ql-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.08); color: rgba(255,255,255,.85);
  font-size: 22px; line-height: 1;
  transition: background .15s;
}
.ql-nav:hover { background: rgba(255,255,255,.16); }
.ql-prev { left: 14px; } .ql-prev::before { content: "‹"; }
.ql-next { right: 14px; } .ql-next::before { content: "›"; }
.ql-count {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 2;
  padding: 3px 10px; border-radius: 20px;
  background: rgba(0,0,0,.4); color: rgba(255,255,255,.8);
  font-size: 11px; letter-spacing: .03em;
}

/* ================= get info ================= */
.getinfo {
  position: fixed; z-index: 650;
  width: 270px;
  background: rgba(42, 42, 45, .9);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: 10px;
  box-shadow: 0 0 0 .5px rgba(255,255,255,.16), 0 22px 60px rgba(0,0,0,.55);
  color: var(--text);
  overflow: hidden;
  font-size: 13px;
}
.gi-bar { height: 34px; display: flex; align-items: center; padding: 0 12px; gap: 8px; }
.gi-close { width: 12px; height: 12px; border-radius: 50%; background: #FF5F57; flex: 0 0 auto; }
.gi-title { flex: 1; text-align: center; font-size: 12px; font-weight: 600; margin-right: 20px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gi-head { display: flex; align-items: center; gap: 10px; padding: 4px 14px 12px; }
.gi-head svg { width: 40px; height: 40px; }
.gi-name { font-size: 13px; font-weight: 600; }
.gi-sub { font-size: 11px; color: var(--text-dim); }
.gi-sec { border-top: 1px solid var(--hairline); padding: 8px 14px 12px; }
.gi-sec h4 { font-size: 11px; color: var(--text-dim); font-weight: 600; padding-bottom: 6px; }
.gi-row { display: flex; font-size: 11.5px; padding: 2px 0; }
.gi-row b { flex: 0 0 84px; font-weight: 400; color: var(--text-dim); text-align: right; padding-right: 8px; }
.gi-row span { flex: 1; word-break: break-word; }

/* ================= dock ================= */
.dock-wrap { position: fixed; left: 0; right: 0; bottom: 6px; display: flex; justify-content: center; z-index: 450; pointer-events: none; }
.dock {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px;
  background: rgba(46, 46, 50, .45);
  backdrop-filter: blur(36px) saturate(1.6);
  -webkit-backdrop-filter: blur(36px) saturate(1.6);
  border: .5px solid rgba(255, 255, 255, .13);
  border-radius: 20px;
  pointer-events: auto;
}
.dock-item { position: relative; width: 46px; height: 46px; padding: 2px; will-change: transform; transform-origin: 50% 100%; }
.dock-item svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 3px 8px rgba(0,0,0,.32)); }
/* monochrome app set: one plate colour, one mark colour, one stroke weight
   (also used by the app window, so keep these selectors unscoped) */
.plate { fill: var(--app-plate); }
.mark-f { fill: var(--app-mark); }
.cut { fill: var(--app-plate); }
/* stroke width is set per glyph by fitGlyphs(), in the glyph's own drawing space */
.mark-s { fill: none; stroke: var(--app-mark); stroke-linecap: round; stroke-linejoin: round; }

/* dock tooltip — the name rides above the icon, macOS style */
.dock-tip {
  position: fixed; z-index: 460;
  transform: translate(-50%, -100%);
  padding: 4px 10px;
  background: var(--menu-bg);
  backdrop-filter: blur(30px) saturate(1.8);
  -webkit-backdrop-filter: blur(30px) saturate(1.8);
  border: .5px solid rgba(255, 255, 255, .16);
  border-radius: 7px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .4);
  font-size: 12.5px; color: var(--menu-fg);
  white-space: nowrap; pointer-events: none;
}
.dock-tip::after {
  content: ""; position: absolute; left: 50%; bottom: -4px;
  width: 8px; height: 8px; transform: translateX(-50%) rotate(45deg);
  background: var(--menu-bg);
  border-right: .5px solid rgba(255, 255, 255, .16);
  border-bottom: .5px solid rgba(255, 255, 255, .16);
}
.dock-item.bounce { animation: dock-bounce .5s ease 2; }
@keyframes dock-bounce { 0%,100% { transform: translateY(0); } 40% { transform: translateY(-16px); } }

/* ================= in-OS browser window (signature element) ================= */
.appwin {
  position: fixed; z-index: 680;
  /* max() keeps it on-screen once the viewport is narrower than the window */
  left: max(8px, calc(50% - 310px)); top: 16%;
  width: min(620px, calc(100% - 16px)); height: min(460px, 72vh);
  background: var(--win-bg);
  border-radius: 11px;
  box-shadow: 0 0 0 .5px rgba(0,0,0,.65), inset 0 0 0 .5px rgba(255,255,255,.14),
    0 24px 68px rgba(0,0,0,.55);
  display: flex; flex-direction: column; overflow: hidden;
  will-change: transform, opacity;   /* motion driven by springs in app.js */
}
.aw-bar {
  height: 44px; flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid var(--hairline);
}
.aw-close {
  width: 12px; height: 12px; border-radius: 50%;
  background: #FF5F57; flex: 0 0 auto;
  box-shadow: inset 0 0 0 .5px rgba(0,0,0,.15);
}
.aw-url {
  flex: 1; height: 28px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(255,255,255,.06);
  border-radius: 7px;
  font-size: 12px; color: var(--text-dim);
  overflow: hidden; white-space: nowrap;
}
.aw-url svg { width: 11px; height: 11px; flex: 0 0 auto; }
.aw-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  padding: 24px; text-align: center;
}
.aw-body .aw-app { width: 84px; height: 84px; margin-bottom: 10px; }
.aw-body .aw-app svg { width: 100%; height: 100%; border-radius: 19px; box-shadow: 0 10px 28px rgba(0,0,0,.4); }
.aw-name { font-size: 19px; font-weight: 700; color: var(--text); letter-spacing: -0.015em; }
.aw-desc { font-size: 13px; color: var(--text-dim); max-width: 380px; line-height: 1.5; }
.aw-actions { display: flex; gap: 10px; margin-top: 18px; }
.aw-btn {
  height: 32px; padding: 0 16px;
  border-radius: 8px; font-size: 13px; font-weight: 600;
}
.aw-btn.primary { background: #2E5077; color: #fff; }
.aw-btn.primary:hover { background: #38618f; }
.aw-btn.quiet { background: rgba(255,255,255,.08); color: var(--text); }
.aw-btn.quiet:hover { background: rgba(255,255,255,.13); }
/* feedback lives on the press, and it's instant */
.aw-btn:active, .tb-btn:active:not(:disabled) { transform: scale(.96); transition: transform 80ms ease-out; }
.icon-item.lifted { z-index: 30; }
.icon-item.lifted .ic-frame, .icon-item.lifted .ic-label { pointer-events: none; }

/* ================= light mode =================
   Resolved by JS on boot (stored choice ?? system), so the toggle can override. */
:root[data-theme="light"] {
    --desktop-bg: #cdd3de;
    --menubar-bg: rgba(246, 246, 248, .6);
    --menubar-fg: #1d1d1f;
    --win-bg: #ffffff;
    --sidebar-bg: rgba(234, 234, 237, .84);
    --sidebar-fg: #1d1d1f;
    --sidebar-sec: #86868B;
    --sidebar-sel: rgba(0, 0, 0, .09);
    --toolbar-fg: #59595E;
    --title-fg: #1d1d1f;
    --text: #1d1d1f;
    --text-dim: #7C7C82;
    --hairline: rgba(0, 0, 0, .1);
    --row-alt: rgba(0, 0, 0, .028);
    --icon-hilite: rgba(0, 0, 0, .1);
    --menu-bg: rgba(246, 246, 248, .78);
    --menu-fg: #1d1d1f;
    --menu-dim: #A6A6AC;
    --folder: #2E5077;
    --app-plate: #1A1A1E;
    --app-mark: #EDE8DC;
  }
[data-theme="light"] .desktop {
  background:
    radial-gradient(120% 90% at 75% 10%, #e8d9c4 0%, transparent 55%),
    radial-gradient(110% 100% at 20% 95%, #b9cfdd 0%, transparent 60%),
    linear-gradient(160deg, #dfe3ec 0%, #c3cbd9 55%, #aab4c5 100%);
}
[data-theme="light"] .rubber-band { background: rgba(90, 90, 95, .13); border-color: rgba(0, 0, 0, .3); }
[data-theme="light"] .content::-webkit-scrollbar-thumb { background: rgba(0,0,0,.28); border: 4px solid transparent; background-clip: padding-box; }
[data-theme="light"] .size-slider { background: rgba(0,0,0,.2); }
[data-theme="light"] .size-slider::-webkit-slider-thumb { background: #fff; }
[data-theme="light"] .dock { background: rgba(246, 246, 248, .38); }
[data-theme="light"] .tb-btn:hover:not(:disabled) { background: rgba(0, 0, 0, .06); }
[data-theme="light"] .aw-url { background: rgba(0, 0, 0, .05); }
[data-theme="light"] .aw-btn.quiet { background: rgba(0, 0, 0, .06); }
[data-theme="light"] .aw-btn.quiet:hover { background: rgba(0, 0, 0, .1); }
[data-theme="light"] .side-item:not(.active):hover { background: rgba(0, 0, 0, .05); }
[data-theme="light"] .pb-item:hover { background: rgba(0,0,0,.06); }
[data-theme="light"] .col-row:hover, [data-theme="light"] .gal-thumb:hover { background: rgba(0,0,0,.05); }
[data-theme="light"] .icon-item svg.file-icon { filter: drop-shadow(0 1px 2px rgba(0,0,0,.18)); }
[data-theme="light"] .mb-theme:hover, [data-theme="light"] .mb-name:hover { background: rgba(0,0,0,.07); }

/* ================= reduced motion & transparency ================= */
@media (prefers-reduced-motion: reduce) {
  .dropdown { animation: none; }
  .dock-item.bounce { animation: none; }
  .aw-btn:active, .tb-btn:active:not(:disabled) { transform: none; }
  .dock-item:hover { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .menubar, .sidebar, .dropdown, .dock, .qlook, .getinfo {
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .menubar { background: #1b1b1d; }
  .sidebar { background: #29292c; }
  .dropdown { background: #2c2c2f; }
  .dock { background: #2e2e32; }
  .qlook { background: #262628; }
  .getinfo { background: #2a2a2d; }
}

/* the scrim only exists on narrow screens, where the sidebar floats over content */
.side-scrim { display: none; }

/* ================= tight menu bar ================= */
/* Below this the bar can't hold name + mode label + clock, so the labels go and
   the marks stay — same order macOS sheds them in. */
@media (max-width: 480px) {
  .mb-mode #mb-mode-name, .mb-mode .mb-chev { display: none; }
  .mb-mode { padding: 0 6px; }
  .mb-name { padding: 0 6px; letter-spacing: .1em; }
  .mb-clock { padding: 0 4px 0 4px; }

  /* the toolbar runs out of room too — "Group by" is inert here, so it goes first
     and the folder name gets the width back */
  .toolbar { padding: 0 8px 0 6px; }
  .tb-nav { margin-right: 4px; }
  .tb-group { display: none; }
  .tb-actions { gap: 2px; }
}

/* ================= small screens ================= */
@media (max-width: 740px) {
  .window { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; }
  .sidebar { position: absolute; z-index: 20; height: 100%; box-shadow: 0 0 40px rgba(0, 0, 0, .5); }
  .tb-sidebar-toggle { display: flex !important; }
  .mb-item:not(.mb-apple):not(.mb-appname) { display: none; }
  .dock-wrap { display: none; }
  .resize-handle { display: none; }

  /* tap anywhere outside the open sidebar to dismiss it */
  .side-scrim {
    display: block; position: absolute; inset: 0; z-index: 19;
    background: rgba(0, 0, 0, .34);
    opacity: 0; pointer-events: none; transition: opacity .22s ease;
  }
  .win-body:has(.sidebar:not(.collapsed)) .side-scrim { opacity: 1; pointer-events: auto; }

  /* the icon-size slider is a mouse affordance; there is nothing to drag it with */
  .size-slider { display: none; }
  .statusbar { grid-template-columns: 1fr; }
  .status-text { text-align: center; }

  /* 12px traffic lights are far under the 44px touch target — pad the hit area out */
  .traffic { gap: 18px; padding: 20px 0 16px 22px; }
  .tl { position: relative; }
  .tl::after { content: ""; position: absolute; inset: -13px; }

  /* the desktop layout is drawn for a wide screen; tighten it to a phone */
  .desk-view { padding: 20px 16px 28px; column-gap: 18px; row-gap: 24px; }
  .desk-aside { gap: 18px; }
  .desk-folders { gap: 14px; padding-top: 20px; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
  .desk-recent { padding-top: 18px; }
  .desk-file { gap: 12px; padding: 12px 8px; grid-template-columns: 34px 1fr auto; }
  .desk-file svg { width: 34px; height: 34px; }

  /* "where" is the least load-bearing column; drop it before the name truncates */
  .dr-row { grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; }
  .dr-where { display: none; }

  /* floating panels get the full width they can, minus a margin */
  .qlook { width: calc(100% - 16px); height: min(560px, 72dvh); }
  .qlook-photo { width: 100%; height: 100dvh; border-radius: 0; }
  .getinfo { width: min(270px, calc(100% - 16px)); }
  .appwin, .gwin { top: 10%; }
}

/* keep the bottom chrome clear of the home indicator */
@supports (padding: env(safe-area-inset-bottom)) {
  @media (max-width: 740px) {
    .statusbar { padding-bottom: max(6px, env(safe-area-inset-bottom)); height: auto; min-height: 24px; }
    .hl-toast { bottom: calc(26px + env(safe-area-inset-bottom)); }
    .gb-tools { bottom: calc(22px + env(safe-area-inset-bottom)); }
  }
}
