:root {
  --paper:     #0d0b09;
  --paper-2:   #161310;
  --paper-3:   #1e1a15;
  --paper-4:   #262019;
  --ink:       #ece8df;
  --ink-2:     #c8c2b3;
  --ink-mute:  #88826f;
  --ink-dim:   #57534a;
  --line:      rgba(236,232,223,.10);
  --line-2:    rgba(236,232,223,.22);
  --accent:    #c772fe;
  --accent-dim:rgba(199,114,254,.12);
  --good:      #6fcf97;
  --bad:       #e2685f;
  --sans:  'Geist', system-ui, -apple-system, sans-serif;
  --mono:  'Geist Mono', ui-monospace, monospace;
  --serif: 'Instrument Serif', Georgia, serif;
  --sidebar-collapsed: 60px;
  --sidebar-expanded: 226px;
  --island-gap: 12px;
  --grid-thumb: 170px;
}

/* media grid thumbnail size — set via data-grid-size on <html>, from
   Settings → Customization (see applyGridSizePrefs in app.js) */
html[data-grid-size="sm"] { --grid-thumb: 120px; }
html[data-grid-size="md"] { --grid-thumb: 170px; }
html[data-grid-size="lg"] { --grid-thumb: 230px; }
html[data-grid-size="xl"] { --grid-thumb: 300px; }

/* light theme override — applied via data-theme="light" on <html>,
   set from Settings → Customization (see applyThemePrefs in app.js) */
html[data-theme="light"] {
  --paper:     #faf8f3;
  --paper-2:   #f1ede3;
  --paper-3:   #e7e0d0;
  --paper-4:   #dcd2ba;
  --ink:       #221e17;
  --ink-2:     #4b4437;
  --ink-mute:  #8a8168;
  --ink-dim:   #b6ac91;
  --line:      rgba(34,30,23,.10);
  --line-2:    rgba(34,30,23,.20);
  --accent:    #9a3fe0;
  --accent-dim:rgba(154,63,224,.12);
  --good:      #2f9e64;
  --bad:       #cf4638;
}
html[data-theme="light"] ::selection { color: #fdfaf3; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  height: 100vh;
  overflow: hidden;
}
@supports (height: 100dvh) {
  body { height: 100dvh; }
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, textarea { font-family: inherit; color: inherit; }
::selection { background: var(--accent); color: #0a0008; }

.meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.material-symbols-outlined {
  font-family: 'Material Symbols Rounded';
  font-size: 22px;
  line-height: 1;
  -webkit-user-select: none;
  user-select: none;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ink-dim); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── APP SHELL ────────────────────────────────────────── */
.app { display: flex; height: 100vh; width: 100%; }
@supports (height: 100dvh) {
  .app { height: 100dvh; }
}
.hidden { display: none !important; }

/* Sidebar edge + behavior are set via data-sidebar-pos/data-sidebar-mode on
   <html> (see Settings → Customization), default left / collapsing. */
html[data-sidebar-pos="right"] .app { flex-direction: row-reverse; }
html[data-sidebar-pos="top"] .app { flex-direction: column; }
html[data-sidebar-pos="bottom"] .app { flex-direction: column-reverse; }

/* ── SIDEBAR ──────────────────────────────────────────── */
/* .sidebar reserves the collapsed size in the flex layout; the rail and
   panel inside it are floating islands positioned absolutely so the
   expanded panel overlays the main content instead of pushing it
   (unless mode=static, which grows the reserved box to fit the panel). */
.sidebar {
  position: relative;
  width: calc(var(--sidebar-collapsed) + var(--island-gap) * 2);
  flex-shrink: 0;
  background: none;
  border: none;
}
html[data-sidebar-pos="top"] .sidebar,
html[data-sidebar-pos="bottom"] .sidebar {
  width: 100%;
  height: calc(var(--sidebar-collapsed) + var(--island-gap) * 2);
}
html[data-sidebar-mode="static"] .sidebar {
  width: calc(var(--sidebar-collapsed) + var(--sidebar-expanded) + var(--island-gap) * 2);
}
html[data-sidebar-mode="static"][data-sidebar-pos="top"] .sidebar,
html[data-sidebar-mode="static"][data-sidebar-pos="bottom"] .sidebar {
  width: 100%;
  height: calc(var(--sidebar-collapsed) + var(--sidebar-expanded) + var(--island-gap) * 2);
}

/* icon rail: home + section switcher + settings/account */
.sidebar-rail {
  position: absolute;
  top: var(--island-gap); left: var(--island-gap); bottom: var(--island-gap);
  width: var(--sidebar-collapsed);
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 0; gap: 4px;
  z-index: 30;
}
html[data-sidebar-pos="right"] .sidebar-rail { left: auto; right: var(--island-gap); }
html[data-sidebar-pos="top"] .sidebar-rail,
html[data-sidebar-pos="bottom"] .sidebar-rail {
  left: var(--island-gap); right: var(--island-gap);
  width: auto; height: var(--sidebar-collapsed);
  flex-direction: row; padding: 0 8px;
}
html[data-sidebar-pos="top"] .sidebar-rail { top: var(--island-gap); bottom: auto; }
html[data-sidebar-pos="bottom"] .sidebar-rail { bottom: var(--island-gap); top: auto; }

.rail-corner {
  width: 100%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 4px 0;
}

.rail-sections { display: flex; flex-direction: column; gap: 4px; width: 100%; align-items: center; }

html[data-sidebar-pos="top"] .rail-corner,
html[data-sidebar-pos="bottom"] .rail-corner,
html[data-sidebar-pos="top"] .rail-sections,
html[data-sidebar-pos="bottom"] .rail-sections,
html[data-sidebar-pos="top"] .rail-bottom,
html[data-sidebar-pos="bottom"] .rail-bottom {
  flex-direction: row;
  width: auto; height: 100%;
  padding: 0 4px;
}

.rail-btn {
  width: 36px; height: 36px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--ink-mute);
  cursor: pointer; position: relative;
  transition: background .15s, color .15s;
}
.rail-btn .material-symbols-outlined { font-size: 22px; }
.rail-btn:hover { background: var(--paper-3); color: var(--ink); }
.rail-btn.active { background: none; color: var(--accent); }
.rail-home { background: var(--paper-3); }
.rail-home:hover { color: var(--accent); }

.rail-btn .badge-dot {
  position: absolute; top: 5px; right: 5px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--good); display: none;
}
.rail-btn .badge-dot.show { display: block; }

.rail-btn[title]::after {
  content: attr(title);
  position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: var(--paper-4); color: var(--ink-2);
  font-family: var(--sans); font-size: 11.5px; white-space: nowrap;
  padding: 5px 9px; border: 1px solid var(--line-2);
  opacity: 0; pointer-events: none; transition: opacity .12s;
  z-index: 50;
}
.rail-btn:hover[title]::after { opacity: 1; }
html[data-sidebar-pos="right"] .rail-btn[title]::after { left: auto; right: calc(100% + 10px); }
html[data-sidebar-pos="top"] .rail-btn[title]::after {
  left: 50%; top: calc(100% + 10px); transform: translateX(-50%);
}
html[data-sidebar-pos="bottom"] .rail-btn[title]::after {
  left: 50%; top: auto; bottom: calc(100% + 10px); transform: translateX(-50%);
}

.rail-spacer { flex: 1; }

.rail-bottom { display: flex; flex-direction: column; gap: 4px; align-items: center; width: 100%; }

.rail-divider { width: 22px; height: 1px; background: var(--line); margin: 4px 0; flex-shrink: 0; }
html[data-sidebar-pos="top"] .rail-divider,
html[data-sidebar-pos="bottom"] .rail-divider {
  width: 1px; height: 22px; margin: 0 4px;
}

.rail-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line-2);
  object-fit: cover; cursor: pointer;
  background: var(--paper-4);
}
.rail-avatar-fallback {
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--paper-4); color: var(--ink-mute);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 12px; cursor: pointer;
}

.rail-avatar-wrap { position: relative; flex-shrink: 0; }
.rail-avatar-wrap .badge-dot {
  position: absolute; top: -2px; right: -2px;
  width: 8px; height: 8px; border-radius: 50%;
  border: 2px solid var(--paper-2);
  background: var(--accent); display: none;
}
.rail-avatar-wrap .badge-dot.show { display: block; }

/* wider panel: contents of the active rail section.
   Overlays the main content on hover instead of pushing it, so the rail
   stays a slim floating island until you reach for it (mode=collapsing),
   or is forced permanently open (mode=static). */
.sidebar-panel {
  position: absolute;
  top: var(--island-gap); bottom: var(--island-gap);
  left: calc(var(--sidebar-collapsed) + var(--island-gap));
  width: 0;
  min-width: 0;
  overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  opacity: 0;
  pointer-events: none;
  transition: width .18s ease, height .18s ease, opacity .12s ease;
  z-index: 20;
}
html[data-sidebar-pos="right"] .sidebar-panel {
  left: auto; right: calc(var(--sidebar-collapsed) + var(--island-gap));
}
html[data-sidebar-pos="top"] .sidebar-panel,
html[data-sidebar-pos="bottom"] .sidebar-panel {
  left: var(--island-gap); right: var(--island-gap);
  width: auto; min-width: 0;
  height: 0; min-height: 0;
  top: auto; bottom: auto;
}
html[data-sidebar-pos="top"] .sidebar-panel { top: calc(var(--sidebar-collapsed) + var(--island-gap)); }
html[data-sidebar-pos="bottom"] .sidebar-panel { bottom: calc(var(--sidebar-collapsed) + var(--island-gap)); }

.sidebar:hover .sidebar-panel,
html[data-sidebar-mode="static"] .sidebar-panel {
  width: var(--sidebar-expanded);
  opacity: 1;
  pointer-events: auto;
}
html[data-sidebar-pos="top"] .sidebar:hover .sidebar-panel,
html[data-sidebar-pos="bottom"] .sidebar:hover .sidebar-panel,
html[data-sidebar-mode="static"][data-sidebar-pos="top"] .sidebar-panel,
html[data-sidebar-mode="static"][data-sidebar-pos="bottom"] .sidebar-panel {
  width: auto;
  height: var(--sidebar-expanded);
  opacity: 1;
  pointer-events: auto;
}

/* rail + panel always sit flush (see position offsets above) with their own
   border between them, same seam as collapsing mode's hover flyout — just
   with no gap. */

.sidebar-panel-header { padding: 10.5px 16px 10px; flex-shrink: 0; }
.sidebar-panel-title { margin-left: 4px; font-size: 15px; font-weight: 600; color: var(--ink); }
.sidebar-panel-subtitle { margin-left: 4px; margin-bottom: 10px; font-size: 10.5px; color: var(--ink-dim); }
.sidebar-panel-divider { height: 1px; background: var(--line); }

.sidebar-panel-list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 8px 10px; display: flex; flex-direction: column; }

.sidebar-panel-footer { flex-shrink: 0; border-top: 1px solid var(--line); }
.sidebar-panel-add {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 11px 16px; background: none; border: none;
  color: var(--ink-mute); font-family: var(--sans); font-size: 12.5px;
  cursor: pointer; text-align: left;
  transition: color .15s, background .15s;
}
.sidebar-panel-add:hover { color: var(--ink); background: var(--paper-3); }
.sidebar-panel-add .material-symbols-outlined { font-size: 19px; }

/* flat rows shared by the Projects list and the Folders tree */
.tree-row {
  display: flex; align-items: center; gap: 6px;
  width: 100%; height: 30px; padding: 0 8px;
  background: none; border: none; border-left: 2px solid transparent;
  color: var(--ink-mute); font-family: var(--sans); font-size: 12.5px;
  cursor: pointer; text-align: left; position: relative;
  transition: color .15s, background .15s, border-color .15s;
}
.tree-row:hover { color: var(--ink); background: var(--paper-3); }
.tree-row.active { color: var(--accent); background: none; border-left-color: transparent; }
.tree-row .tree-icon { font-size: 17px; flex-shrink: 0; color: inherit; }
.tree-row .tree-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.tree-row .tree-folder-tag {
  flex-shrink: 0; margin-left: auto; padding-left: 6px;
  max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 10.5px; color: var(--ink-dim);
}

.tree-toggle {
  width: 18px; height: 18px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--ink-dim); cursor: pointer;
  transition: transform .15s;
}
.tree-toggle .material-symbols-outlined { font-size: 17px; }
.folder-row.expanded .tree-toggle { transform: rotate(90deg); }
.tree-spacer { width: 18px; flex-shrink: 0; }

.tree-row-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; opacity: 0; transition: opacity .15s; }
.tree-row:hover .tree-row-actions { opacity: 1; }
.tree-action-btn {
  width: 22px; height: 22px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--ink-dim); cursor: pointer;
}
.tree-action-btn:hover { color: var(--ink); }
.tree-action-btn .material-symbols-outlined { font-size: 17px; }

.tree-empty { padding: 6px 8px; font-size: 12px; color: var(--ink-dim); line-height: 1.6; }

/* ── MAIN AREA ────────────────────────────────────────── */
.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; position: relative; }

.view { flex: 1; min-width: 0; overflow-y: auto; padding: 28px 32px 60px; }

/* ── VIEW HEADING (brand voice, matches the sign-in screen) ── */
.view-heading { margin-bottom: 24px; }
.view-eyebrow {
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .2em; text-transform: uppercase;
  color: var(--ink-mute);
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.view-eyebrow::before { content: ''; display: block; width: 18px; height: 1px; background: var(--accent); }
.view-title {
  font-family: var(--serif); font-size: 34px; font-weight: 400;
  letter-spacing: -.01em; color: var(--ink); line-height: 1;
}
.view-title em { font-style: italic; color: var(--accent); }

/* ── BUTTONS ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 14px;
  font-family: var(--sans); font-size: 12.5px;
  font-weight: 500; letter-spacing: .01em;
  border: 1px solid var(--line-2);
  background: transparent; color: var(--ink-2);
  cursor: pointer; transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.btn .material-symbols-outlined { font-size: 19px; }
.btn:hover { background: var(--paper-3); color: var(--ink); border-color: var(--ink-2); }
.btn-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #0a0008; }
.btn-danger { color: var(--bad); border-color: rgba(226,104,95,.35); }
.btn-danger:hover { background: rgba(226,104,95,.12); color: var(--bad); border-color: var(--bad); }
.btn-ghost { border-color: transparent; }
.btn-ghost:hover { background: var(--paper-3); border-color: var(--line-2); }
.btn:disabled { opacity: .45; cursor: default; pointer-events: none; }
.btn-icon { width: 34px; padding: 0; justify-content: center; }

/* ── EMPTY STATE ──────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 80px 24px; color: var(--ink-dim);
}
.empty-state .material-symbols-outlined { font-size: 34px; margin-bottom: 14px; color: var(--ink-dim); }
.empty-state p { font-size: 13.5px; color: var(--ink-2); margin-bottom: 4px; }
.empty-state p.sub { font-size: 12px; color: var(--ink-dim); max-width: 340px; line-height: 1.6; }

/* ── HOME (root view quick-access) ───────────────────── */
.home-quick-row { display: flex; gap: 14px; flex-wrap: wrap; max-width: 720px; margin-bottom: 32px; }
.home-card {
  flex: 1 1 220px; min-width: 220px; text-align: left;
  display: block;
  background: var(--paper-2); border: 1px solid var(--line);
  padding: 18px 20px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.home-card:hover { border-color: var(--accent); background: var(--paper-3); }
.home-card-name { font-family: var(--serif); font-size: 22px; color: var(--ink); margin: 8px 0 4px; }
.home-card-sub { font-size: 11.5px; color: var(--ink-mute); }

.home-recent { max-width: 720px; }
.home-recent-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 0;
  background: none; border: none; border-bottom: 1px solid var(--line);
  color: var(--ink-2); font-family: var(--sans); font-size: 12.5px;
  text-align: left; cursor: pointer; transition: color .15s;
}
.home-recent-row:last-child { border-bottom: none; }
.home-recent-row:hover { color: var(--accent); }
.home-recent-row .material-symbols-outlined { font-size: 18px; color: var(--ink-mute); flex-shrink: 0; }
.home-recent-row .home-recent-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-recent-row .home-recent-time { font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim); flex-shrink: 0; }

/* ── DROPDOWN MENU ────────────────────────────────────── */
.menu-pop {
  position: fixed;
  min-width: 160px;
  background: var(--paper-3);
  border: 1px solid var(--line-2);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 200;
  padding: 4px;
}
.menu-pop button, .menu-pop a {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; background: none; border: none;
  color: var(--ink-2); font-size: 12.5px; text-align: left; cursor: pointer;
}
.menu-pop button:hover, .menu-pop a:hover { background: var(--paper-4); color: var(--ink); }
.menu-pop button.danger { color: var(--bad); }
.menu-pop button.danger:hover { background: rgba(226,104,95,.12); }
.menu-pop .material-symbols-outlined { font-size: 19px; }
.menu-pop .menu-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.account-menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.account-menu-email { font-size: 12.5px; color: var(--ink-2); word-break: break-all; }
#accountMenu { min-width: 220px; }
.account-switch-list { max-height: 180px; overflow-y: auto; margin-bottom: 2px; }
.account-switch-row { display: flex; align-items: center; }
/* scoped under .account-switch-row so these beat the generic, higher-
   specificity ".menu-pop button" rule (which would otherwise force both
   buttons here to width:100% via flex-basis:auto and wreck the row) */
.account-switch-row .account-switch-item {
  flex: 1 1 0%; min-width: 0; display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; background: none; border: none;
  color: var(--ink-2); font-size: 12.5px; text-align: left; cursor: pointer;
}
.account-switch-row .account-switch-item:hover { background: var(--paper-4); color: var(--ink); }
.account-switch-item img, .account-switch-fallback {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
}
.account-switch-fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-dim); color: var(--accent); font-size: 10px; font-weight: 600;
}
.account-switch-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-switch-row .account-switch-remove {
  flex: 0 0 24px; width: 24px; height: 24px; margin-right: 4px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--ink-dim); cursor: pointer;
}
.account-switch-row .account-switch-remove:hover { color: var(--bad); }
.account-switch-remove .material-symbols-outlined { font-size: 15px; }
.account-switch-add { color: var(--accent) !important; }

/* ── MODAL ────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 300; padding: 20px;
}
.modal {
  width: 100%; max-width: 420px;
  background: var(--paper-2); border: 1px solid var(--line-2);
  padding: 24px;
}
.modal h3 { font-size: 15px; font-weight: 500; margin-bottom: 4px; }
.modal p.hint { font-size: 12px; color: var(--ink-mute); margin-bottom: 18px; line-height: 1.6; }
.modal .field { margin-bottom: 14px; }
.modal .field label { display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 6px; }
.modal .field input, .modal .field select, .modal .field textarea {
  width: 100%; height: 36px; padding: 0 10px;
  background: var(--paper); border: 1px solid var(--line-2);
  color: var(--ink); font-size: 13px;
}
.modal .field textarea { height: auto; padding: 8px 10px; resize: vertical; min-height: 60px; }
.modal .field input:focus, .modal .field select:focus, .modal .field textarea:focus { outline: none; border-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal .error-msg { font-size: 12px; color: var(--bad); margin-top: 10px; }

/* media lightbox (playable image/video/YouTube view) */
.lightbox-modal {
  width: auto; max-width: min(960px, 92vw); padding: 0;
  background: var(--paper-2); position: relative; overflow: hidden;
}
.lightbox-media {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  background: #000; min-height: 200px; max-height: 78vh;
}
.lightbox-media img, .lightbox-media video, .lightbox-media canvas { max-width: min(960px, 92vw); max-height: 78vh; object-fit: contain; display: block; }
.lightbox-gallery-slot { position: relative; display: flex; align-items: center; justify-content: center; }
.lightbox-media iframe { width: min(960px, 92vw); height: min(540px, 70vh); border: none; }
.lightbox-fallback { font-size: 48px; color: var(--ink-dim); padding: 60px; }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  background: rgba(13,11,9,.55); border: none; color: #fff; cursor: pointer;
}
.lightbox-nav:hover { background: rgba(13,11,9,.8); }
.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }
.lightbox-counter {
  position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); z-index: 2;
  padding: 3px 10px; font-family: var(--mono); font-size: 11px;
  background: rgba(13,11,9,.6); color: #fff;
}
.lightbox-spin { animation: lightbox-spin 1s linear infinite; }
@keyframes lightbox-spin { to { transform: rotate(360deg); } }
.lightbox-embed-fail {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  max-width: 320px; padding: 40px 20px; text-align: center;
  font-size: 13px; color: var(--ink-mute);
}
.lightbox-embed-fail .material-symbols-outlined { font-size: 32px; color: var(--ink-dim); }
.lightbox-text-preview {
  max-width: 420px; padding: 40px 24px; color: var(--ink-2);
}
.lightbox-text-preview h4 { font-size: 15px; font-weight: 500; margin-bottom: 8px; }
.lightbox-text-preview p { font-size: 13px; color: var(--ink-mute); line-height: 1.6; }
.lightbox-close {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  background: rgba(13,11,9,.65); border: none; color: #fff; cursor: pointer;
}
.lightbox-close:hover { background: rgba(13,11,9,.85); }
.lightbox-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-top: 1px solid var(--line);
}
.lightbox-name { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-footer-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.lightbox-footer .btn { display: inline-flex; align-items: center; gap: 6px; }
.lightbox-footer .btn .material-symbols-outlined { font-size: 17px; }

/* censoring: reveal-eye toggle + badge shared by the grid thumb and the
   lightbox, and the canvas that stands in for pixelate/draw modes */
.censor-reveal-btn {
  position: absolute; top: 6px; left: 6px; z-index: 2;
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  background: rgba(13,11,9,.65); border: none; color: #d8d2c4; cursor: pointer;
}
.censor-reveal-btn:hover { color: #fff; background: rgba(13,11,9,.85); }
.censor-reveal-btn .material-symbols-outlined { font-size: 16px; }
.censor-reveal-btn.is-revealed { color: var(--accent); }
.lightbox-media .censor-reveal-btn { top: 8px; left: 8px; width: 32px; height: 32px; }
.lightbox-media .censor-reveal-btn .material-symbols-outlined { font-size: 18px; }
/* visibility (not display:none) keeps a <video> decoding frames while
   hidden, but it still occupies box layout — position:absolute pulls it
   out of flow so it can't skew flex-centering of the visible canvas
   standing in for it (e.g. in the lightbox's centered media area). */
.censor-source-hidden { position: absolute; top: 0; left: 0; visibility: hidden; pointer-events: none; }
.censor-badge {
  position: absolute; right: 6px; bottom: 6px; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: rgba(13,11,9,.65); color: #fff;
}
.censor-badge .material-symbols-outlined { font-size: 14px; }

/* big text-file editor panel */
.file-editor-modal {
  width: min(880px, 92vw); height: min(680px, 88vh);
  display: flex; flex-direction: column; padding: 18px 20px;
}
.file-editor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-shrink: 0; }
.file-editor-icon { font-size: 22px; color: var(--ink-mute); flex-shrink: 0; }
.file-editor-name {
  flex: 1; min-width: 0; height: 34px; padding: 0 10px;
  background: var(--paper); border: 1px solid var(--line-2); color: var(--ink); font-size: 14px;
}
.file-editor-name:focus { outline: none; border-color: var(--accent); }
.file-editor-name:disabled { color: var(--ink-mute); cursor: default; }
.file-editor-type {
  height: 34px; padding: 0 8px; flex-shrink: 0;
  background: var(--paper); border: 1px solid var(--line-2); color: var(--ink-2); font-size: 12.5px;
}
.file-editor-type:disabled { color: var(--ink-mute); cursor: default; }
.file-editor-lock-banner {
  display: flex; align-items: center; gap: 8px;
  background: var(--accent-dim); border: 1px solid rgba(199,114,254,.3);
  color: var(--ink-2); font-size: 12.5px; padding: 9px 12px; margin-bottom: 12px; flex-shrink: 0;
}
.file-editor-lock-banner .material-symbols-outlined { font-size: 18px; color: var(--accent); }
.file-editor-lock-banner span:nth-child(2) { flex: 1; }
.file-editor-textarea {
  flex: 1; min-height: 0; width: 100%; resize: none;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  background: var(--paper-3); border: 1px solid var(--line-2); color: var(--ink); padding: 12px 14px;
}
.file-editor-textarea:focus { outline: none; border-color: var(--accent); }
.file-editor-textarea:read-only { color: var(--ink-2); cursor: default; }

/* censor settings editor */
.censor-editor-modal { width: 100%; max-width: min(720px, 94vw); max-height: 90vh; overflow-y: auto; padding: 18px 20px; }
.censor-editor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.censor-editor-head > .material-symbols-outlined { color: var(--accent); font-size: 20px; }
.censor-editor-title { flex: 1; min-width: 0; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.censor-editor-enable {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 12.5px; color: var(--ink-2); margin-bottom: 16px;
}
.censor-editor-enable input { width: 15px; height: 15px; accent-color: var(--accent); }
.censor-editor-body { display: flex; gap: 18px; flex-wrap: wrap; }
.censor-editor-preview-wrap { flex: 1 1 300px; min-width: 260px; }
.censor-editor-nav { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 8px; }
.censor-editor-nav .lightbox-nav { position: static; width: 28px; height: 28px; }
.censor-editor-counter { font-family: var(--mono); font-size: 11px; color: var(--ink-mute); }
.censor-editor-canvas-host {
  display: flex; align-items: center; justify-content: center;
  background: #000; min-height: 180px; max-height: 360px; overflow: hidden;
}
.censor-editor-canvas { max-width: 100%; max-height: 360px; display: block; touch-action: none; }
.censor-editor-canvas.drawable { cursor: crosshair; }

/* video items get a roomier editor — precise shape placement needs more
   screen real estate than a quick blur/pixelate pass on a still image */
.censor-editor-modal.censor-editor-video { max-width: min(1100px, 96vw); }
.censor-editor-video .censor-editor-preview-wrap { flex: 2 1 480px; min-width: 380px; }
.censor-editor-video .censor-editor-canvas-host { max-height: 560px; }
.censor-editor-video .censor-editor-canvas { max-height: 560px; }
.censor-editor-preview-wrap .hint { font-size: 11.5px; color: var(--ink-mute); margin-top: 8px; line-height: 1.5; }
.censor-editor-preview-wrap .hint.hint-error { color: var(--bad); }
.censor-editor-controls { flex: 1 1 260px; min-width: 240px; }
.censor-mode-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.censor-mode-tabs button {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 10px; background: var(--paper); border: 1px solid var(--line-2);
  color: var(--ink-2); font-size: 12px; cursor: pointer;
}
.censor-mode-tabs button .material-symbols-outlined { font-size: 16px; }
.censor-mode-tabs button:hover { border-color: var(--accent); }
.censor-mode-tabs button.active { background: var(--accent-dim); border-color: var(--accent); color: var(--ink); }
.censor-control-row { margin-bottom: 14px; }
.censor-control-row label {
  display: block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-mute); margin-bottom: 6px;
}
.censor-control-row input[type="range"] { width: 100%; accent-color: var(--accent); }
.censor-control-row input[type="text"] {
  width: 100%; height: 34px; padding: 0 10px;
  background: var(--paper); border: 1px solid var(--line-2); color: var(--ink); font-size: 13px;
}
.censor-control-row input[type="text"]:focus { outline: none; border-color: var(--accent); }
.censor-control-row input[type="color"] {
  width: 100%; height: 34px; padding: 3px;
  background: var(--paper); border: 1px solid var(--line-2); cursor: pointer;
}
.censor-draw-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.censor-draw-actions .btn { font-size: 12px; padding: 6px 10px; }
.censor-draw-actions .material-symbols-outlined { font-size: 16px; }
.censor-drawstyle-tabs { display: flex; gap: 6px; }
.censor-drawstyle-tabs button {
  flex: 1; padding: 6px 10px; background: var(--paper); border: 1px solid var(--line-2);
  color: var(--ink-2); font-size: 12px; cursor: pointer;
}
.censor-drawstyle-tabs button:hover { border-color: var(--accent); }
.censor-drawstyle-tabs button.active { background: var(--accent-dim); border-color: var(--accent); color: var(--ink); }

/* video "editing screen": a single timeline block (scrub bar + keyframe
   markers) directly under the canvas; shape/keyframe management lives in
   the controls column instead of stacking further below the video. */
.censor-timeline {
  margin-top: 10px; padding: 10px 10px 8px; background: var(--paper-2); border: 1px solid var(--line);
}
.censor-video-scrub-row { display: flex; align-items: center; gap: 10px; }
.censor-video-scrub-row .btn-icon { width: 30px; height: 30px; flex-shrink: 0; }
.censor-video-scrub { flex: 1; accent-color: var(--accent); }
.censor-video-time { font-family: var(--mono); font-size: 11px; color: var(--ink-mute); flex-shrink: 0; width: 34px; }

/* Dope sheet: one row per shape so every shape's keyframes are visible at
   once (like Blender's Dope Sheet), sitting directly under the scrub bar.
   Each row is a real flex column (sticky label, then track) rather than a
   label overlaid on top of the track, so keyframes near time 0 never sit
   under the shape name; each track carries its own playhead line, and
   since every track has identical width/mapping they read as one line
   running through all rows. .censor-dopesheet-rows is widened by the
   shift+scroll zoom handler to spread keyframes out for finer editing,
   with the viewport's native horizontal scroll panning across it. */
.censor-dopesheet { position: relative; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.censor-dopesheet-viewport { overflow-x: auto; overflow-y: hidden; }
.censor-dopesheet-rows { position: relative; display: flex; flex-direction: column; gap: 3px; min-width: 100%; }
.censor-dopesheet-row { display: flex; align-items: stretch; height: 20px; }
.censor-dopesheet-row-label {
  position: sticky; left: 0; z-index: 2; flex: 0 0 52px; width: 52px;
  display: flex; align-items: center; overflow: hidden;
  background: var(--paper-2); border: none; padding: 0 6px 0 4px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .03em;
  color: var(--ink-dim); cursor: pointer; text-align: left; white-space: nowrap;
}
.censor-dopesheet-row-label:hover { color: var(--ink-2); }
.censor-dopesheet-row.active .censor-dopesheet-row-label { color: var(--accent); }
.censor-dopesheet-row-track {
  position: relative; flex: 1; min-width: 0;
  background: var(--paper); border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.censor-dopesheet-row.active .censor-dopesheet-row-track { background: var(--accent-dim); }
.censor-dopesheet-row-track .censor-keyframe-dot {
  position: absolute; top: 50%; width: 9px; height: 9px; margin-left: -5px;
  background: var(--ink-dim); border: 1px solid var(--paper-2);
  transform: translateY(-50%) rotate(45deg);
  cursor: pointer; z-index: 1;
}
.censor-dopesheet-row-track .censor-keyframe-dot:hover { background: var(--ink-2); }
.censor-dopesheet-row-track .censor-keyframe-dot.current { background: var(--accent); }
.censor-dopesheet-playhead {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: var(--accent); pointer-events: none; z-index: 1;
}
.censor-video-shape-controls { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--line); }
.censor-controls-divider {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-dim); margin: 14px 0 8px;
}
.censor-controls-divider:first-child { margin-top: 0; }
.censor-controls-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.censor-shapes-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.censor-shapes-list { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.censor-shape-chip { display: flex; align-items: stretch; background: var(--paper); border: 1px solid var(--line-2); }
.censor-shape-chip.active { border-color: var(--accent); }
.censor-shape-chip-select {
  padding: 5px 8px; background: none; border: none;
  color: var(--ink-2); font-size: 11.5px; cursor: pointer;
}
.censor-shape-chip.active .censor-shape-chip-select { color: var(--accent); }
.censor-shape-chip-select:hover { color: var(--ink); }
.censor-shape-chip-remove {
  display: flex; align-items: center; justify-content: center;
  width: 20px; padding: 0; background: none; border: none; border-left: 1px solid var(--line-2);
  color: var(--ink-dim); cursor: pointer;
}
.censor-shape-chip-remove:hover { color: var(--bad); }
.censor-shape-chip-remove .material-symbols-outlined { font-size: 13px; }
.censor-shape-add-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 9px; background: none; border: 1px dashed var(--line-2);
  color: var(--ink-mute); font-size: 11.5px; cursor: pointer;
}
.censor-shape-add-btn:hover { color: var(--accent); border-color: var(--accent); }
.censor-shape-add-btn .material-symbols-outlined { font-size: 14px; }
.censor-shape-mode-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.censor-shape-mode-tabs button {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 10px; background: var(--paper); border: 1px solid var(--line-2);
  color: var(--ink-2); font-size: 11.5px; cursor: pointer;
}
.censor-shape-mode-tabs button .material-symbols-outlined { font-size: 15px; }
.censor-shape-mode-tabs button:hover { border-color: var(--accent); }
.censor-shape-mode-tabs button.active { background: var(--accent-dim); border-color: var(--accent); color: var(--ink); }
.censor-keyframe-actions { display: flex; gap: 8px; }
.censor-keyframe-actions .btn { font-size: 11.5px; padding: 5px 9px; }
.censor-keyframe-actions .material-symbols-outlined { font-size: 15px; }
.censor-interpolate-toggle {
  display: flex; align-items: center; gap: 7px; margin-top: 10px;
  font-size: 11.5px; color: var(--ink-2); cursor: pointer;
}
.censor-interpolate-toggle input { width: 14px; height: 14px; accent-color: var(--accent); }
.file-editor-modal.locked .file-editor-textarea { background: var(--paper-2); }
.file-editor-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-shrink: 0; }

/* icon field (inside a modal) */
.icon-field-row { display: flex; align-items: center; gap: 10px; }
.icon-field-preview {
  width: 36px; height: 36px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper); border: 1px solid var(--line-2); color: var(--ink);
  cursor: pointer; transition: border-color .15s;
}
.icon-field-preview:hover { border-color: var(--accent); }

/* icon picker modal */
.icon-picker-modal { max-width: 560px; }
.icon-cat-row { display: flex; flex-wrap: wrap; gap: 6px; margin: -6px 0 14px; }
.icon-cat-chip {
  padding: 4px 10px; background: none; border: 1px solid var(--line-2); color: var(--ink-mute);
  font-family: var(--sans); font-size: 11px; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.icon-cat-chip:hover { color: var(--ink); border-color: var(--ink-2); }
.icon-cat-chip.active { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.icon-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px;
  max-height: 320px; overflow-y: auto; padding: 4px; border: 1px solid var(--line); background: var(--paper);
}
.icon-grid-btn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid transparent; color: var(--ink-2);
  cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.icon-grid-btn:hover { background: var(--paper-3); color: var(--ink); }
.icon-grid-btn.active { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
.icon-grid-empty { grid-column: 1 / -1; padding: 30px 0; text-align: center; font-size: 12px; color: var(--ink-dim); }
.icon-grid-note { grid-column: 1 / -1; padding: 8px 4px 2px; font-size: 10.5px; color: var(--ink-dim); text-align: center; }

/* repo picker */
.repo-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); margin-top: 4px; }
.repo-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer;
  transition: background .15s;
}
.repo-row:last-child { border-bottom: none; }
.repo-row:hover { background: var(--paper-3); }
.repo-row .repo-name { font-size: 12.5px; color: var(--ink-2); }
.repo-row .repo-name .owner { color: var(--ink-dim); }
.repo-row .repo-private { font-family: var(--mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim); border: 1px solid var(--line-2); padding: 2px 6px; }

/* ── SETTINGS VIEW ────────────────────────────────────── */
.settings-layout { display: flex; gap: 48px; align-items: flex-start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; width: 168px; flex-shrink: 0; }
.settings-nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-left: 2px solid transparent;
  font-size: 12.5px; color: var(--ink-mute);
  transition: color .15s, border-color .15s;
}
.settings-nav-item .material-symbols-outlined { font-size: 19px; }
.settings-nav-item:hover { color: var(--ink); }
.settings-nav-item.active { color: var(--accent); border-left-color: var(--accent); }
.settings-content { flex: 1; min-width: 0; }

.segmented { display: flex; gap: 8px; flex-wrap: wrap; }
.segmented-btn {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  width: 88px; padding: 14px 8px;
  background: none; border: 1px solid var(--line-2); color: var(--ink-mute);
  font-family: var(--sans); font-size: 11.5px; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.segmented-btn .material-symbols-outlined { font-size: 22px; }
.segmented-btn:hover { color: var(--ink); border-color: var(--ink-2); }
.segmented-btn.active { color: var(--accent); border-color: var(--accent); }

.settings-block { max-width: 560px; margin-bottom: 36px; }
.settings-block h2 { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.settings-block p.desc { font-size: 12.5px; color: var(--ink-mute); margin-bottom: 16px; line-height: 1.6; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-top: 1px solid var(--line);
}
.settings-row:last-child { border-bottom: 1px solid var(--line); }
.gh-account { display: flex; align-items: center; gap: 10px; }
.gh-account img { width: 30px; height: 30px; border-radius: 50%; }
.gh-account .name { font-size: 13px; color: var(--ink-2); }
.gh-account .login { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); }

/* admin panel */
.admin-layout { display: flex; gap: 48px; flex-wrap: wrap; align-items: flex-start; }
.admin-layout .settings-block { flex: 1 1 380px; }
.admin-groups-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.admin-group-card { border: 1px solid var(--line-2); background: var(--paper-2); padding: 14px; }
.admin-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.admin-group-name {
  flex: 1; height: 32px; padding: 0 10px;
  background: var(--paper); border: 1px solid var(--line-2); color: var(--ink); font-size: 13px;
}
.admin-group-name:focus { outline: none; border-color: var(--accent); }
.admin-group-features { display: flex; flex-direction: column; gap: 8px; }
.admin-feature-toggle { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.admin-feature-toggle input { width: 15px; height: 15px; accent-color: var(--accent); }
.admin-users-list { max-height: 480px; overflow-y: auto; }
.admin-users-table { display: flex; flex-direction: column; }
.admin-user-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.admin-user-row:last-child { border-bottom: 1px solid var(--line); }
.admin-user-identity { display: flex; align-items: center; gap: 8px; min-width: 0; }
.admin-user-email { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-user-you {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-dim); padding: 2px 6px; flex-shrink: 0;
}
.admin-user-group {
  height: 30px; padding: 0 8px; flex-shrink: 0; max-width: 200px;
  background: var(--paper); border: 1px solid var(--line-2); color: var(--ink-2); font-size: 12px;
}
.token-form { display: flex; gap: 8px; }
.token-form input {
  flex: 1; height: 34px; padding: 0 10px;
  background: var(--paper-2); border: 1px solid var(--line-2); color: var(--ink); font-size: 12.5px; font-family: var(--mono);
}
.token-form input:focus { outline: none; border-color: var(--accent); }
.status-pill { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; padding: 3px 8px; border: 1px solid var(--line-2); color: var(--ink-mute); display: inline-flex; align-items: center; gap: 5px; }
.status-pill.ok { color: var(--good); border-color: rgba(111,207,151,.35); }
.status-pill.bad { color: var(--bad); border-color: rgba(226,104,95,.35); }
.status-pill .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ── PROJECT VIEW ─────────────────────────────────────── */
.project-header { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.project-header h1 { font-family: var(--serif); font-size: 30px; font-weight: 400; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-header-icon { font-size: 26px; color: var(--ink-mute); flex-shrink: 0; }
.folder-header { margin-bottom: 4px; }
.folder-header h1 { flex: 1; min-width: 0; }

/* ── FOLDER VIEW ──────────────────────────────────────── */
.folder-breadcrumb {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
  font-family: var(--mono); font-size: 11px; color: var(--ink-dim); margin-bottom: 10px;
}
.folder-breadcrumb a { color: var(--ink-mute); transition: color .15s; }
.folder-breadcrumb a:hover { color: var(--accent); }
.folder-breadcrumb-current { color: var(--ink-2); }

.folder-view-body { margin-top: 24px; }
.folder-section { margin-bottom: 32px; }
.folder-section h4 { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 12px; }
.folder-section-head { display: flex; align-items: center; justify-content: space-between; }
.folder-section-head h4 { margin-bottom: 12px; }
.folder-section-action {
  display: flex; align-items: center; gap: 5px; margin-bottom: 12px;
  background: none; border: 1px solid var(--line-2); color: var(--ink-mute);
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em;
  padding: 5px 10px; cursor: pointer; transition: color .15s, border-color .15s;
}
.folder-section-action:hover { color: var(--ink); border-color: var(--accent); }
.folder-section-action .material-symbols-outlined { font-size: 14px; }
.folder-category-section { margin-bottom: 20px; }
.folder-category-section:last-child { margin-bottom: 0; }
.folder-category-section h5 {
  font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
}

/* folder settings modal */
.folder-settings-modal { width: min(560px, 94vw); max-height: 90vh; overflow-y: auto; padding: 18px 20px; }
.folder-settings-modal .desc { font-size: 12px; color: var(--ink-mute); margin: -8px 0 16px; line-height: 1.6; }
.folder-categories-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.folder-category-row { border: 1px solid var(--line-2); background: var(--paper-2); padding: 12px; }
.folder-category-row-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.folder-category-name {
  flex: 1; height: 32px; padding: 0 10px;
  background: var(--paper); border: 1px solid var(--line-2); color: var(--ink); font-size: 13px;
}
.folder-category-name:focus { outline: none; border-color: var(--accent); }
.folder-category-types { display: flex; flex-wrap: wrap; gap: 10px; }
.folder-category-types label { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.folder-category-types input { width: 14px; height: 14px; accent-color: var(--accent); }
.folder-category-types-hint { font-size: 11px; color: var(--ink-dim); margin-top: 8px; }
.folder-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.folder-card {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px; width: 100%; text-align: left;
  background: var(--paper-2); border: 1px solid var(--line);
  color: var(--ink-2); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.folder-card:hover, .folder-card:focus-visible { border-color: var(--accent); background: var(--paper-3); outline: none; }
.folder-card-icon { font-size: 22px; color: var(--ink-mute); flex-shrink: 0; }
.folder-card-name { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-card-menu {
  flex-shrink: 0; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--ink-dim); cursor: pointer;
  opacity: 0; transition: opacity .15s, color .15s;
}
.folder-card-menu .material-symbols-outlined { font-size: 18px; }
.folder-card:hover .folder-card-menu { opacity: 1; }
.folder-card-menu:hover { color: var(--ink); }
.file-lock-badge { flex-shrink: 0; font-size: 15px !important; color: var(--ink-dim); }
.folder-card-add { color: var(--ink-mute); border-style: dashed; background: none; }
.folder-card-add:hover { color: var(--accent); border-color: var(--accent); background: var(--paper-3); }
.folder-card-add .folder-card-icon { color: inherit; }

/* Collections are a tag, not a place — opening one runs a filtered search
   over the folder's media, so the card leads with a big cover picture
   (Pinterest-board style) instead of the small icon+name row a real
   folder/subfolder card uses. */
.collection-card-grid { column-width: 170px; column-gap: 12px; }
.collection-card {
  position: relative; width: 100%; margin-bottom: 12px;
  display: flex; flex-direction: column;
  background: var(--paper-2); border: 1px solid var(--line);
  cursor: pointer; overflow: hidden;
  break-inside: avoid; -webkit-column-break-inside: avoid;
  transition: border-color .15s, background .15s;
}
.collection-card:hover, .collection-card:focus-visible { border-color: var(--accent); outline: none; }
.collection-card-cover {
  position: relative; width: 100%; aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper-3);
}
.collection-card-cover .thumb-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.collection-card-cover .thumb-cover.hidden { display: none; }
.collection-card-fallback { position: absolute; font-size: 40px; color: var(--ink-dim); }
.collection-card-cover .thumb-cover:not(.hidden) ~ .collection-card-fallback { display: none; }
.collection-card-footer { display: flex; align-items: center; gap: 4px; padding: 9px 10px; }
.collection-card-name { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collection-card:hover .collection-card-footer .folder-card-menu { opacity: 1; }
.collection-card-add {
  align-items: center; justify-content: center; gap: 8px;
  flex-direction: row; aspect-ratio: 1 / 1;
  color: var(--ink-mute); font-family: var(--sans); font-size: 12.5px;
  border-style: dashed; background: none; border-width: 1px; border-color: var(--line);
}
.collection-card-add:hover { color: var(--accent); border-color: var(--accent); }
.collection-card-add .material-symbols-outlined { font-size: 20px; }

/* Collection "search" modal — a read-only results grid, not a folder view. */
.collection-search-modal { width: 100%; max-width: min(720px, 94vw); max-height: 90vh; overflow-y: auto; padding: 18px 20px; }
.collection-search-grid { margin-top: 14px; }
.collection-search-empty { margin-top: 14px; }

/* A CSS grid forces every card in a row to share that row's height (the
   tallest card's height), which leaves gaps under shorter neighbors once
   thumbnails size to their own media's aspect ratio. A multi-column layout
   packs each column independently top-to-bottom instead, so cards tile with
   no dead space regardless of how their heights vary. */
.website-card-grid { column-width: var(--grid-thumb); column-gap: 12px; }
.website-card {
  position: relative; width: 100%; margin-bottom: 12px;
  display: flex; flex-direction: column;
  background: var(--paper-2); border: 1px solid var(--line);
  cursor: pointer; overflow: hidden;
  break-inside: avoid; -webkit-column-break-inside: avoid;
  transition: border-color .15s, background .15s;
}
.website-card:hover { border-color: var(--accent); }
.website-card-thumb {
  position: relative; width: 100%; aspect-ratio: 16 / 10;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper-3);
}
.website-card-thumb img { width: 40px; height: 40px; object-fit: contain; }
.website-card-thumb img.hidden, .website-card-thumb video.hidden { display: none; }
.website-card-thumb .website-card-fallback { position: absolute; font-size: 28px; color: var(--ink-dim); }
.website-card-thumb img:not(.hidden) ~ .website-card-fallback,
.website-card-thumb video:not(.hidden) ~ .website-card-fallback { display: none; }
.website-card-thumb .thumb-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.website-card-play {
  position: absolute; font-size: 34px; color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,.6); pointer-events: none; display: none;
}
.website-card-thumb.has-media .website-card-play { display: block; }
.website-card-xlogo { font-family: var(--sans); font-size: 26px; font-weight: 700; }
.website-card-gallery-badge {
  position: absolute; left: 6px; bottom: 6px; z-index: 1;
  display: flex; align-items: center; gap: 3px;
  padding: 2px 7px; font-family: var(--mono); font-size: 11px;
  background: rgba(13,11,9,.65); color: #fff;
}
.website-card-gallery-badge .material-symbols-outlined { font-size: 14px; }
.website-card-name {
  padding: 9px 12px; font-size: 12.5px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.website-card-menu {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(13,11,9,.65); border: none; color: #d8d2c4; cursor: pointer;
  opacity: 0; transition: opacity .15s, color .15s;
}
.website-card-menu .material-symbols-outlined { font-size: 17px; }
.website-card:hover .website-card-menu { opacity: 1; }
.website-card-menu:hover { color: #fff; }
.website-card-add {
  align-items: center; justify-content: center; gap: 8px;
  flex-direction: row; aspect-ratio: 16 / 10;
  color: var(--ink-mute); font-family: var(--sans); font-size: 12.5px;
  border-style: dashed;
}
.website-card-add:hover { color: var(--accent); border-color: var(--accent); }
.website-card-add .material-symbols-outlined { font-size: 20px; }
.repo-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-mute);
  border: 1px solid var(--line-2); padding: 4px 10px;
  transition: color .15s, border-color .15s;
}
.repo-badge:hover { color: var(--accent); border-color: var(--accent); }
.repo-badge .material-symbols-outlined { font-size: 17px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 18px 0 26px; }
.tab {
  padding: 10px 4px; margin-right: 22px;
  font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-mute); cursor: pointer; border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--ink); border-color: var(--accent); }

/* overview */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 28px; }
.stat-tile { border: 1px solid var(--line); background: var(--paper-2); padding: 14px 16px; }
.stat-tile .num { font-family: var(--mono); font-size: 22px; color: var(--ink); }
.stat-tile .lbl { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-mute); margin-top: 4px; }

.repo-desc { font-size: 14px; color: var(--ink-2); margin-bottom: 24px; max-width: 70ch; line-height: 1.6; }

.lang-bar { display: flex; height: 8px; width: 100%; overflow: hidden; margin-bottom: 10px; background: var(--paper-3); }
.lang-bar span { height: 100%; }
.lang-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 28px; }
.lang-legend-item { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-mute); }
.lang-legend-item .swatch { width: 8px; height: 8px; flex-shrink: 0; }

.overview-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: start; }

.readme-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.readme-panel-head h4 { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-mute); }

.readme-box { border: 1px solid var(--line); background: var(--paper-2); padding: 20px 24px; font-size: 13.5px; color: var(--ink-2); line-height: 1.7; overflow-x: auto; }
.readme-box h1, .readme-box h2, .readme-box h3 { color: var(--ink); font-weight: 500; margin: 18px 0 8px; }
.readme-box h1:first-child, .readme-box h2:first-child, .readme-box h3:first-child { margin-top: 0; }
.readme-box h1 { font-size: 18px; } .readme-box h2 { font-size: 15.5px; } .readme-box h3 { font-size: 13.5px; }
.readme-box p { margin-bottom: 10px; }
.readme-box code { font-family: var(--mono); font-size: 12px; background: var(--paper-3); padding: 1px 5px; }
.readme-box pre { font-family: var(--mono); font-size: 12px; background: var(--paper-3); padding: 12px 14px; overflow-x: auto; margin-bottom: 10px; }
.readme-box pre code { background: none; padding: 0; }
.readme-box ul, .readme-box ol { margin: 0 0 10px 20px; }
.readme-box a { color: var(--accent); }
.readme-box img { max-width: 100%; }
.readme-editor {
  width: 100%; min-height: 340px; resize: vertical;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  background: var(--paper-3); border: 1px solid var(--line-2); color: var(--ink); padding: 12px 14px;
}
.readme-editor:focus { outline: none; border-color: var(--accent); }
.readme-editor-actions { display: flex; gap: 8px; margin-top: 12px; }

.side-block { margin-bottom: 26px; }
.side-block h4 { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-mute); margin-bottom: 12px; }

.local-overview-cta {
  display: flex; align-items: center; gap: 14px;
  background: var(--paper-2); border: 1px solid var(--line);
  padding: 16px 18px; margin-top: 8px; max-width: 640px;
}
.local-overview-cta .material-symbols-outlined { font-size: 26px; color: var(--ink-mute); flex-shrink: 0; }
.local-overview-cta-text { flex: 1; min-width: 0; }
.local-overview-cta-title { font-size: 13px; color: var(--ink-2); margin-bottom: 2px; }
.local-overview-cta-sub { font-size: 11.5px; color: var(--ink-dim); }

.commit-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.commit-row:last-child { border-bottom: none; }
.commit-row img { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; background: var(--paper-3); }
.commit-msg { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.commit-meta { font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim); }

.avatar-row { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar-row img { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-2); }

/* ── KANBAN ───────────────────────────────────────────── */
.kanban-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.kanban-sync-note { font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim); margin-left: auto; }
.btn.syncing .material-symbols-outlined { animation: spin 0.8s linear infinite; }
.kanban-board { display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; padding-bottom: 20px; }
.kanban-col { width: 280px; flex-shrink: 0; background: var(--paper-2); border: 1px solid var(--line); min-height: 120px; }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.kanban-col-head .meta { color: var(--ink-2); }
.kanban-col-count { font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim); }
.kanban-col-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kanban-col-body.drag-over { background: var(--accent-dim); }

.kanban-card {
  background: var(--paper-3); border: 1px solid var(--line-2);
  padding: 10px 12px; cursor: grab; font-size: 12.5px; color: var(--ink-2);
  transition: border-color .15s;
}
.kanban-card:hover { border-color: var(--accent); color: var(--ink); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .4; }
.kanban-card .kc-title { margin-bottom: 8px; line-height: 1.4; }
.kanban-card .kc-meta { display: flex; align-items: center; justify-content: space-between; }
.kanban-card .kc-num { font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim); }
.kanban-card .kc-labels { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.kc-label { font-size: 9.5px; padding: 1px 6px; font-family: var(--mono); letter-spacing: .03em; }
.kanban-card img.kc-avatar { width: 18px; height: 18px; border-radius: 50%; }

/* ── KANBAN COLUMN EDITOR (project settings) ─────────── */
.kanban-cols-editor { display: flex; flex-direction: column; }
.kanban-col-editor-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.kanban-col-editor-row:first-child { border-top: none; }
.kanban-col-editor-row input[type="text"] {
  height: 32px; padding: 0 9px; min-width: 120px;
  background: var(--paper); border: 1px solid var(--line-2); color: var(--ink); font-size: 12.5px;
}
.kanban-col-editor-row input[type="text"]:focus { outline: none; border-color: var(--accent); }
.kanban-col-editor-row .col-name { flex: 1 1 160px; }
.kanban-col-editor-row .col-label { flex: 1 1 160px; font-family: var(--mono); }
.kanban-col-editor-row .col-closed { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-mute); white-space: nowrap; }

/* ── DANGER ZONE ──────────────────────────────────────── */
.danger-zone { border: 1px solid rgba(226,104,95,.3); padding: 16px 18px; margin-top: 6px; }
.danger-zone .settings-row { border: none; padding: 10px 0; }
.danger-zone .settings-row:first-child { padding-top: 0; }

/* ── TOAST ────────────────────────────────────────────── */
.toast-stack { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 400; }
.toast {
  background: var(--paper-3); border: 1px solid var(--line-2);
  padding: 10px 16px; font-size: 12.5px; color: var(--ink-2);
  box-shadow: 0 8px 20px rgba(0,0,0,.35);
  display: flex; align-items: center; gap: 8px;
}
.toast.error { border-color: rgba(226,104,95,.4); color: var(--bad); }
.toast .material-symbols-outlined { font-size: 18px; }

/* ── LOADING ──────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.view-loading { display: flex; align-items: center; justify-content: center; padding: 80px 0; }

/* ── RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 760px) {
  :root { --sidebar-expanded: min(300px, 84vw); }
  .overview-cols { grid-template-columns: 1fr; }
  .view { padding: 20px 16px 60px; }

  /* touch has no :hover — tapping a rail button toggles this class (see
     setSidebarSection in app.js) so the panel opens/closes explicitly */
  .app.sidebar-panel-open .sidebar-panel {
    width: var(--sidebar-expanded);
    opacity: 1;
    pointer-events: auto;
  }
  html[data-sidebar-pos="top"] .app.sidebar-panel-open .sidebar-panel,
  html[data-sidebar-pos="bottom"] .app.sidebar-panel-open .sidebar-panel {
    width: auto;
    height: var(--sidebar-expanded);
    opacity: 1;
    pointer-events: auto;
  }

  .settings-layout { flex-direction: column; gap: 20px; }
  .settings-nav { flex-direction: row; width: auto; overflow-x: auto; gap: 2px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
  .settings-nav-item { flex-shrink: 0; border-left: none; border-bottom: 2px solid transparent; }
  .settings-nav-item.active { border-left-color: transparent; border-bottom-color: var(--accent); }

  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; }

  .project-header { flex-wrap: wrap; row-gap: 8px; }

  .kanban-toolbar { flex-wrap: wrap; row-gap: 8px; }
  .kanban-sync-note { margin-left: 0; flex-basis: 100%; }

  .stat-tiles { grid-template-columns: repeat(2, 1fr); }

  .modal { padding: 18px; }
  .modal-backdrop { padding: 12px; }
  .file-editor-modal { width: 100%; height: 94vh; padding: 14px 16px; }
  .file-editor-head { flex-wrap: wrap; }
  .file-editor-name { flex-basis: 100%; order: -1; }

  .kanban-col-editor-row .col-name,
  .kanban-col-editor-row .col-label { flex-basis: 100%; }
}
