:root {
  /* surfaces — near-black, layered (refined dark chrome) */
  --bg-0: #08090b;
  --bg-1: #0e0f12;
  --bg-2: #15171b;
  --bg-3: #1d2027;
  --bg-4: #262a33;

  /* hairlines */
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);

  /* text */
  --tx-0: #f2f3f5;
  --tx-1: #b6bac2;
  --tx-2: #7c818c;
  --tx-3: #565a63;

  /* accent — blue */
  --ac: #5b8cff;
  --ac-hi: color-mix(in oklch, var(--ac), white 26%);
  --ac-dim: color-mix(in srgb, var(--ac) 16%, transparent);

  /* rating traffic-light (amber used for star filter) */
  --r-mid: #f5b50a;
  --r-mid-dim: rgba(245, 181, 10, 0.16);

  /* radii (chrome only; cards keep border-radius:0 via reset) */
  --r-xs: 5px;
  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 14px;

  /* fonts */
  --f-ui: 'Hanken Grotesk', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0 !important;
}

#top-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 9999;
  display: none;
  background: #111;
  transition: opacity 0.4s;
}

#top-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #5b8cff, #6ec6ff);
  transition: width 0.3s ease-out;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px #5b8cff88;
}

@keyframes progress-shimmer {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

#top-progress-bar.loading {
  width: 35% !important;
  transition: none;
  background: linear-gradient(90deg, #1a5ccc 0%, #5b8cff 40%, #6ec6ff 60%, #1a5ccc 100%);
  background-size: 200% 100%;
  animation: progress-shimmer 1.4s linear infinite;
}

/* ── Loading overlay ── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s;
}

#loading-overlay.vis {
  opacity: 1;
}

#loading-box {
  background: #141414;
  border: 1px solid #222;
  padding: 28px 36px 24px;
  width: 340px;
}

#loading-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

#loading-title {
  font-size: 13px;
  font-weight: 600;
  color: #bbb;
}

#loading-photo-count {
  font-size: 11px;
  color: #5b8cff;
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
}

#loading-bar-wrap {
  height: 2px;
  background: #1e1e1e;
  margin-bottom: 20px;
}

#loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #5b8cff, #6ec6ff);
  width: 0%;
  transition: width 0.3s ease-out;
}

#loading-steps {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

.loading-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #191919;
}

.loading-step:last-child {
  border-bottom: none;
}

.ls-icon {
  width: 14px;
  font-size: 11px;
  flex-shrink: 0;
  color: #2a2a2a;
  text-align: center;
  line-height: 1;
}

.ls-label {
  flex: 1;
  font-size: 12px;
  color: #444;
}

.ls-count {
  font-size: 11px;
  color: #2e2e2e;
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
}

.loading-step.ls-active .ls-icon {
  color: #5b8cff;
}

.loading-step.ls-active .ls-label {
  color: #aaa;
}

.loading-step.ls-active .ls-count {
  color: #5b8cff;
}

.loading-step.ls-done .ls-icon {
  color: #2d6b3a;
}

.loading-step.ls-done .ls-label {
  color: #3a3a3a;
}

.loading-step.ls-done .ls-count {
  color: #2e2e2e;
}

@keyframes ls-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.2;
  }
}

.loading-step.ls-active .ls-icon {
  animation: ls-pulse 1.2s ease-in-out infinite;
}

#loading-skip {
  display: block;
  width: 100%;
  background: transparent;
  border: 1px solid #1e1e1e;
  color: #333;
  font-size: 11px;
  padding: 5px;
  cursor: pointer;
  text-align: center;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
}

#loading-skip:hover {
  color: #777;
  border-color: #333;
}

body {
  font-family: var(--f-ui);
  background: var(--bg-0);
  color: var(--tx-1);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── App layout ── */
#app {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#sidebar {
  width: 185px;
  flex-shrink: 0;
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
}

#main {
  flex: 1;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

#reanalysis-prompt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: #1a1a1a;
  border-bottom: 1px solid #222;
  font-size: 12px;
  color: #555;
}

#reanalysis-prompt span {
  flex: 1;
}

#reanalysis-prompt button {
  background: none;
  border: 1px solid #2a2a2a;
  color: #555;
  font-size: 11px;
  padding: 3px 10px;
  cursor: pointer;
  font-family: inherit;
}

#reanalysis-prompt #reanalysis-yes {
  color: #888;
  border-color: #333;
}

#reanalysis-prompt #reanalysis-yes:hover {
  color: #ccc;
  border-color: #555;
}

#reanalysis-prompt #reanalysis-no:hover {
  color: #aaa;
}

body.sim-active #sidebar {
  display: none;
}

body.sim-active #sort-setting-row {
  display: none;
}

/* ── Sim top bar ── */
#sim-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 100;
  background: #111;
  border-bottom: 1px solid #2a0808;
  padding: 0 16px;
  height: 44px;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

body.sim-active #sim-topbar {
  display: flex;
}

#sim-topbar-back {
  background: transparent;
  border: 1px solid #333;
  color: #aaa;
  font-size: 13px;
  padding: 4px 12px;
  cursor: pointer;
  flex-shrink: 0;
}

#sim-topbar-back:hover {
  border-color: #555;
  color: #eee;
}

#sim-topbar-reanalyze {
  background: transparent;
  border: 1px solid #333;
  color: #777;
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  flex-shrink: 0;
}

#sim-topbar-reanalyze:hover {
  border-color: #555;
  color: #aaa;
}

#sim-topbar-stats {
  flex: 1;
  font-size: 12px;
  color: #555;
  text-align: center;
}

#sim-topbar-stats b {
  color: #fca5a5;
}

#sim-topbar-undo {
  background: transparent;
  border: 1px solid #444;
  color: #888;
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  flex-shrink: 0;
  display: none;
}

#sim-topbar-undo:hover {
  border-color: #666;
  color: #bbb;
}

#sim-topbar-upto {
  background: #7f1d1d;
  border: none;
  color: #fca5a5;
  font-size: 12px;
  padding: 5px 12px;
  cursor: pointer;
  flex-shrink: 0;
}

#sim-topbar-upto:hover {
  background: #991b1b;
}

#sim-topbar-upto:disabled {
  background: #2a2a2a;
  color: #444;
  cursor: not-allowed;
}

#sim-topbar-del {
  background: #c0392b;
  border: none;
  color: #fff;
  font-size: 12px;
  padding: 5px 12px;
  cursor: pointer;
  flex-shrink: 0;
  font-weight: 600;
}

#sim-topbar-del:hover {
  background: #e74c3c;
}

#sim-topbar-del:disabled {
  background: #2a2a2a;
  color: #444;
  cursor: not-allowed;
}

.sb-section {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: none;
}

.sb-section:first-of-type {
  border-top: none;
}

.sb-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--tx-3);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  margin-bottom: 7px;
}

.sb-btn-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}

.sb-btn-wrap .sb-btn {
  text-align: center;
}

/* Category options: plain text rows (no button chrome). */
#f-cat-btns .sb-btn {
  display: flex;
  align-items: center;
  text-align: left;
  min-height: 24px;
  padding: 3px 2px;
  border: none;
  border-radius: 0;
  background: none;
  font-size: 13px;
  color: var(--tx-1);
  line-height: 1.2;
  margin: 0;
  user-select: none;
  transition: color 0.12s;
}

#f-cat-btns .sb-btn:hover {
  color: var(--tx-0);
  background: none;
}

#f-cat-btns .sb-btn.active {
  color: var(--ac-hi);
  background: none;
  font-weight: 600;
}

/* English: one category per row (full-width labels). */
#f-cat-btns.sb-cat-en {
  display: flex;
  flex-direction: column;
  grid-template-columns: unset;
  gap: 0;
}

#f-cat-btns.sb-cat-en .sb-btn {
  width: 100%;
  white-space: normal;
}

.sb-btn {
  padding: 6px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--tx-1);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}

.sb-btn:hover {
  color: var(--tx-0);
  background: var(--bg-3);
  border-color: var(--line-2);
}

.sb-btn.active {
  background: var(--ac-dim);
  color: var(--ac-hi);
  border-color: rgba(91, 140, 255, 0.32);
}

/* Find Similar — accent-tinted verdict-chip treatment */
.sb-btn.sim-btn {
  background: var(--ac-dim);
  color: var(--ac-hi);
  border: 1px solid rgba(91, 140, 255, 0.32);
}

.sb-btn.sim-btn:hover {
  background: var(--ac-dim);
  color: var(--ac-hi);
  border-color: rgba(91, 140, 255, 0.5);
}

.sb-btn.sim-btn.active {
  background: var(--ac-dim);
  color: var(--ac-hi);
  border-color: rgba(91, 140, 255, 0.6);
}

/* Star filter — 36px square icon button, amber when active */
.sb-star-filter-btn {
  flex-shrink: 0;
  width: 36px;
  min-width: 36px;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--tx-2);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  border-radius: var(--r-sm);
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
  font-family: var(--f-ui);
}

.sb-star-filter-btn:hover {
  background: var(--bg-3);
  border-color: var(--line-2);
  color: var(--tx-0);
}

.sb-star-filter-btn.active {
  background: var(--r-mid-dim);
  border-color: rgba(245, 181, 10, 0.4);
  color: var(--r-mid);
}

.sb-btn.ai-btn {
  background: var(--bg-2);
  color: var(--tx-1);
  border-color: var(--line);
}

.sb-btn.ai-btn:hover {
  background: var(--bg-3);
  color: var(--tx-0);
  border-color: var(--line-2);
}

/* User widget (header top-right) */
#user-widget {
  position: relative;
  display: flex;
  align-items: center;
}

#settings-btn:hover {
  color: #ccc !important;
  border-color: #444 !important;
}

/* #user-dropdown is now the settings drawer (styled in the SETTINGS DRAWER
   block near the end of this file). Legacy dropdown rules removed. */
#export-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 8px;
  min-width: 180px;
  z-index: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

#export-dropdown.open {
  display: block;
}

.user-dd-divider {
  height: 1px;
  background: #2a2a2a;
  margin-bottom: 8px;
}

.user-dd-item {
  display: block;
  padding: 6px 8px;
  font-size: 12px;
  color: #888;
  text-decoration: none;
  border-radius: 5px;
}

.user-dd-item:hover {
  background: #252525;
  color: #bbb;
}

#f-starred {
  color: #a07820;
}

#f-starred.active {
  background: #78450a;
  color: #f5c518;
}


#sort-select {
  padding: 4px 8px;
  background: transparent;
  border: none;
  border-radius: 0;
  color: #888;
  font-size: 12px;
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
}

#sort-select:hover {
  color: #bbb;
}

#sidebar .range-slider {
  width: 100%;
}

.user-dd-section-label {
  font-size: 10px;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.setting-hint {
  font-size: 10px;
  color: #555;
  margin-top: 5px;
  line-height: 1.4;
  min-height: 14px;
}

.sp-col-btns {
  display: flex;
  gap: 4px;
}

.sp-col-btn {
  flex: 1;
  padding: 5px 0;
  border: 1px solid #2a2a2a;
  border-radius: 5px;
  background: transparent;
  color: #555;
  font-size: 11px;
  cursor: pointer;
  text-align: center;
}

.sp-col-btn:hover {
  border-color: #444;
  color: #aaa;
}

.sp-col-btn.active {
  background: #1e3a5f;
  border-color: #4f8ef7;
  color: #87a8ff;
}

.lb-toggle-btn {
  flex: 1;
  padding: 4px 0;
  background: #1a1a1a;
  border: 1px solid #333;
  color: #555;
  font-size: 11px;
  cursor: pointer;
}

.lb-toggle-btn:hover {
  border-color: #444;
  color: #aaa;
}

.lb-toggle-btn.active {
  background: #1e3a5f;
  border-color: #4f8ef7;
  color: #87a8ff;
}

/* ── Location tree (design .frow look) ── */
.loc-city {
  display: flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 2px;
  border-radius: 0;
  font-size: 13px;
  color: var(--tx-1);
  cursor: pointer;
  transition: color 0.12s;
  user-select: none;
}

.loc-city:hover {
  color: var(--tx-0);
  background: none;
}

.loc-city.active {
  color: var(--ac-hi);
  background: none;
  font-weight: 600;
}

.loc-areas {
  margin: 1px 0 3px 8px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.loc-area {
  padding: 3px 2px;
  border-radius: 0;
  font-size: 12px;
  color: var(--tx-2);
  cursor: pointer;
  transition: color 0.12s;
  user-select: none;
}

.loc-area:hover {
  color: var(--tx-0);
  background: none;
}

.loc-area.active {
  color: var(--ac-hi);
  background: none;
  font-weight: 600;
}

/* ── Calendar ── */
#cal-wrap {
  user-select: none;
  background: var(--bg-2);
  border-radius: var(--r-sm);
  padding: 6px;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.cal-nav {
  background: none;
  border: none;
  color: var(--tx-3);
  cursor: pointer;
  font-size: 15px;
  padding: 0 2px;
  line-height: 1;
}

.cal-nav:hover {
  color: var(--tx-1);
}

.cal-month-label {
  font-size: 11px;
  color: var(--tx-1);
  font-weight: 500;
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}

.cal-dow {
  font-size: 9px;
  color: var(--tx-3);
  text-align: center;
  padding-bottom: 2px;
  font-family: var(--f-mono);
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  color: var(--tx-3);
  border-radius: var(--r-xs);
  cursor: default;
  position: relative;
  transition: background 0.1s, color 0.1s;
}

.cal-day.has-photos {
  color: var(--tx-1);
  cursor: pointer;
  font-weight: 500;
}

.cal-day.has-photos::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ac);
  opacity: 0.7;
}

.cal-day.has-photos:hover {
  color: var(--tx-0);
  background: var(--bg-3);
}

.cal-day.in-range {
  background: var(--ac-dim);
  color: var(--ac-hi);
}

.cal-day.in-range::after {
  opacity: 0;
}

.cal-day.selected {
  background: var(--ac-dim);
  color: var(--tx-0);
}

.cal-day.selected::after {
  opacity: 0;
}

.cal-day.today.has-photos {
  color: var(--tx-0);
}

#cal-clear {
  display: none;
  width: 100%;
  margin-top: 6px;
  padding: 3px 0;
  background: none;
  border: none;
  color: var(--ac);
  font-size: 10px;
  cursor: pointer;
  text-align: center;
}

#cal-clear:hover {
  color: var(--ac-hi);
}

/* ── Header / top bar ── */
header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 52px;
  background: linear-gradient(180deg, var(--bg-1), var(--bg-0));
  border-bottom: 1px solid var(--line);
  padding: 0 24px 0 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

header h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--tx-0);
  white-space: nowrap;
  margin-right: 8px;
}

#count {
  font-size: 13px;
  color: var(--tx-2);
  white-space: nowrap;
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
}

/* Nav buttons (Remote Analyze, Install, Export, settings ⚙) — design .btn look.
   index.html sets base colors inline (border #333, color #888) and toggles
   color/border via onmouseover JS; override with !important so the new tokens win. */
#install-btn,
#settings-btn,
#remote-analyze-btn {
  background: var(--bg-2) !important;
  border: 1px solid var(--line) !important;
  color: var(--tx-1) !important;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

#install-btn:hover,
#settings-btn:hover,
#remote-analyze-btn:hover {
  background: var(--bg-3) !important;
  border-color: var(--line-2) !important;
  color: var(--tx-0) !important;
}

#export-btn {
  background: var(--ac) !important;
  border: 1px solid var(--ac) !important;
  color: #fff !important;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

#export-btn:hover {
  background: var(--ac-hi) !important;
  border-color: var(--ac-hi) !important;
  color: #fff !important;
}

#refresh-btn {
  color: var(--tx-2) !important;
  transition: color 0.15s;
}

#refresh-btn:hover {
  color: var(--tx-0) !important;
}

/* ── Folder selector ── */
.folder-selector {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
  position: relative;
  user-select: none;
}

.folder-selector:hover {
  background: var(--bg-2);
}

.folder-selector:hover .folder-chevron {
  color: var(--tx-1);
}

#folder-name {
  font-size: 14px;
  font-weight: 400;
  color: var(--tx-2);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s;
}

.folder-selector:hover #folder-name {
  color: var(--tx-1);
}

#folder-name.has-folder {
  color: var(--tx-0);
}

.folder-selector:hover #folder-name.has-folder {
  color: var(--tx-0);
}

.folder-chevron {
  font-size: 11px;
  color: var(--tx-3);
  transition: transform 0.15s, color 0.15s;
  flex-shrink: 0;
}

.folder-chevron.open {
  transform: rotate(90deg);
  color: var(--tx-1);
}

.folder-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #1c1c1c;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 5px;
  min-width: 400px;
  z-index: 300;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
}

.folder-dropdown.open {
  display: block;
}

.folder-dd-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #aaa;
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
  overflow: hidden;
}

.folder-dd-item:hover {
  background: #2a2a2a;
  color: #fff;
}

.folder-dd-item.browse {
  color: #4f8ef7;
}

.folder-dd-item.browse:hover {
  background: #1a2a4a;
  color: #87a8ff;
}

.folder-dd-item.active {
  color: #fff;
}

.folder-dd-item .dd-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.folder-dd-item .dd-name {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.folder-dd-item .dd-meta {
  font-size: 11px;
  color: #555;
  flex-shrink: 0;
}

.folder-dd-item .dd-remove {
  font-size: 13px;
  color: #444;
  flex-shrink: 0;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.1s;
}

.folder-dd-item .dd-remove:hover {
  color: #f66;
}

.folder-dd-item .dd-remove:hover {
  color: #f66;
}

.folder-dd-item .dd-path {
  font-size: 11px;
  color: #555;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-dd-divider {
  height: 1px;
  background: #2a2a2a;
  margin: 4px 0;
}

.folder-dd-label {
  font-size: 11px;
  color: #444;
  padding: 5px 10px 3px;
}

/* Recent projects: align count/date columns without separator dot */
.recent-meta-row--full {
  display: grid;
  grid-template-columns: 8.75em minmax(0, max-content);
  align-items: baseline;
  column-gap: 0.35em;
}

.recent-meta-row--single {
  display: inline;
}

.recent-meta-cell--count {
  justify-self: end;
  min-width: 0;
}

.recent-meta-cell--date {
  justify-self: start;
  min-width: 0;
  width: 5em;
  text-align: right;
}

.recent-photo-count {
  display: inline-grid;
  align-items: baseline;
  vertical-align: baseline;
}

.recent-photo-count--zh {
  grid-template-columns: auto auto;
  column-gap: 0;
}

.recent-photo-count--en {
  grid-template-columns: minmax(4.5ch, max-content) minmax(3.75em, max-content);
  column-gap: 0.28em;
}

.recent-photo-num {
  text-align: right;
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
}

.recent-photo-count--en .recent-photo-label {
  text-align: left;
}

.recent-meta-date {
  white-space: nowrap;
}

.recent-project-meta {
  color: #444;
  font-size: 11px;
  flex-shrink: 0;
  margin-left: 10px;
  display: block;
  white-space: nowrap;
}

.folder-dd-item .dd-meta {
  display: block;
  min-width: 11.5em;
}

/* ── Filters ── */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #222;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 5px 10px;
}

.filter-group label {
  font-size: 12px;
  color: #888;
  white-space: nowrap;
}

select,
input[type=range] {
  background: transparent;
  border: none;
  color: #ddd;
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

select option {
  background: #222;
}

/* Dual-handle score range slider */
.range-slider {
  position: relative;
  width: 100px;
  height: 20px;
}

.range-slider input[type=range] {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  margin: 0;
  padding: 0;
}

.range-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4f8ef7;
  cursor: pointer;
  pointer-events: all;
  border: 1px solid #1a1a2e;
  box-shadow: 0 0 0 1px #4f8ef7;
  margin-top: -4px;
}

.range-slider input[type=range]::-webkit-slider-runnable-track {
  height: 2px;
  background: transparent;
}

.range-slider-track {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  height: 2px;
  background: var(--bg-3);
  border-radius: 1px;
  pointer-events: none;
}

.range-slider-fill {
  position: absolute;
  height: 100%;
  background: #4f8ef7;
  border-radius: 1px;
}

.range-val {
  font-size: 12px;
  color: #4f8ef7;
  min-width: 28px;
  text-align: center;
  white-space: nowrap;
}

.toggle-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid #333;
  background: #222;
  color: #aaa;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.toggle-btn.active {
  background: #4f8ef7;
  border-color: #4f8ef7;
  color: #fff;
}

.toggle-btn:hover {
  border-color: #555;
}

.toggle-btn.sim-btn {
  background: #7f1d1d;
  border-color: #991b1b;
  color: #fca5a5;
}

.toggle-btn.sim-btn:hover {
  background: #991b1b;
  border-color: #b91c1c;
}

.toggle-btn.sim-btn.active {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

#select-mode-btn.active {
  background: var(--ac-dim);
  border-color: rgba(91, 140, 255, 0.32);
  color: var(--ac-hi);
}

#f-starred {
  color: #888;
}

#f-starred.active {
  background: #78450a;
  border-color: #a05c0e;
  color: #f5c518;
}

.toggle-btn.warn-btn.active {
  background: #b45309;
  border-color: #b45309;
  color: #fef3c7;
}

.toggle-btn.danger-btn.active {
  background: #1f2937;
  border-color: #4b5563;
  color: #9ca3af;
}

/* Button group (radio-style) — same outer height as .toggle-btn */
.btn-group {
  display: flex;
  gap: 0;
  background: #222;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 2px;
  align-items: center;
}

.btn-group .toggle-btn {
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  padding: 3px 9px;
  font-size: 12px;
  color: #888;
}

.btn-group .toggle-btn.active {
  background: #4f8ef7;
  border-color: #4f8ef7;
  color: #fff;
}

.btn-group .toggle-btn:hover:not(.active) {
  background: #2a2a2a;
  border-color: #444;
}

#sort-select {
  padding: 5px 8px;
  background: transparent;
  border: none;
  border-radius: 0;
  color: #888;
  font-size: 12px;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

/* ── Grid ── */
#grid {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  background: #0f0f0f;
  /* Card typography — scaled down when fixed column count is higher (narrower cells) */
  --card-fn: 11px;
  --card-exif: 12px;
  --card-score: 12px;
  --card-desc: 11px;
  --card-info-pt: 10px;
  --card-info-px: 4px;
  --card-score-pad-y: 1px;
  --card-score-pad-x: 6px;
  --card-top-mb: 5px;
  --card-btn-size: 26px;
  --card-btn-font-del: 13px;
  --card-btn-font-star: 14px;
  --card-btn-inset: 8px;
  --card-top-gap: 3px;
}

#grid[data-cols="3"] {
  --card-fn: 10px;
  --card-exif: 10px;
  --card-score: 11px;
  --card-desc: 10px;
  --card-info-pt: 8px;
  --card-info-px: 3px;
  --card-score-pad-x: 5px;
  --card-top-mb: 4px;
  --card-btn-size: 24px;
  --card-btn-font-del: 12px;
  --card-btn-font-star: 13px;
  --card-btn-inset: 6px;
  --card-top-gap: 2px;
}

#grid[data-cols="4"] {
  --card-fn: 9px;
  --card-exif: 9px;
  --card-score: 10px;
  --card-desc: 9px;
  --card-info-pt: 7px;
  --card-info-px: 2px;
  --card-score-pad-x: 4px;
  --card-top-mb: 3px;
  --card-btn-size: 22px;
  --card-btn-font-del: 11px;
  --card-btn-font-star: 12px;
  --card-btn-inset: 5px;
  --card-top-gap: 2px;
}

#grid[data-cols="5"] {
  --card-fn: 8px;
  --card-exif: 8px;
  --card-score: 9px;
  --card-desc: 8px;
  --card-info-pt: 6px;
  --card-info-px: 2px;
  --card-score-pad-x: 3px;
  --card-top-mb: 3px;
  --card-btn-size: 20px;
  --card-btn-font-del: 10px;
  --card-btn-font-star: 11px;
  --card-btn-inset: 4px;
  --card-top-gap: 2px;
}

/* ── Card ── */
.card {
  position: relative;
  cursor: pointer;
  background: #0f0f0f;
  transition: opacity 0.15s;
  min-width: 0;
  /* grid: allow 1fr columns to stay equal; long filenames clip in .filename */
  container-type: inline-size;
  container-name: sk-card;
}

.card:hover .card-img-wrap {
  opacity: 0.92;
}

.card.selected {
  background: #0d1f3c;
}

.card.selected::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 2px #4f8ef7;
  pointer-events: none;
  z-index: 10;
}

.card-img-wrap {
  position: relative;
  overflow: hidden;
  background: #141414;
  height: 0;
  padding-bottom: 66.667%;
  /* 2/3 of width → always 3:2 */
}

.card img {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* required for object-fit to work on both axes */
  object-fit: cover;
  /* crop: portrait fills the 3:2 box, excess cropped */
  object-position: center center;
  display: block;
}

/* Portrait orientation badge — bottom-left, crop mode only */
body:not(.card-fit) .card-img-wrap[data-portrait]::after {
  content: '';
  position: absolute;
  bottom: 7px;
  left: 7px;
  width: 7px;
  height: 11px;
  border: 1.5px solid rgba(255, 255, 255, 0.55);
  border-radius: 1.5px;
  pointer-events: none;
  z-index: 5;
}

/* fit mode: portrait shown in full, black bars on sides */
body.card-fit .card img {
  object-fit: contain;
  object-position: center center;
}

body.card-fit .card-img-wrap {
  background: #000;
}

/* Filename + category overlay — hidden by default, revealed over the photo on hover */
.card-info {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  padding: 16px 7px 6px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0));
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.card:hover .card-info {
  opacity: 1;
}

.card-top {
  display: flex;
  align-items: center;
  margin-bottom: 0;
  column-gap: var(--card-top-gap);
  flex-wrap: nowrap;
  min-width: 0;
  overflow: hidden;
}

.card-top .filename {
  flex: 1 1 0;
  min-width: 0;
  font-size: var(--card-fn);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  font-family: var(--f-mono);
}

.card-category {
  flex-shrink: 0;
  margin-left: auto;
  font-size: var(--card-fn);
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

.score {
  font-size: var(--card-score);
  font-weight: 700;
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  padding: var(--card-score-pad-y) var(--card-score-pad-x);
  border-radius: 4px;
  flex-shrink: 0;
  margin-left: auto;
}

.score.high {
  background: #1a3a1a;
  color: #4caf50;
}

.score.mid {
  background: #2a2a1a;
  color: #ffc107;
}

.score.low {
  background: #2a1a1a;
  color: #f44336;
}

.desc {
  font-size: var(--card-desc);
  color: #555;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Tile typography by card width (auto grid ~260px+ per track; exif shrinks so title keeps space) */
@container sk-card (max-width: 400px) {
  .card {
    --card-fn: 10px;
    --card-exif: 10px;
    --card-score: 11px;
    --card-desc: 10px;
    --card-info-pt: 8px;
    --card-info-px: 3px;
    --card-score-pad-x: 5px;
    --card-top-mb: 4px;
    --card-btn-size: 24px;
    --card-btn-font-del: 12px;
    --card-btn-font-star: 13px;
    --card-btn-inset: 6px;
    --card-top-gap: 2px;
  }
}

@container sk-card (max-width: 340px) {
  .card {
    --card-fn: 9px;
    --card-exif: 9px;
    --card-score: 10px;
    --card-desc: 9px;
    --card-info-pt: 7px;
    --card-info-px: 2px;
    --card-score-pad-x: 4px;
    --card-top-mb: 3px;
    --card-btn-size: 22px;
    --card-btn-font-del: 11px;
    --card-btn-font-star: 12px;
    --card-btn-inset: 5px;
    --card-top-gap: 2px;
  }
}

@container sk-card (max-width: 290px) {
  .card {
    --card-fn: 8px;
    --card-exif: 8px;
    --card-score: 9px;
    --card-desc: 8px;
    --card-info-pt: 6px;
    --card-info-px: 2px;
    --card-score-pad-x: 3px;
    --card-top-mb: 3px;
    --card-btn-size: 20px;
    --card-btn-font-del: 10px;
    --card-btn-font-star: 11px;
    --card-btn-inset: 4px;
    --card-top-gap: 2px;
  }
}

@container sk-card (max-width: 240px) {
  .card {
    --card-fn: 7px;
    --card-exif: 7px;
    --card-score: 8px;
    --card-desc: 7px;
    --card-info-pt: 5px;
    --card-info-px: 2px;
    --card-score-pad-x: 3px;
    --card-top-mb: 2px;
    --card-btn-size: 18px;
    --card-btn-font-del: 9px;
    --card-btn-font-star: 10px;
    --card-btn-inset: 4px;
    --card-top-gap: 2px;
  }
}

/* Delete button on hover */
.del-btn {
  position: absolute;
  top: var(--card-btn-inset);
  right: var(--card-btn-inset);
  width: var(--card-btn-size);
  height: var(--card-btn-size);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: #ff6666;
  font-size: var(--card-btn-font-del);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  cursor: pointer;
  z-index: 10;
  line-height: 1;
}

.card:hover .del-btn {
  opacity: 1;
}

.del-btn:hover {
  background: rgba(220, 50, 50, 0.8);
  color: #fff;
}

.star-btn {
  position: absolute;
  top: var(--card-btn-inset);
  left: var(--card-btn-inset);
  width: var(--card-btn-size);
  height: var(--card-btn-size);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: #555;
  font-size: var(--card-btn-font-star);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  cursor: pointer;
  z-index: 10;
  line-height: 1;
}

.star-btn.starred {
  opacity: 1;
  color: #f5c518;
}

.card:hover .star-btn {
  opacity: 1;
}

.star-btn:hover {
  color: #f5c518;
}

/* Aesthetic (NIMA) score badge — top-right corner of the thumbnail */
.card-aesthetic {
  position: absolute;
  top: var(--card-btn-inset);
  right: var(--card-btn-inset);
  padding: 1px 4px;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: calc(var(--card-btn-font-star) - 2px);
  font-weight: 400;
  line-height: 1.5;
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  z-index: 9;
}

/* On hover the delete button takes the top-right slot, so hide the badge */
.card:hover .card-aesthetic {
  opacity: 0;
}

/* ── Remote Analyze popup ── */
#remote-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
}

#remote-overlay.open {
  display: flex;
}

#remote-box {
  position: relative;
  width: 360px;
  max-width: 90vw;
  background: #141414;
  border: 1px solid #2a2a2a;
  padding: 22px 22px 18px;
}

#remote-box h3 {
  font-size: 14px;
  font-weight: 600;
  color: #ddd;
  margin-bottom: 14px;
}

#remote-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: #666;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

#remote-close:hover {
  color: #ccc;
}

/* ── OpenRouter remote-analysis inputs ── */
.or-input {
  width: 100%;
  margin-top: 6px;
  padding: 5px 8px;
  background: #0e0e0e;
  border: 1px solid #2a2a2a;
  color: #ddd;
  font-size: 12px;
  font-family: inherit;
  outline: none;
}

.or-input:focus {
  border-color: #555;
}

.or-input::placeholder {
  color: #555;
}

#or-status {
  color: #87a8ff;
}

/* ── Score range filter (dual-handle slider) ── */
.score-range {
  position: relative;
  height: 22px;
  margin: 4px 4px 0;
}

.score-range-track {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 3px;
  transform: translateY(-50%);
  background: #2a2a2a;
}

.score-range-fill {
  position: absolute;
  height: 100%;
  left: 0;
  width: 100%;
  background: var(--ac);
}

.score-range-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 22px;
  margin: 0;
  background: none;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
  /* only thumbs are interactive, so both handles stay grabbable */
}

#score-min {
  z-index: 4;
}

#score-max {
  z-index: 5;
}

.score-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  pointer-events: auto;
  width: 10px;
  height: 10px;
  border-radius: 50% !important;
  background: var(--ac);
  border: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.score-range-input::-moz-range-thumb {
  pointer-events: auto;
  width: 10px;
  height: 10px;
  border-radius: 50% !important;
  background: var(--ac);
  border: none;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.score-range-vals {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #777;
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  margin: 2px 4px 0;
}

/* ── Lightbox ── */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.94);
  grid-template-rows: auto 1fr auto;
  font-family: var(--f-ui);
}

#lightbox.open {
  display: grid;
}

/* ── Top bar ── */
#lb-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.lb-tb-left,
.lb-tb-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

#lb-tb-name {
  font-family: var(--f-mono);
  font-size: 14px;
  color: var(--tx-0);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#lb-tb-counter {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--tx-2);
}

.lb-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--tx-1);
  background: var(--bg-2);
  border: 1px solid var(--line);
  /* border-radius: var(--r-sm) !important; */
  white-space: nowrap;
}

.lb-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  font-size: 15px;
  color: var(--tx-1);
  background: var(--bg-2);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.lb-icon-btn:hover {
  background: var(--bg-3);
  color: var(--tx-0);
}

/* ── Stage ── */
#lb-stage {
  display: grid;
  grid-template-columns: 1fr 360px;
  min-height: 0;
  overflow: hidden;
}

#lb-center {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 8px 16px;
}

#lb-img-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
  max-height: 100%;
}

#lb-img {
  max-width: 100%;
  max-height: calc(100vh - 220px);
  object-fit: contain;
  display: block;
}

.lb-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  z-index: 5;
  transition: background 0.15s;
}

.lb-nav-btn:hover {
  background: rgba(0, 0, 0, 0.75);
}

#lb-prev {
  left: 16px;
}

#lb-next {
  right: 16px;
}

.lb-nav-btn.hidden {
  display: none;
}

#lb-grid-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: none;
}

#lb-histogram {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 180px;
  height: 80px;
  border-radius: var(--r-sm) !important;
  pointer-events: none;
  opacity: 0.85;
}

/* ── Right rail ── */
#lb-rail {
  border-left: 1px solid var(--line);
  background: var(--bg-1);
  padding: 18px 18px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.lb-rail-eyebrow {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tx-2);
  margin-bottom: 12px;
}

/* action buttons */
#lb-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.lb-act-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--tx-1);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.lb-act-btn .lb-act-key {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--tx-3);
}

.lb-act-btn:hover {
  background: var(--bg-3);
}

.lb-act-btn.cut.active,
.lb-act-btn.cut:hover {
  border-color: #f4433680;
  color: #ff6b5e;
}

.lb-act-btn.keep.active {
  border-color: #4caf5080;
  background: #12251a;
  color: #5bd17a;
}

.lb-act-btn.star.active {
  border-color: #f5c51880;
  color: #f5c518;
}

/* AI analysis bars */
.lb-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.lb-bar-label {
  width: 92px;
  font-size: 13px;
  color: var(--tx-1);
}

.lb-bar-track {
  flex: 1;
  height: 6px;
  background: var(--bg-3);
  border-radius: 99px !important;
  overflow: hidden;
}

.lb-bar-fill {
  display: block;
  height: 100%;
  border-radius: 99px !important;
}

.lb-bar-val {
  width: 30px;
  text-align: right;
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--tx-1);
}

/* burst thumbnails */
#lb-burst-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.lb-burst-thumb {
  width: 72px;
  height: 48px;
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.lb-burst-thumb:hover {
  opacity: 1;
}

.lb-burst-thumb.current {
  border-color: var(--ac);
  opacity: 1;
}

/* metadata rows */
.lb-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 5px 0;
  font-size: 13px;
}

.lb-meta-row .k {
  color: var(--tx-2);
}

.lb-meta-row .v {
  color: var(--tx-1);
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ── Filmstrip ── */
#lb-filmstrip {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  overflow-x: auto;
  background: var(--bg-0);
  border-top: 1px solid var(--line);
}

.lb-film-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 104px;
  height: 68px;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.55;
  transition: opacity 0.15s, border-color 0.15s;
}

.lb-film-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lb-film-thumb:hover {
  opacity: 0.85;
}

.lb-film-thumb.current {
  opacity: 1;
  border-color: var(--ac);
}

.lb-film-dot {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50% !important;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.5);
}

.lb-film-dot.keep {
  background: #4caf50;
}

.lb-film-dot.del {
  background: #f44336;
}

@keyframes lbFadeIn {
  from {
    opacity: 0.3
  }

  to {
    opacity: 1
  }
}

.lb-loaded {
  animation: lbFadeIn 0.12s ease-out;
}

@keyframes cardDelete {
  0% {
    opacity: 1;
    transform: scale(1);
  }

  60% {
    opacity: 0.6;
    transform: scale(0.92);
  }

  100% {
    opacity: 0;
    transform: scale(0.82);
  }
}

.card.deleting {
  animation: cardDelete 0.2s cubic-bezier(0.4, 0, 0.8, 1) forwards;
  pointer-events: none;
}

@keyframes lbDelete {
  0% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(0.9);
  }
}

.lb-deleting {
  animation: lbDelete 0.15s ease-in forwards;
}


#lb-magnifier {
  position: fixed;
  border-radius: 50% !important;
  border: 2px solid rgba(255, 255, 255, 0.45);
  pointer-events: none;
  display: none;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(0, 0, 0, 0.3);
  z-index: 1500;
}




/* ── Color swatches ── */
#f-color-btns {
  display: flex;
}

.color-swatch {
  flex: 1;
  height: 16px;
  border-radius: 0;
  cursor: pointer;
  border: none;
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color 0.15s;
}

.color-swatch.active {
  outline-color: #fff;
}

/* ── Search box ── */
#sb-search-section {
  position: relative;
}

#sb-search-section input {
  width: 100%;
  padding: 5px 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  -webkit-appearance: none;
  appearance: none;
  color: var(--tx-0);
  font-size: 12px;
  outline: none;
}

#sb-search-section input:focus {
  border-color: var(--line-2);
}

#sb-search-section input::placeholder {
  color: var(--tx-3);
}

/* ── Batch delete bar ── */
#bottom-stack {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}

#bottom-stack>* {
  pointer-events: auto;
}

#batch-bar {
  background: #222;
  border: 1px solid #444;
  padding: 12px 20px;
  display: none;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  font-size: 13px;
}

#batch-bar.visible {
  display: flex;
}

#batch-del-btn {
  padding: 6px 16px;
  background: #c0392b;
  color: #fff;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
}

#batch-del-btn:hover {
  background: #e74c3c;
}

#batch-star-btn {
  padding: 6px 16px;
  background: #333;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
}

#batch-star-btn:hover {
  background: #444;
  color: #fff;
}

#batch-star-btn.starred {
  background: #78450a;
  color: #f5c518;
  border-color: #a05c0e;
}

#batch-star-btn.starred:hover {
  background: #8a5010;
}

#batch-clear-btn {
  padding: 6px 12px;
  background: #333;
  color: #aaa;
  border: 1px solid #444;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  margin-left: 5px;
  font-size: 11px;
  font-family: inherit;
  line-height: 1.4;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.7);
  vertical-align: middle;
  pointer-events: none;
}

/* Empty state */
#empty {
  display: none;
  text-align: center;
  padding: 80px 20px;
  color: #444;
  font-size: 15px;
}

/* Confirm dialog */
#confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

#confirm-overlay.open {
  display: flex;
}

#confirm-box {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 24px;
  max-width: 340px;
  width: 90%;
  text-align: center;
}

#confirm-box h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

#confirm-box p {
  font-size: 13px;
  color: #888;
  margin-bottom: 20px;
  line-height: 1.5;
}

.confirm-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.confirm-btns button {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 13px;
}

#confirm-yes {
  background: #c0392b;
  color: #fff;
}

#confirm-yes:hover {
  background: #e74c3c;
}

#confirm-no {
  background: #333;
  color: #aaa;
  border: 1px solid #444;
}

/* ── GPS search popup ── */
#gps-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 3000;
  justify-content: center;
  align-items: center;
}

#gps-overlay.open {
  display: flex;
}

#gps-box {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 22px 24px;
  width: min(480px, 94vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#gps-box h3 {
  font-size: 14px;
  color: #ddd;
}

#gps-search-row {
  display: flex;
  gap: 8px;
}

#gps-input {
  flex: 1;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 7px;
  color: #eee;
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
}

#gps-input:focus {
  border-color: #555;
}

#gps-search-btn {
  padding: 8px 16px;
  background: #2a5298;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

#gps-search-btn:hover {
  background: #3a63b8;
}

#gps-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
}

.gps-result-item {
  padding: 9px 12px;
  background: #252525;
  border: 1px solid #333;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: #bbb;
  line-height: 1.4;
}

.gps-result-item:hover {
  background: #2a3a50;
  border-color: #3a5a80;
  color: #ddd;
}

.gps-result-item .gps-result-name {
  font-size: 13px;
  color: #eee;
  margin-bottom: 2px;
}

.gps-result-coords {
  font-size: 11px;
  color: #666;
  margin-top: 2px;
}

#gps-status {
  font-size: 12px;
  color: #666;
  min-height: 16px;
}

#gps-cancel {
  align-self: flex-end;
  padding: 6px 16px;
  background: #333;
  color: #aaa;
  border: 1px solid #444;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
}


/* ── Export popup ── */
#export-overlay,
#export-lr-overlay,
#export-c1-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

#export-overlay.open,
#export-lr-overlay.open,
#export-c1-overlay.open {
  display: flex;
}

#export-box,
#export-lr-box,
#export-c1-box {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 360px;
  width: 90%;
}

#export-box h3,
#export-lr-box h3,
#export-c1-box h3 {
  font-size: 15px;
  margin-bottom: 10px;
  color: #eee;
}

#exp-intro,
#exp-lr-intro,
#exp-c1-intro {
  font-size: 12px;
  color: #666;
  line-height: 1.6;
  margin-bottom: 18px;
}

.export-option {
  margin-bottom: 16px;
}

.export-option label {
  display: block;
  font-size: 12px;
  color: #888;
  margin-bottom: 6px;
}

.export-toggle-group {
  display: flex;
  gap: 6px;
}

.export-toggle-group button {
  flex: 1;
  padding: 7px 0;
  border-radius: 7px;
  border: 1px solid #444;
  background: #2a2a2a;
  color: #aaa;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.export-toggle-group button.active {
  background: #1a3a5c;
  border-color: #3a7bd5;
  color: #7fb8ff;
}

.export-footer {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  justify-content: flex-end;
}

.export-footer button {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 13px;
}

#export-cancel,
#export-lr-cancel,
#export-c1-cancel {
  background: #333;
  color: #aaa;
  border: 1px solid #444;
}

#export-confirm,
#export-lr-confirm,
#export-c1-confirm {
  background: #2a5298;
  color: #fff;
}

#export-confirm:hover,
#export-lr-confirm:hover,
#export-c1-confirm:hover {
  background: #3a63b8;
}

/* ── Undo toast ── */
#undo-toast {
  background: #1a1a1a;
  border: 1px solid #444;
  padding: 8px 14px;
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  white-space: nowrap;
}

#undo-toast.visible {
  display: flex;
}

#undo-toast-btn {
  background: transparent;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}

#undo-toast-btn:hover {
  color: #fff;
}

#undo-toast-close {
  background: transparent;
  border: none;
  color: #555;
  cursor: pointer;
  font-size: 14px;
  padding: 0 0 0 4px;
  line-height: 1;
}

#undo-toast-close:hover {
  color: #aaa;
}

/* ── Feedback popup ── */
#feedback-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

#feedback-overlay.open {
  display: flex;
}

#feedback-box {
  background: #1e1e1e;
  border: 1px solid #333;
  padding: 24px;
  width: 360px;
  max-width: 90vw;
}

#feedback-box h3 {
  font-size: 14px;
  color: #ccc;
  margin-bottom: 14px;
}

#feedback-email {
  width: 100%;
  padding: 7px 10px;
  background: #141414;
  border: 1px solid #333;
  color: #ccc;
  font-size: 13px;
  margin-bottom: 8px;
  box-sizing: border-box;
}

#feedback-text {
  width: 100%;
  height: 100px;
  padding: 8px 10px;
  background: #141414;
  border: 1px solid #333;
  color: #ccc;
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
  margin-bottom: 12px;
  font-family: inherit;
}

#feedback-email:focus,
#feedback-text:focus {
  outline: none;
  border-color: #555;
}

#feedback-submit {
  width: 100%;
  padding: 8px;
  background: #333;
  border: none;
  color: #ccc;
  font-size: 13px;
  cursor: pointer;
}

#feedback-submit:hover {
  background: #444;
  color: #fff;
}

#feedback-submit:disabled {
  background: #222;
  color: #444;
  cursor: not-allowed;
}

#feedback-msg {
  font-size: 12px;
  color: #666;
  margin-bottom: 10px;
  min-height: 16px;
}

/* ── Undo confirm popup ── */
#undo-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 2000;
  justify-content: center;
  align-items: center;
}

#undo-overlay.open {
  display: flex;
}

#undo-box {
  background: #1e1e1e;
  border: 1px solid #333;
  padding: 24px;
  max-width: 360px;
  width: 90%;
  text-align: center;
}

#undo-preview {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  margin-bottom: 16px;
  display: none;
  background: #0a0a0a;
}

#undo-msg {
  font-size: 13px;
  color: #aaa;
  margin-bottom: 20px;
}

#undo-yes {
  background: #2a5298;
  color: #fff;
}

#undo-yes:hover {
  background: #3a62a8;
}

#undo-no {
  background: #333;
  color: #aaa;
  border: 1px solid #444 !important;
}

/* ── Similar panel ── */
#similar-panel {
  display: none;
  padding: 20px;
}

#similar-panel.active {
  display: block;
}

.sim-loading {
  text-align: center;
  padding: 80px 20px;
  color: #666;
}

.sim-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #333;
  border-top-color: #dc2626;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Sim analysis progress ── */
.sim-progress-wrap {
  max-width: 380px;
  margin: 60px auto;
  padding: 28px 36px 24px;
  background: #141414;
  border: 1px solid #222;
}

.sp-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sp-title {
  font-size: 13px;
  font-weight: 600;
  color: #bbb;
}

.sp-overall {
  font-size: 11px;
  color: #dc2626;
  font-variant-numeric: tabular-nums;
}

.sp-bar-wrap {
  height: 2px;
  background: #1e1e1e;
  margin-bottom: 20px;
}

.sp-bar {
  height: 100%;
  background: linear-gradient(90deg, #dc2626, #e87070);
  width: 0%;
  transition: width 0.3s ease-out;
}

.sp-steps {
  display: flex;
  flex-direction: column;
}

.sp-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #191919;
}

.sp-step:last-child {
  border-bottom: none;
}

.sp-icon {
  width: 14px;
  font-size: 11px;
  flex-shrink: 0;
  color: #2a2a2a;
  text-align: center;
  line-height: 1;
}

.sp-label {
  flex: 1;
  font-size: 12px;
  color: #444;
}

.sp-count {
  font-size: 11px;
  color: #2e2e2e;
  font-variant-numeric: tabular-nums;
}

.sp-step.sp-active .sp-icon {
  color: #dc2626;
  animation: ls-pulse 1.2s ease-in-out infinite;
}

.sp-step.sp-active .sp-label {
  color: #aaa;
}

.sp-step.sp-active .sp-count {
  color: #dc2626;
}

.sp-step.sp-done .sp-icon {
  color: #2d6b3a;
}

.sp-step.sp-done .sp-label {
  color: #3a3a3a;
}

.sp-step.sp-done .sp-count {
  color: #2e2e2e;
}

.sim-error {
  text-align: center;
  padding: 60px 20px;
  color: #f44336;
  font-size: 14px;
  line-height: 1.7;
}

.sim-stats {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.sim-stat {
  background: #1e1e2e;
  border: 1px solid #2e2e4e;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  color: #a0a0c0;
}

.sim-stat b {
  color: #fca5a5;
}

.sim-no-dupes {
  text-align: center;
  padding: 80px 20px;
  color: #444;
  font-size: 15px;
}

.sim-group {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  margin-bottom: 16px;
  overflow: hidden;
}

.sim-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  background: #202020;
  cursor: pointer;
  user-select: none;
}

.sim-group-head:hover {
  background: #262626;
}

.sim-badge {
  background: #7f1d1d;
  color: #fca5a5;
  border-radius: 5px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.sim-gtitle {
  flex: 1;
  font-size: 12px;
  color: #888;
  font-family: var(--f-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sim-gcnt {
  font-size: 12px;
  color: #555;
  flex-shrink: 0;
}

.sim-chevron {
  color: #555;
  font-size: 13px;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.sim-group.collapsed .sim-chevron {
  transform: rotate(-90deg);
}

.sim-group.collapsed .sim-photos {
  display: none;
}

.sim-photos {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
}

/* sim-card: green = keep, red = del */
.sim-card {
  width: 190px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.sim-card.keep {
  border-color: #27ae60;
  background: #081810;
}

.sim-card.keep:hover {
  border-color: #2ecc71;
}

.sim-card.del {
  border-color: #7f1d1d;
  background: #1a0808;
}

.sim-card.del:hover {
  border-color: #c0392b;
}

.sim-thumb {
  position: relative;
  width: 100%;
  height: 150px;
  background: #0a0a0a;
  overflow: hidden;
}

.sim-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sim-thumb-zoom {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50% !important;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.15s;
  cursor: pointer;
}

.sim-thumb:hover .sim-thumb-zoom {
  opacity: 1;
}

.sim-badge-state {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
}

.sim-card.keep .sim-badge-state {
  background: #27ae60;
  color: #fff;
}

.sim-card.del .sim-badge-state {
  background: #7f1d1d;
  color: #fca5a5;
}

.sim-eye-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 11px;
  background: rgba(0, 0, 0, 0.6);
  padding: 2px 5px;
}

.sim-card-info {
  padding: 7px 10px 9px;
}

.sim-fname {
  font-size: 10px;
  color: #555;
  font-family: var(--f-mono);
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sim-sharp-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sim-sharp-wrap {
  flex: 1;
  height: 3px;
  background: #333;
  border-radius: 2px;
  overflow: hidden;
}

.sim-sharp-fill {
  height: 100%;
  background: #dc2626;
  border-radius: 2px;
  transition: width 0.3s;
}

.sim-card.keep .sim-sharp-fill {
  background: #27ae60;
}

.sim-sharp-score {
  font-size: 10px;
  color: #555;
  min-width: 28px;
  text-align: right;
  white-space: nowrap;
}

.sim-metric-label {
  font-size: 9px;
  color: #555;
  min-width: 24px;
  white-space: nowrap;
}

.sim-expo-row {
  margin-top: 3px;
}

.sim-expo-fill {
  height: 100%;
  background: #2563eb;
  border-radius: 2px;
  transition: width 0.3s;
}

.sim-card.keep .sim-expo-fill {
  background: #27ae60;
}

/* Trash action bar */
/* ── Sim settings popup ── */
#sim-settings-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 500;
  align-items: center;
  justify-content: center;
}

#sim-settings-overlay.open {
  display: flex;
}

#sim-settings-box {
  background: #1a1a1a;
  border: 1px solid #333;
  padding: 28px 32px;
  width: 340px;
}

#sim-settings-box h3 {
  font-size: 14px;
  font-weight: 600;
  color: #e0e0e0;
  margin-bottom: 24px;
}

.sim-param-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #888;
  margin-bottom: 8px;
}

.sim-param-label b {
  color: #e0e0e0;
  font-size: 13px;
}

#sim-settings-box input[type=range] {
  width: 100%;
  display: block;
  accent-color: #e0e0e0;
  margin-bottom: 6px;
}

.sim-param-hint {
  font-size: 11px;
  color: #555;
  margin-bottom: 24px;
}

#sim-settings-box .sim-reset-btn {
  padding: 9px 16px;
  background: #555;
  color: #ccc;
  border: none;
  font-size: 13px;
  cursor: pointer;
}

#sim-settings-box .sim-reset-btn:hover {
  background: #666;
  color: #fff;
}

#sim-settings-box .sim-start-btn {
  flex: 1;
  padding: 9px;
  background: #e0e0e0;
  color: #111;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

#sim-settings-box .sim-start-btn:hover {
  background: #fff;
}


/* ── Onboarding ── */
.onb-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 24px;
  border-right: 1px solid #222;
  width: 140px;
  flex-shrink: 0;
}

.onb-col:last-child {
  border-right: none;
}

.onb-col-icon {
  font-size: 22px;
  margin-bottom: 10px;
}

.onb-col-title {
  color: #ccc;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

.onb-col-desc {
  color: #555;
  font-size: 11px;
  line-height: 1.5;
}


/* ════════════════════════════════════════════════════════════════════
   SETTINGS DRAWER  (right-side slide-out panel)
   Converts the old #user-dropdown into: full-viewport scrim + 420px
   right-pinned panel that slides in via transform translateX(100%)→0.
   Design tokens (--ac, --bg-*, --line, --tx-*, --f-ui) are defined here
   scoped to the drawer so they don't disturb the rest of the legacy app.
   ──────────────────────────────────────────────────────────────────── */
#user-dropdown {
  /* drawer-scoped design tokens (fall back to app defaults) */
  --ac: #5b8cff;
  --ac-dim: rgba(91, 140, 255, 0.16);
  --bg-1: #0e0f12;
  /* panel */
  --bg-2: #15171b;
  /* inputs / seg track */
  --bg-3: #1d2027;
  /* hover */
  --bg-4: #262a33;
  /* active / switch off */
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --tx-0: #f2f3f5;
  --tx-1: #b6bac2;
  --tx-2: #7c818c;
  --tx-3: #565a63;
  --f-ui: 'Hanken Grotesk', system-ui, sans-serif;
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.4);

  /* full-viewport overlay container; non-interactive until open */
  position: fixed;
  inset: 0;
  z-index: 600;
  display: block;
  /* always in DOM; visibility gated by .open */
  pointer-events: none;
  font-family: var(--f-ui);
}

#user-dropdown.open {
  pointer-events: auto;
}

/* scrim: dims the page behind the panel, click to close */
#user-dropdown .drawer-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

#user-dropdown.open .drawer-scrim {
  opacity: 1;
}

/* panel: pinned to the right edge, full height, slides in from the right */
#user-dropdown .drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 92vw;
  background: var(--bg-1);
  border-left: 1px solid var(--line-2);
  box-shadow: -24px 0 60px -16px rgba(0, 0, 0, 0.75);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(.4, .0, .2, 1);
}

#user-dropdown.open .drawer {
  transform: translateX(0);
}

/* header */
#user-dropdown .drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

#user-dropdown .drawer-head h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--tx-0);
  letter-spacing: -0.01em;
}

#user-dropdown .drawer-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-2);
  border-radius: 8px !important;
  background: transparent;
  color: var(--tx-2);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: color .12s, background .12s, border-color .12s;
}

#user-dropdown .drawer-close:hover {
  color: var(--tx-0);
  background: var(--bg-3);
  border-color: var(--line-strong, rgba(255, 255, 255, 0.2));
}

/* scrollable body */
#user-dropdown .drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 20px 28px;
}

/* sections */
#user-dropdown .set-sec {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

#user-dropdown .set-sec:last-child {
  border-bottom: none;
}

#user-dropdown #settings-advanced>.set-sec:last-child {
  border-bottom: none;
}

/* eyebrow label: small icon + UPPERCASE letter-spaced gray text */
#user-dropdown .set-sec>h4 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tx-3);
}

#user-dropdown .set-sec-ico {
  font-size: 12px;
  line-height: 1;
  color: var(--tx-2);
}

/* setting row: label + description on the left, control on the right */
#user-dropdown .set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 9px 0;
}

#user-dropdown .set-row .st-l {
  min-width: 180px;
  flex: 1 1 auto;
}

#user-dropdown .set-row .st-l .t {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--tx-0);
}

#user-dropdown .set-row .st-l .d {
  font-size: 12px;
  color: var(--tx-2);
  margin-top: 2px;
  max-width: 210px;
  line-height: 1.4;
}

#user-dropdown .set-row .st-l .d:empty {
  display: none;
}

/* segmented control: restyles the legacy .sp-col-btns / button groups */
#user-dropdown .segrow {
  display: flex;
  flex-shrink: 0;
  gap: 2px;
  padding: 3px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  /* border-radius: 9px !important; */
}

#user-dropdown .segrow button {
  flex: 0 0 auto;
  min-width: 30px;
  height: 28px;
  padding: 0 11px;
  border: none;
  background: transparent;
  /* border-radius: 6px !important; */
  color: var(--tx-2);
  font-family: var(--f-ui);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: background .1s, color .1s;
}

#user-dropdown .segrow button:hover {
  color: var(--tx-0);
}

/* active state for both legacy markers: .active and .on */
#user-dropdown .segrow button.active,
#user-dropdown .segrow button.on {
  background: var(--ac);
  color: #fff;
  box-shadow: var(--sh-1);
}

/* toggle switch (available for genuinely binary settings) */
#user-dropdown .sw {
  position: relative;
  flex: 0 0 40px;
  width: 40px;
  height: 23px;
  border: none;
  background: var(--bg-4);
  border-radius: 99px !important;
  cursor: pointer;
  transition: background .14s;
}

#user-dropdown .sw.on {
  background: var(--ac);
}

#user-dropdown .sw .knob {
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 18px;
  height: 18px;
  border-radius: 50% !important;
  background: #fff;
  box-shadow: var(--sh-1);
  transition: transform .16s cubic-bezier(.3, .8, .3, 1.2);
}

#user-dropdown .sw.on .knob {
  transform: translateX(17px);
}

/* kbd chips (for any keyboard-shortcut rows) */
#user-dropdown .kbd {
  display: inline-flex;
  align-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  justify-content: center;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 5px !important;
  color: var(--tx-1);
  font-size: 11px;
  font-weight: 600;
}

/* small "Clear"-style button */
#user-dropdown .drawer-body .btn.sm {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 7px !important;
  color: var(--tx-1);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

#user-dropdown .drawer-body .btn.sm:hover {
  background: var(--bg-3);
  color: var(--tx-0);
}

/* ──────────────────────────── end SETTINGS DRAWER ─────────────────── */

/* ============================================================
   LANDING (#no-folder) — recent-project cards + dropzone
   Matches the design reference (project/app.css .proj-card /
   .dropzone). Design tokens used inline (no :root in this app):
     --ac     #5b8cff   accent (blue)
     --bg-2   #15171b   panel bg / hover
     --bg-3   #1d2026   progress track
     --line   rgba(255,255,255,0.07)  hairline
     --tx-2   #7c818c   tertiary gray (mono sub-line)
     --r-cut  #ff5b5b   destructive red
   NOTE: the global `* { border-radius:0 !important }` rule forces
   square corners, so rounded values here must use !important.
   ============================================================ */
.nf-recents {
  width: min(560px, 88vw);
  display: flex;
  flex-direction: column;
}

.nf-recents .nf-eyebrow {
  font-size: 10px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  margin-bottom: 10px;
  text-align: left;
}

/* card row */
.nf-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  /* border-radius: 10px !important; */
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
}

.nf-card:hover {
  background: #15171b;
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-1px);
}

/* overlapping thumbnail stack (placeholder tiles, no real thumbnails) */
.nf-thumbs {
  display: flex;
  flex-shrink: 0;
}

.nf-thumb {
  width: 46px;
  height: 46px;
  /* border-radius: 7px !important; */
  border: 2px solid #0f0f0f;
  margin-left: -14px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: linear-gradient(145deg, #1d2026, #121316);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  overflow: hidden;
}

.nf-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.nf-thumb.has-img {
  box-shadow: none;
}

.nf-thumb:first-child {
  margin-left: 0;
}

.nf-card:hover .nf-thumb {
  border-color: #15171b;
}

/* middle block: name + mono sub-line */
.nf-main {
  flex: 1;
  min-width: 0;
}

.nf-name {
  font-weight: 700;
  font-size: 15px;
  color: #e6e7ea;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nf-sub {
  margin-top: 3px;
  font-size: 12px;
  color: #7c818c;
  font-family: var(--f-mono, 'JetBrains Mono', ui-monospace, monospace);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* progress bar (hidden for now — no culled metric tracked yet) */
.nf-prog {
  display: none;
  width: 90px;
  flex-shrink: 0;
}

.nf-track {
  height: 4px;
  border-radius: 99px !important;
  background: #1d2026;
  overflow: hidden;
}

/* remove button */
.nf-x {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: #555;
  font-size: 18px;
  line-height: 1;
  border-radius: 6px !important;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.nf-x:hover {
  background: #1d2026;
  color: #ff5b5b;
}

/* dashed dropzone (folded-in choose-folder action) */
.nf-dropzone {
  margin-top: 14px;
  width: 100%;
  min-height: 92px;
  padding: 18px;
  border: 1.5px dashed rgba(255, 255, 255, 0.12);
  /* border-radius: 12px !important; */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #7c818c;
  background: rgba(255, 255, 255, 0.012);
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s, color 0.14s;
}

.nf-dropzone:hover,
.nf-dropzone.drag {
  border-color: #5b8cff;
  background: rgba(91, 140, 255, 0.08);
  color: #e6e7ea;
}

.nf-dz-icon {
  font-size: 22px;
  line-height: 1;
}

.nf-dz-big {
  font-weight: 700;
  font-size: 14px;
  color: #e6e7ea;
}

.nf-dz-sm {
  font-size: 12px;
}