/* ============================================================
   AssetVault — design system
   ============================================================ */
:root {
  --bg: #0b0b0e;
  --sidebar: #0e0e12;
  --surface: #131318;
  --surface-2: #1a1a20;
  --surface-3: #23232a;
  --hover: rgba(255, 255, 255, .045);
  --active: rgba(255, 255, 255, .08);
  --border: rgba(255, 255, 255, .07);
  --border-strong: rgba(255, 255, 255, .12);

  --text: #ececf1;
  --text-2: #a3a3ae;
  --text-3: #6e6e7a;

  --accent: #7b6cff;
  --accent-hover: #8e81ff;
  --accent-soft: rgba(123, 108, 255, .15);
  --accent-text: #b5acff;

  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;

  --checker-a: #16161b;
  --checker-b: #1e1e24;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 244px;
  --topbar-h: 60px;

  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Code', 'D2Coding', Consolas, 'Pretendard Variable', 'Malgun Gothic', monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { color-scheme: dark; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'tnum';
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
img { display: block; }
::selection { background: var(--accent-soft); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,.16); }

.i { flex-shrink: 0; }

[data-status="후보"] { --st: var(--amber); }
[data-status="채택"] { --st: var(--green); }
[data-status="탈락"] { --st: var(--red); }

.checker {
  background-color: var(--checker-a);
  background-image: conic-gradient(var(--checker-b) 25%, transparent 0 50%, var(--checker-b) 0 75%, transparent 0);
  background-size: 16px 16px;
}

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); }

.sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  padding: 14px 10px 12px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 40;
  transition: transform .25s var(--ease);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 18px;
  font-weight: 700; font-size: 15px; letter-spacing: -.01em;
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #8b7cff, #5b4ce0);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 4px 12px -2px rgba(123,108,255,.45);
}

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  height: 32px; padding: 0 10px;
  border-radius: 7px;
  color: var(--text-2);
  font-size: 13.5px; font-weight: 500;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--active); color: var(--text); }
.nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.nav-section { margin-top: 22px; }
.nav-heading {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6px 6px 10px;
  font-size: 11.5px; font-weight: 600; color: var(--text-3);
  letter-spacing: .02em;
}
.project-dot {
  width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0;
  margin: 0 3px;
  background: hsl(var(--h) 70% 62%);
  box-shadow: 0 0 0 3px hsl(var(--h) 70% 62% / .15);
}
.nav-row { position: relative; }
.nav-row .nav-item { padding-right: 10px; }
.nav-actions {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: flex; gap: 2px;
  opacity: 0; pointer-events: none;
  transition: opacity .12s;
}
.nav-row:hover .nav-actions { opacity: 1; pointer-events: auto; }
.nav-row:hover .nav-count { opacity: 0; }
.nav-empty {
  display: flex; align-items: center; gap: 8px;
  width: 100%; height: 34px; padding: 0 10px;
  border: 1px dashed var(--border-strong); border-radius: 8px;
  color: var(--text-3); font-size: 13px;
  transition: color .12s, border-color .12s;
}
.nav-empty:hover { color: var(--text); border-color: var(--text-3); }

.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar-scrim { display: none; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px;
  background: rgba(11, 11, 14, .78);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.topbar-title {
  display: flex; align-items: baseline; gap: 10px;
  min-width: 0;
  font-size: 16px; font-weight: 700; letter-spacing: -.01em;
  white-space: nowrap;
}
.topbar-title .sub { font-size: 13px; font-weight: 500; color: var(--text-3); }
.spacer { flex: 1; }
.menu-btn { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 13px; font-weight: 600;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s, transform .08s, box-shadow .12s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 1px 2px rgba(0,0,0,.4), 0 6px 16px -6px rgba(123,108,255,.6);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-danger { background: rgba(248,113,113,.12); border-color: rgba(248,113,113,.28); color: #fca5a5; }
.btn-danger:hover { background: rgba(248,113,113,.2); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn kbd { margin-left: 2px; background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.18); color: rgba(255,255,255,.85); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 8px;
  color: var(--text-2);
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.active { background: var(--active); color: var(--text); }
.icon-btn.xs { width: 22px; height: 22px; border-radius: 6px; }
.icon-btn.danger:hover { color: var(--red); background: rgba(248,113,113,.12); }
.icon-btn.bordered { border: 1px solid var(--border-strong); background: var(--surface-2); }
.icon-btn.bordered:hover { background: var(--surface-3); }

kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  font: 500 11px/1 var(--font);
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
}

/* ---------- Inputs ---------- */
.input, .select, .textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0 12px;
  height: 36px;
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:hover, .select:hover, .textarea:hover { border-color: rgba(255,255,255,.18); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea { height: auto; min-height: 96px; padding: 10px 12px; line-height: 1.6; resize: vertical; }
.textarea.mono { font-family: var(--mono); font-size: 12.5px; min-height: 150px; }
.input-lg { height: 46px; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.select {
  appearance: none; -webkit-appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236e6e7a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
.select option { background: var(--surface-2); }
.select.inline { height: 30px; background-color: transparent; border-color: transparent; padding-left: 8px; margin-left: -8px; width: calc(100% + 8px); font-weight: 500; }
.select.inline:hover { background-color: var(--hover); }
.select.inline:focus { background-color: var(--surface); }

.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }
.label { display: block; margin-bottom: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.label .req { color: var(--accent-text); margin-left: 2px; }
.hint { margin-top: 7px; font-size: 12px; color: var(--text-3); line-height: 1.55; }

.search { position: relative; width: 300px; }
.search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search .input { height: 34px; padding-left: 34px; padding-right: 36px; background: var(--surface); }
.search kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search .input:focus + kbd { opacity: 0; }

/* ---------- Chips & segmented ---------- */
.chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 12.5px; font-weight: 500;
  color: var(--text-2);
  transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { background: var(--hover); color: var(--text); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }
.chip .dot, .pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--st, var(--text-3));
}
.chip.active .dot { box-shadow: 0 0 0 2px var(--text); }

.segmented {
  display: flex; gap: 2px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.seg {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border-radius: 7px;
  font-size: 13px; font-weight: 500;
  color: var(--text-2);
  transition: background .14s, color .14s, box-shadow .14s;
}
.seg:hover { color: var(--text); background: var(--hover); }
.seg.active { background: var(--surface-3); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.4), inset 0 0 0 1px var(--border-strong); }
.seg[data-status] .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--st); opacity: .5; }
.seg[data-status].active {
  background: color-mix(in srgb, var(--st) 15%, transparent);
  color: var(--st);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--st) 40%, transparent);
}
.seg[data-status].active .dot { opacity: 1; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  color: var(--text);
  background: rgba(10,10,12,.7);
  border: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.pill .dot { width: 6px; height: 6px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--st) 25%, transparent); }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 9px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px; font-weight: 500; color: var(--text-2);
}

/* ---------- Gallery ---------- */
.toolbar {
  display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap;
  padding: 16px 24px 4px;
}
.filter-group { display: flex; align-items: center; gap: 6px; }
.filter-label { font-size: 12px; color: var(--text-3); margin-right: 4px; font-weight: 500; }
.vr { width: 1px; height: 18px; background: var(--border-strong); }
.size-control { display: flex; align-items: center; gap: 8px; color: var(--text-3); }
.size-control input[type=range] { width: 96px; accent-color: var(--accent); cursor: pointer; }

.gallery { padding: 16px 24px 48px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-size, 210px), 1fr));
  gap: 14px;
}
.card {
  position: relative;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform .2s var(--ease), border-color .2s, box-shadow .2s;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: 0 16px 32px -16px rgba(0,0,0,.7);
}
.card-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.card-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card-media { position: relative; aspect-ratio: 1; overflow: hidden; }
.card-media img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 6%;
  transition: transform .35s var(--ease);
}
.card:hover .card-media img { transform: scale(1.05); }
.card-media .no-img { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); }
.card-top {
  position: absolute; top: 8px; left: 8px; right: 8px; z-index: 2;
  display: flex; justify-content: space-between; align-items: center;
  pointer-events: none;
}
.card-quick {
  position: absolute; left: 50%; bottom: 10px; z-index: 2;
  display: flex; gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(10,10,12,.82);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  transform: translate(-50%, 6px);
  transition: opacity .16s, transform .2s var(--ease);
}
.card:hover .card-quick, .card:focus-within .card-quick { opacity: 1; transform: translate(-50%, 0); }
.qbtn {
  height: 24px; padding: 0 10px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  color: var(--text-2);
  transition: background .12s, color .12s;
}
.qbtn:hover { color: var(--text); background: var(--hover); }
.qbtn.active { color: var(--st); background: color-mix(in srgb, var(--st) 20%, transparent); }
.card-body { padding: 10px 12px 12px; }
.card-name {
  font-size: 13.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta {
  display: flex; align-items: center; gap: 6px;
  margin-top: 3px;
  font-size: 12px; color: var(--text-3);
  white-space: nowrap; overflow: hidden;
}
.card-meta .sep { opacity: .5; }
.card-meta .proj { display: inline-flex; align-items: center; gap: 5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.card-meta .project-dot { width: 7px; height: 7px; border-radius: 2px; margin: 0; box-shadow: none; }

.empty {
  max-width: 480px;
  margin: 56px auto;
  padding: 48px 32px;
  text-align: center;
  border: 1.5px dashed var(--border-strong);
  border-radius: 18px;
}
.empty-icon {
  width: 56px; height: 56px; margin: 0 auto 16px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.empty h3 { font-size: 16px; font-weight: 700; }
.empty p { margin-top: 6px; font-size: 13.5px; color: var(--text-2); line-height: 1.65; }
.empty .actions { margin-top: 20px; display: flex; gap: 8px; justify-content: center; }

.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 32px; }
.page-btn {
  min-width: 32px; height: 32px; padding: 0 8px;
  display: inline-grid; place-items: center;
  border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--text-2);
}
a.page-btn:hover { background: var(--hover); color: var(--text); }
.page-btn.active { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.page-btn.disabled { opacity: .3; pointer-events: none; }

.drop-overlay {
  position: fixed; inset: 0; z-index: 80;
  display: none; place-items: center;
  background: rgba(11,11,14,.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}
body.dragging .drop-overlay { display: grid; }
.drop-card {
  padding: 44px 56px;
  border: 2px dashed var(--accent);
  border-radius: 22px;
  background: var(--accent-soft);
  text-align: center;
  animation: pop .18s var(--ease);
}
.drop-card .empty-icon { background: var(--accent); color: #fff; }
.drop-card h3 { font-size: 18px; font-weight: 700; }
.drop-card p { margin-top: 6px; color: var(--text-2); font-size: 13.5px; }

/* ---------- Detail ---------- */
.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  height: 100vh;
}
.viewer { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.viewer-bar {
  display: flex; align-items: center; gap: 8px;
  height: 56px; padding: 0 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 13px; color: var(--text-3); }
.crumbs a { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.crumbs a:hover { color: var(--text); }
.crumbs .current { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bg-switch {
  display: flex; gap: 4px; padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
}
.swatch {
  width: 20px; height: 20px; border-radius: 5px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
  transition: transform .1s;
}
.swatch:hover { transform: scale(1.1); }
.swatch.active { outline: 2px solid var(--accent); outline-offset: 1px; }
.swatch[data-bg=checker] { background-color: #2a2a31; background-image: conic-gradient(#46464f 25%, transparent 0 50%, #46464f 0 75%, transparent 0); background-size: 10px 10px; }
.swatch[data-bg=dark] { background: #050506; }
.swatch[data-bg=gray] { background: #74747c; }
.swatch[data-bg=light] { background: #f4f4f6; }

.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.stage[data-bg=checker] { background-color: var(--checker-a); background-image: conic-gradient(var(--checker-b) 25%, transparent 0 50%, var(--checker-b) 0 75%, transparent 0); background-size: 24px 24px; }
.stage[data-bg=dark] { background: #050506; }
.stage[data-bg=gray] { background: #74747c; }
.stage[data-bg=light] { background: #f4f4f6; }
.stage-inner { position: absolute; inset: 40px; display: flex; cursor: zoom-in; }
.stage-inner img { margin: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.stage.zoomed .stage-inner { inset: 0; overflow: auto; cursor: zoom-out; }
.stage.zoomed .stage-inner img { max-width: none; max-height: none; flex-shrink: 0; }
.stage-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); text-align: center; }
.stage-nav {
  position: absolute; top: 50%; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(10,10,12,.65);
  border: 1px solid var(--border-strong);
  color: var(--text);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity .15s, background .12s;
}
.stage:hover .stage-nav { opacity: 1; }
.stage-nav:hover { background: rgba(30,30,36,.9); }
.stage-nav.prev { left: 16px; }
.stage-nav.next { right: 16px; }
.stage-info { position: absolute; left: 14px; bottom: 14px; z-index: 2; }
.stage-info .pill { font-weight: 500; color: var(--text-2); }

.filmstrip {
  display: flex; gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
}
.film {
  position: relative;
  width: 56px; height: 56px; flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  opacity: .55;
  box-shadow: inset 0 0 0 1px var(--border-strong);
  transition: opacity .12s, box-shadow .12s;
}
.film:hover { opacity: 1; }
.film.active { opacity: 1; box-shadow: 0 0 0 2px var(--accent); }
.film img { width: 100%; height: 100%; object-fit: contain; }

.inspector {
  display: flex; flex-direction: column;
  min-height: 0;
  background: var(--sidebar);
  border-left: 1px solid var(--border);
  overflow-y: auto;
}
.insp-head { padding: 22px 20px 18px; border-bottom: 1px solid var(--border); }
.insp-title { font-size: 19px; font-weight: 700; line-height: 1.35; letter-spacing: -.015em; word-break: keep-all; overflow-wrap: anywhere; }
.insp-actions { display: flex; gap: 6px; margin-top: 16px; }
.insp-actions .btn-secondary { flex: 1; }
.insp-section { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.insp-section:last-child { border-bottom: none; }
.section-label {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
  font-size: 11.5px; font-weight: 600; color: var(--text-3); letter-spacing: .02em;
}
.props { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-items: center; gap: 6px 12px; font-size: 13px; }
.prop-key { color: var(--text-3); }
.prop-val { min-width: 0; }
.prop-val.text { padding: 5px 0; color: var(--text-2); }
.text-block { font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere; }
.prompt-block {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font: 12.5px/1.75 var(--mono);
  color: #d6d6de;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 280px;
  overflow-y: auto;
}
.tile-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.tile.primary { box-shadow: 0 0 0 2px var(--accent); }
.tile img { width: 100%; height: 100%; object-fit: contain; cursor: pointer; }
.tile-badge {
  position: absolute; top: 4px; left: 4px;
  width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  pointer-events: none;
}
.tile-badge .i { fill: currentColor; }
.tile-actions {
  position: absolute; inset: auto 0 0 0;
  display: flex; justify-content: center; gap: 2px;
  padding: 4px;
  background: linear-gradient(transparent, rgba(0,0,0,.75));
  opacity: 0;
  transition: opacity .12s;
}
.tile:hover .tile-actions { opacity: 1; }
.tile-actions .icon-btn { color: #fff; background: rgba(255,255,255,.12); }
.tile-actions .icon-btn:hover { background: rgba(255,255,255,.22); }
.tile-actions .icon-btn.danger:hover { background: rgba(248,113,113,.45); }
.tile-add {
  position: relative;
  aspect-ratio: 1;
  display: grid; place-items: center;
  border-radius: 8px;
  border: 1.5px dashed var(--border-strong);
  color: var(--text-3);
  transition: color .12s, border-color .12s, background .12s;
}
.tile-add:hover { color: var(--accent-text); border-color: var(--accent); background: var(--accent-soft); }
.tile-add input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.lightbox {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5,5,7,.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade .16s;
}
.lightbox img { max-width: 92vw; max-height: 86vh; object-fit: contain; }
.lightbox .lb-close { position: absolute; top: 18px; right: 18px; }
.lightbox .stage-nav { opacity: 1; }
.lightbox .lb-caption { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); }

/* ---------- Form ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 28px 32px 64px; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.panel + .panel { margin-top: 16px; }
.panel-title {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 16px;
  font-size: 14px; font-weight: 700;
}
.panel-title .sub { font-size: 12px; font-weight: 500; color: var(--text-3); }
.panel .input, .panel .select, .panel .textarea { background: var(--bg); }

.dropzone {
  position: relative;
  padding: 40px 20px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  text-align: center;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-icon {
  width: 48px; height: 48px; margin: 0 auto 14px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--surface-3);
  color: var(--text-2);
  transition: background .15s, color .15s;
}
.dropzone:hover .dz-icon, .dropzone.drag-over .dz-icon { background: var(--accent); color: #fff; }
.dz-title { font-size: 14px; font-weight: 600; }
.dz-sub { margin-top: 6px; font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; justify-content: center; gap: 5px; flex-wrap: wrap; }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.thumbs:not(:empty) { margin-top: 16px; }
.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--border-strong);
  animation: pop .2s var(--ease);
}
.thumb.primary { box-shadow: 0 0 0 2px var(--accent); }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb-badge {
  position: absolute; top: 6px; left: 6px;
  height: 20px; padding: 0 7px;
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700;
}
.thumb-badge .i { fill: currentColor; }
.thumb .tile-actions { padding: 6px; }
.thumb:hover .tile-actions { opacity: 1; }

/* ---------- Settings ---------- */
.settings { max-width: 760px; margin: 0 auto; padding: 28px 32px 64px; }
.settings .panel { padding: 0; overflow: hidden; }
.settings-head { display: flex; gap: 14px; align-items: flex-start; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.settings-head .icon-wrap {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--text-2);
}
.settings-head h2 { font-size: 14.5px; font-weight: 700; }
.settings-head p { margin-top: 2px; font-size: 12.5px; color: var(--text-3); line-height: 1.55; }
.settings-body { padding: 20px 22px; }
.callout {
  display: flex; gap: 10px;
  margin-top: 16px; padding: 12px 14px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid rgba(123,108,255,.25);
  font-size: 12.5px; line-height: 1.65; color: var(--text-2);
}
.callout .i { color: var(--accent-text); margin-top: 2px; }
.callout code { font-family: var(--mono); font-size: 12px; color: var(--text); }
.shortcut-list { display: flex; flex-direction: column; }
.shortcut { display: flex; align-items: center; justify-content: space-between; padding: 10px 22px; font-size: 13px; color: var(--text-2); }
.shortcut + .shortcut { border-top: 1px solid var(--border); }
.shortcut .keys { display: flex; gap: 4px; }
.settings-actions { display: flex; justify-content: flex-end; margin-top: 18px; }

/* ---------- Login ---------- */
.login {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(123,108,255,.14), transparent 70%), var(--bg);
}
.login-card {
  width: min(380px, 100%);
  padding: 36px 30px 30px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: 0 30px 60px -30px rgba(0,0,0,.8);
}
.brand-mark.lg { width: 48px; height: 48px; border-radius: 14px; display: inline-grid; }
.login-card h1 { margin-top: 14px; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.login-sub { margin: 6px 0 22px; font-size: 13.5px; color: var(--text-2); line-height: 1.6; }
.login-card .input { background: var(--bg); text-align: center; }
.login-card .prompt-block { text-align: left; }
.login-error { margin-top: 10px; font-size: 13px; color: var(--red); }
.btn-block { width: 100%; height: 42px; margin-top: 14px; font-size: 14px; }
button.nav-item { width: 100%; text-align: left; }

/* ---------- Toast & dialog ---------- */
#toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 120;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px 10px 14px;
  border-radius: 12px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  box-shadow: 0 16px 40px -10px rgba(0,0,0,.7);
  font-size: 13px; font-weight: 500;
  opacity: 0;
  transform: translate(-50%, 14px) scale(.98);
  pointer-events: none;
  transition: opacity .2s, transform .25s var(--ease);
}
#toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(52,211,153,.2); }
#toast.error::before { background: var(--red); box-shadow: 0 0 0 3px rgba(248,113,113,.2); }
#toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

.dialog-overlay {
  position: fixed; inset: 0; z-index: 110;
  display: grid; place-items: center;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade .14s;
}
.dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 22px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.8);
  animation: pop .18s var(--ease);
}
.dialog h3 { font-size: 16px; font-weight: 700; }
.dialog p { margin-top: 8px; font-size: 13.5px; color: var(--text-2); line-height: 1.65; }
.dialog .input { margin-top: 16px; background: var(--bg); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .detail { grid-template-columns: minmax(0, 1fr) 340px; }
  .search { width: 220px; }
}
@media (max-width: 960px) {
  .form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); box-shadow: 20px 0 60px rgba(0,0,0,.5); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0,0,0,.5); }
  .menu-btn { display: inline-grid !important; }
  .topbar, .toolbar, .gallery { padding-left: 16px; padding-right: 16px; }
  .search { width: auto; flex: 1; min-width: 110px; }
  .topbar-title { flex-shrink: 1; overflow: hidden; }
  .topbar-title .sub { display: none; }
  .search kbd { display: none; }
  .detail { grid-template-columns: 1fr; height: auto; }
  .viewer { height: 70vh; }
  .inspector { border-left: none; border-top: 1px solid var(--border); }
  .page, .settings { padding: 20px 16px 48px; }
  .hide-sm { display: none !important; }
}
