/* Atelier — STL Browser redesign. CSS variables drive light/dark theming. */

:root {
  --bg:           oklch(0.97 0.005 80);
  --bg-frame:     linear-gradient(180deg, oklch(0.99 0.003 80) 0%, oklch(0.94 0.005 80) 100%);
  --bg-elev:      oklch(0.99 0.003 80);
  --bg-side:      oklch(0.97 0.005 80);
  --fg:           oklch(0.20 0.01 80);
  --fg-muted:     oklch(0.45 0.01 80);
  --fg-subtle:    oklch(0.60 0.01 80);
  --border:       oklch(0.90 0.005 80);
  --border-soft:  oklch(0.93 0.005 80);
  --accent:       oklch(0.55 0.15 25);
  --accent-soft:  oklch(0.55 0.15 25 / 0.12);
  --shadow-card:  0 1px 2px oklch(0.20 0.01 80 / 0.04), 0 12px 40px oklch(0.20 0.01 80 / 0.08);
  --shadow-frame: inset 0 0 0 1px oklch(0.90 0.005 80 / 0.6);
  --thumb-bg:     transparent;
}

[data-theme="dark"] {
  --bg:           oklch(0.13 0.005 80);
  --bg-frame:     linear-gradient(180deg, oklch(0.18 0.005 80) 0%, oklch(0.10 0.005 80) 100%);
  --bg-elev:      oklch(0.16 0.005 80);
  --bg-side:      oklch(0.11 0.005 80);
  --fg:           oklch(0.92 0.01 80);
  --fg-muted:     oklch(0.65 0.01 80);
  --fg-subtle:    oklch(0.50 0.01 80);
  --border:       oklch(0.22 0.005 80);
  --border-soft:  oklch(0.18 0.005 80);
  --accent:       oklch(0.70 0.16 25);
  --accent-soft:  oklch(0.70 0.16 25 / 0.18);
  --shadow-card:  0 1px 2px oklch(0 0 0 / 0.4), 0 12px 40px oklch(0 0 0 / 0.4);
  --shadow-frame: inset 0 0 0 1px oklch(0.25 0.005 80 / 0.5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%; overflow: hidden;
  background-color: var(--bg);
  color: var(--fg);
  font-family: 'Geist', system-ui, sans-serif;
}

#root { height: 100%; }

.at-mono { font-family: 'Geist Mono', ui-monospace, monospace; }

/* ─────────────────── OUTER SHELL ─────────────────── */
.at-root {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
}

/* ─────────────────── BANNER ─────────────────── */
.at-banner {
  flex-shrink: 0;
  background: oklch(0.35 0.08 150 / 0.15);
  border-bottom: 1px solid oklch(0.55 0.12 150 / 0.2);
  color: oklch(0.55 0.14 150);
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 7px 32px;
  text-align: center;
}
[data-theme="dark"] .at-banner {
  background: oklch(0.20 0.06 150 / 0.3);
  border-bottom-color: oklch(0.35 0.10 150 / 0.3);
  color: oklch(0.70 0.14 150);
}

/* ─────────────────── TOP BAR ─────────────────── */
.at-topbar {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 220px auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 0 32px;
  height: 80px;
  border-bottom: 1px solid var(--border-soft);
  background-color: var(--bg);
}
.at-logo {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px; letter-spacing: -0.015em; font-weight: 500;
}
.at-logo span { font-style: italic; color: var(--fg-muted); font-weight: 400; }

.at-nav { display: flex; align-items: center; gap: 12px; }
.at-back {
  width: 34px; height: 34px; border-radius: 100px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 14px; cursor: pointer;
  display: grid; place-items: center;
}
.at-back:hover { background: var(--bg-elev); }
.at-back:disabled { opacity: 0.4; cursor: default; }

.at-bcrumb {
  font-family: 'Geist Mono', monospace;
  font-size: 11.5px; letter-spacing: 0.06em;
  color: var(--fg-muted);
  text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
  flex-wrap: nowrap; overflow: hidden;
}
.at-bcrumb .crumb {
  background: none; border: none; cursor: pointer;
  color: var(--fg-muted); font: inherit;
  padding: 0; letter-spacing: inherit; white-space: nowrap;
}
.at-bcrumb .crumb:hover { color: var(--fg); }
.at-bcrumb .here { color: var(--fg); white-space: nowrap; }
.at-bcrumb .sep { color: var(--fg-subtle); }

.at-search {
  justify-self: center;
  width: 100%; max-width: 360px; height: 36px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: 100px;
  padding: 0 18px;
  font-size: 13px; color: var(--fg-subtle);
  display: flex; align-items: center; gap: 10px;
  cursor: text;
}
.at-search-input {
  flex: 1;
  background: none; border: none; outline: none;
  font: inherit; font-size: 13px;
  color: var(--fg);
}
.at-search-input::placeholder { color: var(--fg-subtle); }
.at-search .ic { opacity: 0.6; flex-shrink: 0; }
.at-search .kbd {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-side);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  font-size: 11px; line-height: 1;
  flex-shrink: 0;
}

.at-topbar-right { display: flex; align-items: center; gap: 6px; }
.at-icon-btn {
  width: 36px; height: 36px;
  border-radius: 100px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 14px; cursor: pointer;
  display: inline-grid; place-items: center;
  padding: 0;
}
.at-icon-btn:hover { background: var(--bg-elev); }
.at-icon-btn:disabled { opacity: 0.4; cursor: default; }
.at-icon-btn .ic { display: grid; place-items: center; font-size: 15px; line-height: 1; }

/* ─────────────────── BODY ─────────────────── */
.at-body {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 8px 1fr;
  overflow: hidden;
  min-height: 0;
}

/* ─────────────────── SIDEBAR ─────────────────── */
.at-side {
  background-color: var(--bg-side);
  border-right: 1px solid var(--border-soft);
  padding: 28px 0 28px 28px;
  overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 0;
}
.at-side-home {
  display: flex; align-items: center; gap: 12px;
  margin: 0 24px 22px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background-color: var(--bg-elev);
  border: 1px solid var(--border);
  cursor: pointer;
  font: inherit; color: var(--fg);
  text-align: left;
}
.at-side-home:hover { background-color: var(--bg); }
.at-side-home .dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
}
.at-side-home .t {
  font-family: 'Fraunces', serif;
  font-size: 16px; line-height: 1; letter-spacing: -0.015em;
  margin-bottom: 4px;
}
.at-side-home .s { font-size: 10.5px; color: var(--fg-muted); letter-spacing: 0.04em; }

.at-side-sub {
  font-family: 'Geist Mono', monospace;
  font-size: 10px; letter-spacing: 0.14em;
  color: var(--fg-subtle);
  padding: 0 0 10px 4px;
  text-transform: uppercase;
}
.at-side-list {
  overflow-y: auto; padding-right: 12px; flex: 1;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.at-side-row {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 6px 4px;
  border: none; background: transparent;
  font: inherit; font-size: 12.5px;
  color: var(--fg-muted); text-align: left; cursor: pointer;
  border-radius: 4px;
}
.at-side-row:hover { color: var(--fg); }
.at-side-row.cur { color: var(--fg); font-weight: 600; }
.at-side-row.cur::before { content: '—'; color: var(--accent); margin-right: 6px; font-weight: 400; }
.at-side-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.at-side-row .ct { font-family: 'Geist Mono', monospace; font-size: 10px; color: var(--fg-subtle); }

/* ─────────────────── RESIZER ─────────────────── */
.at-resizer {
  width: 8px; cursor: col-resize; position: relative;
  background: transparent; margin-left: -4px; z-index: 5;
}
.at-resizer::before {
  content: '';
  position: absolute; left: 50%; top: 0; bottom: 0;
  width: 1px; background: var(--border-soft);
}
.at-resizer:hover::before, .at-resizer:active::before { background: var(--accent); width: 2px; }
.at-resizer::after {
  content: '';
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 4px; height: 32px; border-radius: 100px;
  background: var(--border); opacity: 0;
}
.at-resizer:hover::after { opacity: 1; }

/* ─────────────────── MAIN ─────────────────── */
.at-main {
  overflow: auto; padding: 44px 56px 80px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.at-main > .at-bcrumb { margin-bottom: 14px; }

/* Scrollbar polish */
.at-main::-webkit-scrollbar,
.at-side-list::-webkit-scrollbar { width: 8px; }
.at-main::-webkit-scrollbar-track,
.at-side-list::-webkit-scrollbar-track { background: transparent; }
.at-main::-webkit-scrollbar-thumb,
.at-side-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 100px; }

/* ─────────────────── HEADINGS ─────────────────── */
.at-h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 64px; line-height: 0.95; letter-spacing: -0.03em;
  font-weight: 400; margin: 0 0 18px;
  text-wrap: balance; overflow-wrap: anywhere;
}
.at-h1 em { font-style: italic; color: var(--fg-muted); font-weight: 300; }

/* ─────────────────── META ROW ─────────────────── */
.at-meta-row {
  display: flex; gap: 40px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 48px;
}
.at-meta-row .item .l {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-muted); margin-bottom: 6px;
}
.at-meta-row .item .v {
  font-family: 'Fraunces', serif;
  font-size: 22px; letter-spacing: -0.015em; font-weight: 500;
}

/* ─────────────────── SECTION HEADERS ─────────────────── */
.at-sec-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 22px;
}
.at-sec-title { font-family: 'Fraunces', serif; font-size: 24px; letter-spacing: -0.015em; }
.at-sec-meta { font-family: 'Geist Mono', monospace; font-size: 11px; letter-spacing: 0.04em; color: var(--fg-muted); }

/* ─────────────────── FEATURED FRAME ─────────────────── */
.at-featured {
  display: grid; grid-template-columns: 1.4fr 1fr;
  gap: 44px; margin-bottom: 60px;
}
.at-feat-frame {
  aspect-ratio: 4/3;
  background: var(--bg-frame);
  border-radius: 4px; box-shadow: var(--shadow-card);
  padding: 8% 12%; position: relative; overflow: hidden;
}
.at-feat-frame .plinth {
  position: absolute; left: 12%; right: 12%; bottom: 12%;
  height: 6px; background: var(--fg); opacity: 0.08;
}
.at-feat-frame .label {
  position: absolute; bottom: 18px; left: 24px;
  font-family: 'Geist Mono', monospace; font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-muted);
}
.at-feat-frame .label b { color: var(--fg); font-weight: 600; }
.at-feat-info { padding-top: 14px; }
.at-feat-tag {
  font-family: 'Geist Mono', monospace; font-size: 10.5px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 16px;
}
.at-feat-title {
  font-family: 'Fraunces', serif;
  font-size: 26px; line-height: 1.15; letter-spacing: -0.015em;
  margin-bottom: 24px; word-break: break-word;
}
.at-feat-table {
  font-size: 12.5px;
  display: grid; grid-template-columns: 110px 1fr;
  gap: 9px 16px; padding: 22px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}
.at-feat-table dt { color: var(--fg-muted); }
.at-feat-table dd { margin: 0; color: var(--fg); font-family: 'Geist Mono', monospace; }
.at-feat-buttons { display: flex; gap: 10px; margin-top: 22px; }
.at-feat-btn {
  padding: 11px 22px; border-radius: 100px;
  background: var(--fg); color: var(--bg);
  font-family: 'Geist', sans-serif; font-size: 12.5px;
  border: none; cursor: pointer;
}
.at-feat-btn:hover { opacity: 0.85; }
.at-feat-btn.ghost {
  background: transparent; color: var(--fg);
  border: 1px solid var(--fg);
}

/* ─────────────────── FOLDER CARDS ─────────────────── */
.at-folders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--at-folder-min, 200px), 1fr));
  gap: 24px; margin-bottom: 64px;
}
.at-folders.large {
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}
.at-folder-card {
  text-align: left; background: transparent; border: none; padding: 0;
  font: inherit; color: inherit; cursor: pointer;
  display: flex; flex-direction: column; gap: 14px;
}
.at-fc-frame {
  aspect-ratio: 4/3;
  background: oklch(0.20 0.005 80);
  border-radius: 4px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-frame);
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.at-folder-card:hover .at-fc-frame {
  transform: translateY(-2px); box-shadow: var(--shadow-card);
}
.at-folder-card.large .at-fc-frame { aspect-ratio: 16/9; }

.at-fc-counts {
  position: absolute; bottom: 10px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 10px;
  font-family: 'Geist Mono', monospace;
  font-size: 9.5px; letter-spacing: 0.06em;
}
.at-fc-count-item { display: flex; align-items: baseline; gap: 3px; }
.at-fc-count-lbl { color: oklch(0.70 0.005 80); }
.at-fc-count-val { color: oklch(0.88 0.005 80); font-weight: 600; }

.at-fc-stack {
  position: absolute; left: 14%; right: 14%; top: 12%; bottom: 18%;
}
.at-fc-tile {
  position: absolute; width: 56%; height: 78%;
  background: var(--bg-elev); border: 1px solid var(--border-soft);
  border-radius: 4px; overflow: hidden;
  box-shadow: 0 4px 12px oklch(0 0 0 / 0.06);
}
.at-fc-tile.s1 { left: 0; top: 22%; z-index: 1; }
.at-fc-tile.s2 { left: 22%; top: 0; z-index: 2; transform: rotate(-1deg); }
.at-fc-tile.s3 { right: 0; top: 18%; z-index: 1; transform: rotate(2deg); }
.at-folder-card.large .at-fc-tile { width: 32%; height: 82%; }
.at-folder-card.large .at-fc-tile.s1 { left: 4%; }
.at-folder-card.large .at-fc-tile.s2 { left: 30%; top: 8%; }
.at-folder-card.large .at-fc-tile.s3 { right: 4%; top: 12%; }

.at-folder-card.featured .at-fc-frame::after {
  content: '★ Featured';
  position: absolute; top: 14px; left: 16px;
  font-family: 'Geist Mono', monospace; font-size: 9.5px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent);
}
.at-fc-body {
  display: grid; grid-template-columns: 1fr auto;
  gap: 8px 14px; padding-top: 4px;
}
.at-fc-name {
  font-family: 'Fraunces', serif;
  font-size: 16px; line-height: 1.25; letter-spacing: -0.01em;
  color: var(--fg); overflow-wrap: anywhere;
}
.at-fc-meta {
  grid-column: 1 / -1;
  font-family: 'Geist Mono', monospace; font-size: 10.5px;
  color: var(--fg-muted); letter-spacing: 0.04em;
  display: flex; gap: 8px;
}
.at-fc-meta .sz { margin-left: auto; color: var(--accent); }

/* ─────────────────── FILE CARDS ─────────────────── */
.at-files {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--at-card-min, 170px), 1fr));
  gap: 40px 28px;
}
.at-file {
  text-align: left; background: transparent; border: none; padding: 0;
  font: inherit; color: inherit; cursor: pointer;
  display: flex; flex-direction: column;
}
.at-file-frame {
  aspect-ratio: 1; background: var(--bg-frame); border-radius: 4px;
  padding: 10% 15%; position: relative; margin-bottom: 14px;
  box-shadow: var(--shadow-frame);
  transition: transform 200ms ease, box-shadow 200ms ease;
  overflow: hidden;
}
.at-file-frame img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 2px; display: block;
}
.at-file-frame::after {
  content: ''; position: absolute; left: 15%; right: 15%; bottom: 14%;
  height: 3px; background: var(--fg); opacity: 0.06;
  pointer-events: none;
}
.at-file:hover .at-file-frame { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.at-file-hover {
  position: absolute; top: 10px; right: 10px;
  display: flex; gap: 6px; opacity: 0;
  transition: opacity 140ms ease; z-index: 2;
}
.at-file:hover .at-file-hover { opacity: 1; }
.at-file-iconbtn {
  width: 30px; height: 30px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--fg); cursor: pointer; font-size: 13px;
  display: grid; place-items: center;
  box-shadow: 0 2px 6px oklch(0 0 0 / 0.15);
  text-decoration: none; line-height: 1;
}
.at-file-iconbtn:hover { background: var(--fg); color: var(--bg); }
.at-file-name {
  font-family: 'Fraunces', serif; font-size: 14.5px; line-height: 1.3;
  color: var(--fg); margin-bottom: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.at-file-dim { font-family: 'Geist Mono', monospace; font-size: 10.5px; color: var(--fg-muted); letter-spacing: 0.04em; }

/* ─────────────────── SIZE SEGMENTED ─────────────────── */
.at-size-seg {
  display: inline-flex; padding: 3px; border-radius: 100px;
  border: 1px solid var(--border); background: var(--bg-elev);
}
.at-size-btn {
  background: transparent; border: none; padding: 5px 9px;
  border-radius: 100px; font-family: 'Geist Mono', monospace;
  font-size: 11px; font-weight: 500; letter-spacing: 0.04em;
  color: var(--fg-muted); cursor: pointer; min-width: 28px;
}
.at-size-btn:hover { color: var(--fg); }
.at-size-btn.on { background: var(--fg); color: var(--bg); }

/* ─────────────────── FOLDER ACTIONS ─────────────────── */
.at-actions {
  display: flex; align-items: center; justify-content: space-between;
  gap: 22px; padding: 14px 18px; margin-bottom: 48px;
  border-radius: 14px; background-color: var(--bg-elev);
  border: 1px solid var(--border-soft);
}
.at-actions-left, .at-actions-right { display: flex; align-items: center; gap: 10px; }
.at-actions-label { font-size: 10px; letter-spacing: 0.14em; color: var(--fg-muted); }
.at-action-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 100px;
  font: inherit; font-size: 12.5px;
  background: var(--fg); color: var(--bg);
  border: 1px solid var(--fg); cursor: pointer;
}
.at-action-btn:hover { opacity: 0.85; }
.at-action-btn .ic { font-size: 13px; }
.at-action-btn.ghost {
  background: transparent; color: var(--fg); border-color: var(--border);
}
.at-action-btn.ghost:hover { background-color: var(--bg); opacity: 1; }
.at-action-check {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--fg-muted);
  cursor: pointer; user-select: none; padding: 0 8px;
}
.at-action-check input { width: 14px; height: 14px; accent-color: var(--accent); margin: 0; }

/* ─────────────────── REFERENCE IMAGES ─────────────────── */
.at-images-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 18px;
}
.at-image-card {
  display: flex; flex-direction: column; gap: 10px;
  background: transparent; border: none; padding: 0;
  font: inherit; color: inherit; cursor: zoom-in; text-align: left;
}
.at-img-thumb {
  aspect-ratio: 4/3; border-radius: 6px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 180ms ease, box-shadow 180ms ease;
  background: var(--bg-frame);
}
.at-img-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.at-image-card:hover .at-img-thumb {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px oklch(0 0 0 / 0.1), 0 16px 48px oklch(0 0 0 / 0.18);
}
.at-img-tag {
  position: absolute; top: 8px; left: 8px;
  padding: 3px 7px; border-radius: 4px;
  background: oklch(0 0 0 / 0.55); color: oklch(1 0 0 / 0.85);
  font-size: 9.5px; letter-spacing: 0.12em; font-weight: 500;
  font-family: 'Geist Mono', monospace; text-transform: uppercase;
}
.at-image-name { font-size: 10.5px; color: var(--fg-muted); letter-spacing: 0.04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─────────────────── ASSETS ─────────────────── */
.at-assets-list {
  display: flex; flex-direction: column; gap: 4px;
}
.at-asset-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 8px;
  background: var(--bg-card); text-decoration: none; color: inherit;
  transition: background 140ms ease;
}
.at-asset-row:hover { background: var(--bg-hover); }
.at-asset-icon { font-size: 18px; flex-shrink: 0; line-height: 1; }
.at-asset-name { flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-asset-ext  { font-size: 10px; letter-spacing: 0.1em; color: var(--fg-muted); flex-shrink: 0; }
.at-asset-size { font-size: 12px; color: var(--fg-muted); flex-shrink: 0; min-width: 56px; text-align: right; }
.at-asset-dl   { font-size: 16px; color: var(--fg-muted); flex-shrink: 0; opacity: 0.5; }
.at-asset-row:hover .at-asset-dl { opacity: 1; color: var(--accent); }

/* ─────────────────── LIGHTBOX ─────────────────── */
.at-lightbox {
  position: fixed; inset: 0;
  background: oklch(0 0 0 / 0.85);
  backdrop-filter: blur(10px);
  z-index: 200;
  display: grid; grid-template-rows: auto 1fr;
}
.at-lightbox-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px;
  background: oklch(0 0 0 / 0.4);
  border-bottom: 1px solid oklch(1 0 0 / 0.08);
  color: oklch(1 0 0 / 0.9); z-index: 2;
}
.at-lightbox-meta { display: flex; flex-direction: column; gap: 4px; }
.at-lightbox-eyebrow { font-family: 'Geist Mono', monospace; font-size: 10px; letter-spacing: 0.14em; color: oklch(0.7 0.16 25); }
.at-lightbox-name { font-family: 'Geist Mono', monospace; font-size: 13px; color: oklch(1 0 0 / 0.95); }
.at-lightbox-tools { display: flex; align-items: center; gap: 6px; }
.at-lightbox-btn {
  height: 34px; border-radius: 6px;
  background: oklch(1 0 0 / 0.06); border: 1px solid oklch(1 0 0 / 0.12);
  color: oklch(1 0 0 / 0.9); cursor: pointer;
  font-size: 14px; font-family: 'Geist', sans-serif;
  display: grid; place-items: center;
  padding: 0 10px; min-width: 34px;
  text-decoration: none; line-height: 1;
}
.at-lightbox-btn:hover { background: oklch(1 0 0 / 0.14); }
.at-lightbox-btn.close { background: oklch(1 0 0 / 0.12); margin-left: 8px; }
.at-lightbox-zoom { min-width: 56px; text-align: center; font-size: 12px; color: oklch(1 0 0 / 0.7); padding: 0 4px; font-family: 'Geist Mono', monospace; }
.at-lightbox-divider { width: 1px; height: 22px; background: oklch(1 0 0 / 0.14); margin: 0 4px; }
.at-lightbox-stage {
  position: relative; overflow: hidden;
  display: grid; place-items: center;
}
.at-lightbox-img-wrap {
  position: relative;
  max-width: min(90vh, 90vw);
  max-height: calc(100vh - 80px);
  display: flex; align-items: center; justify-content: center;
}
.at-lightbox-img-wrap img {
  max-width: 100%; max-height: calc(100vh - 100px);
  object-fit: contain; user-select: none;
  display: block;
}
.at-lightbox-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 56px; height: 56px; border-radius: 100px;
  background: oklch(1 0 0 / 0.1); border: 1px solid oklch(1 0 0 / 0.15);
  color: oklch(1 0 0 / 0.9); font-size: 32px;
  font-family: 'Geist', sans-serif; line-height: 1;
  display: grid; place-items: center; cursor: pointer; z-index: 3;
}
.at-lightbox-arrow:hover { background: oklch(1 0 0 / 0.2); }
.at-lightbox-arrow.prev { left: 28px; }
.at-lightbox-arrow.next { right: 28px; }

/* ─────────────────── MODALS ─────────────────── */
.at-modal-backdrop {
  position: fixed; inset: 0;
  background: oklch(0 0 0 / 0.45);
  backdrop-filter: blur(6px);
  z-index: 100; display: grid; place-items: center; padding: 40px;
}
.at-modal {
  width: 100%; max-width: 640px; max-height: 85vh; overflow: auto;
  background-color: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 36px 40px; box-shadow: var(--shadow-card);
}
.at-modal.wide { max-width: 980px; }
.at-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding-bottom: 28px; border-bottom: 1px solid var(--border-soft); margin-bottom: 28px;
}
.at-modal-eyebrow {
  font-family: 'Geist Mono', monospace; font-size: 10.5px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 8px;
}
.at-modal-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 28px; letter-spacing: -0.02em; font-weight: 400; margin: 0;
}
.at-modal-close {
  width: 32px; height: 32px; border-radius: 100px;
  background: transparent; border: 1px solid var(--border);
  color: var(--fg-muted); cursor: pointer; font-size: 12px;
}
.at-modal-close:hover { background: var(--bg-elev); color: var(--fg); }
.at-modal-section { margin-bottom: 28px; }
.at-modal-section:last-child { margin-bottom: 0; }
.at-modal-h3 {
  font-family: 'Geist Mono', monospace; font-size: 10.5px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fg-muted); margin: 0 0 12px; font-weight: 500;
}
.at-modal-p { font-size: 13px; line-height: 1.55; color: var(--fg-muted); margin: 0 0 14px; }
.at-modal-p b { color: var(--fg); font-weight: 500; }
.at-modal-row {
  display: grid; grid-template-columns: 22px 1fr auto;
  gap: 12px; padding: 14px 16px; border-radius: 10px;
  background-color: var(--bg-elev); border: 1px solid var(--border-soft); align-items: center;
}
.at-modal-row.good .check { color: var(--accent); font-size: 14px; }
.at-modal-row .lbl {
  font-family: 'Geist Mono', monospace; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-muted); margin-bottom: 2px;
}
.at-modal-row code { font-family: 'Geist Mono', monospace; font-size: 12.5px; color: var(--fg); }
.at-modal-row .sub { font-size: 10.5px; color: var(--fg-muted); margin-top: 4px; }
.at-modal-input-row { display: flex; gap: 8px; }
.at-modal-input {
  flex: 1; padding: 10px 14px; border-radius: 8px;
  background-color: var(--bg-elev); border: 1px solid var(--border);
  color: var(--fg); font-size: 12.5px;
}
.at-modal-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.at-modal-btn {
  padding: 10px 18px; border-radius: 8px;
  background: var(--fg); color: var(--bg);
  border: 1px solid var(--fg); font: inherit; font-size: 12.5px;
  cursor: pointer; white-space: nowrap;
}
.at-modal-btn:hover { opacity: 0.85; }
.at-modal-btn:disabled { opacity: 0.4; cursor: default; }
.at-modal-btn.ghost {
  background: transparent; color: var(--fg); border-color: var(--border);
}
.at-modal-btn.ghost:hover { background-color: var(--bg-elev); opacity: 1; }
.at-modal-actions { display: flex; gap: 8px; margin-top: 8px; }
.at-modal-stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.at-modal-stat-row .stat {
  padding: 12px 14px; background-color: var(--bg-elev);
  border: 1px solid var(--border-soft); border-radius: 10px;
}
.at-modal-stat-row .stat b {
  display: block; font-family: 'Fraunces', serif;
  font-size: 20px; letter-spacing: -0.015em; font-weight: 500; margin-bottom: 2px;
}
.at-modal-stat-row .stat span {
  font-family: 'Geist Mono', monospace; font-size: 10px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-muted);
}
.at-modal-check {
  display: flex; align-items: center; gap: 10px; margin-top: 14px;
  font-size: 12.5px; color: var(--fg-muted); cursor: pointer;
}
.at-modal-check input { width: 14px; height: 14px; accent-color: var(--accent); margin: 0; }
.at-modal-status { font-size: 12px; color: var(--fg-muted); margin-top: 8px; }
.at-modal-status.ok { color: oklch(0.55 0.14 150); }
.at-modal-status.err { color: oklch(0.55 0.18 25); }

/* Theme toggle (inside settings) */
.at-theme-toggle {
  display: inline-flex; padding: 3px; border-radius: 100px;
  border: 1px solid var(--border); background-color: var(--bg-elev);
}
.at-theme-btn {
  background: transparent; border: none; padding: 7px 14px;
  border-radius: 100px; font: inherit; font-size: 12px;
  color: var(--fg-muted); cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; text-transform: capitalize;
}
.at-theme-btn:hover { color: var(--fg); }
.at-theme-btn.on { background: var(--fg); color: var(--bg); }

/* ─────────────────── HELP GRID ─────────────────── */
.at-help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 36px 48px; }
.at-help-sec { break-inside: avoid; }
.at-help-title {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 14px; font-weight: 500;
  padding-bottom: 8px; border-bottom: 1px solid var(--border-soft);
}
.at-help-list {
  display: grid; grid-template-columns: minmax(110px, auto) 1fr;
  gap: 10px 16px; font-size: 12px; margin: 0; align-items: start;
}
.at-help-list dt { color: var(--fg); font-family: 'Geist Mono', monospace; font-size: 11px; font-weight: 500; line-height: 1.5; }
.at-help-list dd { color: var(--fg-muted); margin: 0; line-height: 1.45; }
.at-help-list kbd {
  display: inline-block; padding: 2px 7px; border-radius: 4px;
  background-color: var(--bg-elev); border: 1px solid var(--border);
  color: var(--fg); font-family: 'Geist Mono', monospace; font-size: 10.5px; margin: 0 2px;
}

/* ─────────────────── LOADING ─────────────────── */
.at-loading {
  display: flex; flex-direction: column; gap: 40px 28px;
}
.at-loading-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--at-card-min, 170px), 1fr)); gap: 40px 28px;
}
@keyframes at-shimmer {
  0%   { opacity: 0.4; }
  50%  { opacity: 0.7; }
  100% { opacity: 0.4; }
}
.at-skel {
  animation: at-shimmer 1.5s ease-in-out infinite;
  background: var(--border-soft); border-radius: 4px;
}
.at-skel-sq { aspect-ratio: 1; }
.at-skel-h1 { height: 48px; width: 55%; border-radius: 6px; margin-bottom: 12px; }
.at-skel-ln { height: 12px; width: 100%; border-radius: 4px; }
.at-skel-ln.short { width: 40%; }

/* ─────────────────── SEARCH RESULTS ─────────────────── */
.at-search-empty {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 80px 0; color: var(--fg-subtle);
  font-family: 'Geist Mono', monospace; font-size: 12px;
}
.at-search-empty .big {
  font-family: 'Fraunces', serif; font-size: 32px;
  color: var(--fg-muted); letter-spacing: -0.02em;
}

/* ─────────────────── PRESERVED DETAIL DIALOG STYLES ─────────────────── */
dialog { position: relative; }

#detail-panel[open] {
  width: min(92vw, 860px);
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  color: #ddd;
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr 260px;
  grid-template-rows: 1fr auto;
  gap: 1rem;
}
#detail-panel::backdrop { background: rgba(0,0,0,0.75); }

#viewer-container {
  aspect-ratio: 1;
  background: #111;
  border-radius: 6px;
  overflow: hidden;
  grid-row: 1; grid-column: 1;
  position: relative;
}
#viewer-container canvas {
  display: block; width: 100% !important; height: 100% !important;
}
#viewer-overlay {
  position: absolute; bottom: 8px; left: 8px;
  display: flex; gap: 6px; z-index: 2; pointer-events: none;
}
#viewer-hint {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex; gap: 1.25rem;
  background: rgba(0,0,0,0.72); border: 1px solid #444;
  border-radius: 8px; padding: 10px 18px;
  font-size: 0.78rem; color: #aaa; pointer-events: none;
  opacity: 0; transition: opacity 0.3s;
  white-space: nowrap; backdrop-filter: blur(4px); z-index: 3;
}
#viewer-hint.visible { opacity: 1; }
#viewer-hint b { color: #ddd; font-weight: 600; }
#wireframe-toggle, #viewer-reset, #viewer-help {
  pointer-events: all;
  background: rgba(0,0,0,0.65); border: 1px solid #444;
  border-radius: 4px; color: #bbb;
  padding: 3px 9px; font-size: 0.72rem; cursor: pointer;
  backdrop-filter: blur(4px);
}
#wireframe-toggle:hover, #viewer-reset:hover, #viewer-help:hover { border-color: #888; color: #fff; }
#viewer-help { padding: 3px 7px; }
#detail-meta {
  grid-column: 2; grid-row: 1;
  display: flex; flex-direction: column; gap: 0.5rem;
  padding-top: 0.25rem; overflow: hidden;
}
#detail-name { font-size: 0.9rem; font-weight: 500; color: #eee; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#detail-path { font-size: 0.72rem; color: #777; word-break: break-all; line-height: 1.5; }
#detail-size, #detail-triangles, #detail-bbox { font-size: 0.8rem; color: #aaa; }
#detail-copy-path, #detail-download {
  display: inline-block; padding: 5px 12px;
  border-radius: 4px; font-size: 0.8rem; cursor: pointer;
  text-align: center; text-decoration: none;
}
#detail-copy-path { background: none; border: 1px solid #3a3a3a; color: #aaa; }
#detail-copy-path:hover { border-color: #666; color: #ccc; }
#detail-download { background: #2a5298; border: none; color: #fff; margin-top: auto; }
#detail-download:hover { background: #3560b0; }
#detail-close {
  position: absolute; top: 0.6rem; right: 0.8rem;
  background: none; border: none; color: #666; font-size: 1.1rem; cursor: pointer; line-height: 1;
}
#detail-close:hover { color: #ccc; }
#detail-nav { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.25rem; }
#detail-nav[hidden] { display: none; }
#detail-nav-pos { font-size: 0.75rem; color: #666; min-width: 4ch; text-align: center; }
#detail-prev, #detail-next {
  background: none; border: 1px solid #333; border-radius: 4px;
  color: #888; padding: 1px 8px; cursor: pointer; font-size: 1rem; line-height: 1.4;
}
#detail-prev:hover:not(:disabled), #detail-next:hover:not(:disabled) { border-color: #666; color: #ccc; }
#detail-prev:disabled, #detail-next:disabled { opacity: 0.25; cursor: default; }

/* ─────────────────── LOGIN ─────────────────── */
.at-login-bg {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-side);
}
.at-login-box {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px 36px;
  width: 100%; max-width: 360px;
  box-shadow: var(--shadow-card);
}
.at-login-logo {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 26px; font-weight: 400; letter-spacing: -0.02em;
  color: var(--fg); margin-bottom: 28px;
}
.at-login-logo span { color: var(--fg-muted); }
.at-login-form { display: flex; flex-direction: column; gap: 10px; }
.at-login-input {
  width: 100%; padding: 10px 12px; box-sizing: border-box;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; font: inherit; font-size: 13px; color: var(--fg);
  outline: none;
}
.at-login-input:focus { border-color: var(--accent); }
.at-login-error {
  font-size: 12px; color: var(--accent); padding: 2px 0;
}
.at-login-btn {
  margin-top: 6px; padding: 11px; background: var(--accent);
  border: none; border-radius: 8px; color: #fff;
  font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; letter-spacing: 0.02em;
}
.at-login-btn:hover { opacity: 0.9; }
.at-login-btn:disabled { opacity: 0.5; cursor: default; }

/* ─────────────────── TOPBAR USER ─────────────────── */
.at-topbar-sep {
  width: 1px; height: 18px; background: var(--border); margin: 0 4px;
}
.at-user-menu { position: relative; }
.at-user-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--fg-muted); letter-spacing: 0.04em;
  background: transparent; border: 1px solid var(--border);
  border-radius: 100px; padding: 5px 11px; cursor: pointer;
  font-family: 'Geist Mono', monospace; white-space: nowrap;
  transition: color 120ms, border-color 120ms, background 120ms;
}
.at-user-chip:hover, .at-user-chip.open {
  color: var(--fg); border-color: var(--fg-muted); background: var(--bg-elev);
}
.at-user-chip-caret { font-size: 12px; transition: transform 150ms; }
.at-user-chip.open .at-user-chip-caret { transform: rotate(180deg); }

.at-user-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 184px; padding: 6px; z-index: 60;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  display: flex; flex-direction: column; gap: 2px;
}
.at-user-dropdown-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; text-align: left;
  background: none; border: none; border-radius: 7px;
  padding: 8px 10px; cursor: pointer;
  font: inherit; font-size: 12.5px; color: var(--fg);
}
.at-user-dropdown-item:hover { background: var(--bg); }
.at-user-dropdown-item .ic {
  font-size: 14px; color: var(--fg-muted); width: 16px; text-align: center;
}

/* ─────────────────── USER LIST (SETTINGS) ─────────────────── */
.at-user-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.at-user-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--border-soft);
}
.at-user-row-name { flex: 1; min-width: 0; font-size: 12.5px; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-user-row-role { font-size: 10px; color: var(--fg-subtle); font-family: 'Geist Mono', monospace; letter-spacing: 0.05em; flex-shrink: 0; }

