:root {
  --bg: #faf8f3;
  --surface: #fff;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --faint: #9a9a9a;
  --line: #e6e1d6;
  --line-strong: #d4ccba;
  --hover: #f4efe1;
  --accent: #2a5d3a;
  --ok: #2f7d32;
  --no: #b3261e;
  --use: #7a4eab;
  --pending: #9a7d2a;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 24px rgba(0,0,0,.06);
  --r: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* App shell layout */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 48px 1fr;
  grid-template-areas: "top top" "side main";
  min-height: 100vh;
}
.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .logo {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.01em;
}
.brand-switch {
  position: relative;
}
.brand-switch button {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
}
.brand-switch button:hover { border-color: var(--line-strong); }
.brand-switch .menu {
  position: absolute;
  top: 36px;
  left: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  min-width: 180px;
  display: none;
  overflow: hidden;
  z-index: 30;
}
.brand-switch .menu.open { display: block; }
.brand-switch .menu a {
  display: block;
  padding: 9px 14px;
  font-size: 13px;
}
.brand-switch .menu a:hover { background: var(--hover); }
.brand-switch .menu a.current { color: var(--accent); font-weight: 600; }
.topbar .crumbs {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar .crumbs .sep { color: var(--faint); }
.topbar .crumbs strong { color: var(--ink); font-weight: 600; }
.topbar .spacer { flex: 1; }
.topbar .search {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
  width: 260px;
  color: var(--ink);
}
.topbar .search:focus { outline: none; border-color: var(--line-strong); }
.topbar .kbd-hint {
  font-size: 11px;
  color: var(--faint);
}
.topbar .kbd-hint kbd {
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 1px 5px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 10px;
}

/* Sidebar */
.sidebar {
  grid-area: side;
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: 14px 10px;
  position: sticky;
  top: 48px;
  height: calc(100vh - 48px);
  overflow-y: auto;
}
.nav-section {
  margin-bottom: 18px;
}
.nav-section .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  padding: 0 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 1px;
}
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item.active { background: #eee5cf; color: var(--ink); font-weight: 600; }
.nav-item.disabled { color: var(--faint); cursor: not-allowed; }
.nav-item.disabled:hover { background: transparent; color: var(--faint); }
.nav-item .icon { width: 14px; height: 14px; flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto;
  font-size: 11px;
  background: var(--line);
  color: var(--muted);
  padding: 1px 7px;
  border-radius: 99px;
  min-width: 22px;
  text-align: center;
}
.nav-item.active .badge { background: var(--ink); color: #fff; }
.nav-item .badge.soon {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--faint);
  font-size: 10px;
}

/* Main */
.main {
  grid-area: main;
  padding: 22px 28px 80px;
  max-width: 100%;
  overflow-x: hidden;
}
.page-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 4px;
}
.page-head h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}
.page-head .count { color: var(--muted); font-size: 13px; }
.page-sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

/* Status tabs (inbox sub-nav) */
.tabs {
  display: flex;
  gap: 18px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.tabs a {
  padding: 8px 2px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.tabs a .num {
  display: inline-block;
  font-size: 11px;
  color: var(--muted);
  background: var(--line);
  padding: 1px 6px;
  border-radius: 99px;
  margin-left: 4px;
}

/* Filters */
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.filter {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.filter:hover { border-color: var(--line-strong); }
.filter.active { background: #eee5cf; border-color: var(--line-strong); }
.filter select {
  border: 0;
  background: transparent;
  font: inherit;
  color: inherit;
  padding-right: 2px;
}
.filter select:focus { outline: none; }
.filter-reset {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  padding: 0 4px;
}

/* Card grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: opacity .15s, transform .15s, box-shadow .15s, border-color .12s;
}
.card.gone { opacity: 0; transform: scale(.97); pointer-events: none; }
.card.focused { border-color: var(--ink); box-shadow: 0 0 0 2px rgba(26,26,26,.08); }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(42,93,58,.18); }
.card .thumb {
  aspect-ratio: 1/1;
  background: #efe8d6;
  overflow: hidden;
  position: relative;
  cursor: zoom-in;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .vbadge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0,0,0,.7);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}
.card .checkbox {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1.5px solid #fff;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .12s;
}
.card:hover .checkbox, .card.selected .checkbox { opacity: 1; }
.card.selected .checkbox {
  background: var(--accent);
  border-color: var(--accent);
}
.card.selected .checkbox::after { content: "✓"; color: #fff; font-size: 13px; line-height: 1; }
.card .body {
  padding: 9px 11px 8px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 84px;
}
.card .pn {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.card .copy {
  font-size: 12px;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .meta {
  font-size: 11px;
  color: var(--faint);
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card .meta a { color: var(--faint); }
.card .meta a:hover { color: var(--ink); }
.actions {
  display: grid;
  border-top: 1px solid var(--line);
}
.actions.two { grid-template-columns: 1fr 1fr; }
.actions.three { grid-template-columns: 1fr 1fr 1fr; }
.actions button {
  background: none;
  border: 0;
  padding: 9px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  transition: background .12s, color .12s;
  border-right: 1px solid var(--line);
}
.actions button:last-child { border-right: 0; }
.actions button:hover { background: var(--hover); }
.actions .acc:hover { color: var(--ok); }
.actions .rej:hover { color: var(--no); }
.actions .use:hover { color: var(--use); }
.actions .back:hover { color: var(--ink); }
.actions button:disabled { opacity: .4; cursor: default; }

/* Empty state */
.empty {
  padding: 80px 24px;
  text-align: center;
  color: var(--muted);
}
.empty h3 { margin: 0 0 6px; font-size: 16px; color: var(--ink); font-weight: 600; }
.empty p { margin: 0; font-size: 13px; }

/* Selection bar */
.selbar {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ink);
  color: #fff;
  padding: 8px 8px 8px 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
  transition: transform .22s cubic-bezier(.2,.7,.2,1);
  z-index: 40;
}
.selbar.show { transform: translateX(-50%) translateY(0); }
.selbar .n { font-size: 13px; margin-right: 8px; }
.selbar button {
  background: rgba(255,255,255,.1);
  color: #fff;
  border: 0;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.selbar button:hover { background: rgba(255,255,255,.2); }
.selbar .clear { background: transparent; color: rgba(255,255,255,.6); font-weight: 400; }
.selbar .clear:hover { color: #fff; }

/* Modal overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,18,12,.88);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
}
.overlay.open { display: flex; }
.overlay .stage {
  max-width: min(960px, 95vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.overlay .stage img,
.overlay .stage video {
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
  background: #000;
  border-radius: 6px;
}
.overlay .meta {
  color: #eee;
  font-size: 13px;
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.overlay .meta a { color: #fff; text-decoration: underline; }
.overlay .close {
  position: absolute;
  top: 14px;
  right: 18px;
  background: none;
  border: 0;
  color: #fff;
  font-size: 28px;
  line-height: 1;
}
.overlay .copy {
  color: #ddd;
  font-size: 13px;
  max-width: 960px;
  max-height: 18vh;
  overflow-y: auto;
  background: rgba(0,0,0,.4);
  padding: 10px 14px;
  border-radius: 6px;
  white-space: pre-wrap;
}

/* Toast (undo) */
.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  background: var(--ink);
  color: #fff;
  padding: 11px 14px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
  transform: translateY(80px);
  opacity: 0;
  transition: transform .22s cubic-bezier(.2,.7,.2,1), opacity .22s;
  z-index: 45;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast button {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 0;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
}
.toast button:hover { background: rgba(255,255,255,.28); }
.toast kbd {
  border: 1px solid rgba(255,255,255,.3);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 1px 5px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 10px;
}

/* Right-side detail panel */
.panel-backdrop {
  position: fixed;
  inset: 48px 0 0 220px;
  background: rgba(20,18,12,.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s;
  z-index: 30;
}
.panel-backdrop.open { opacity: 1; pointer-events: auto; }
.panel {
  position: fixed;
  top: 48px;
  right: 0;
  height: calc(100vh - 48px);
  width: min(520px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--line-strong);
  box-shadow: -8px 0 30px rgba(0,0,0,.06);
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.2,.7,.2,1);
  z-index: 35;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.panel.open { transform: translateX(0); }
.panel .ph {
  padding: 14px 18px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.panel .ph .pn { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; flex: 1; }
.panel .ph .x { background: none; border: 0; font-size: 22px; color: var(--muted); padding: 0 4px; line-height: 1; }
.panel .ph .x:hover { color: var(--ink); }
.panel .scroll { flex: 1; overflow-y: auto; padding: 14px 18px 18px; }
.panel .media {
  width: 100%;
  background: #f0ebde;
  border-radius: 6px;
  margin-bottom: 14px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: 360px;
}
.panel .media img, .panel .media video {
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
  display: block;
  background: #000;
}
.panel .metarow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}
.panel .metarow a { color: var(--muted); text-decoration: underline; }
.panel .metarow a:hover { color: var(--ink); }
.panel .copyblock {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  white-space: pre-wrap;
  margin-bottom: 16px;
  color: var(--ink);
  max-height: 180px;
  overflow-y: auto;
}
.panel .section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  font-weight: 600;
  margin: 14px 0 6px;
}
.panel textarea.brief {
  width: 100%;
  min-height: 180px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  font: 13px/1.55 -apple-system, system-ui, sans-serif;
  resize: vertical;
  background: var(--surface);
  color: var(--ink);
}
.panel textarea.brief:focus { outline: none; border-color: var(--line-strong); }
.panel .brief-status {
  font-size: 11px;
  color: var(--faint);
  margin: 4px 0 8px;
  text-align: right;
  min-height: 14px;
}
.panel .footer {
  border-top: 1px solid var(--line);
  padding: 12px 18px;
  display: flex;
  gap: 8px;
  background: var(--bg);
  flex-shrink: 0;
}
.panel .footer button {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.panel .footer button:hover { background: var(--hover); }
.panel .footer .rej { color: var(--no); border-color: var(--no); }
.panel .footer .rej:hover { background: var(--no); color: #fff; }
.panel .footer .acc { background: var(--accent); color: #fff; border-color: var(--accent); }
.panel .footer .acc:hover { filter: brightness(1.05); }
.panel .footer .use { background: var(--use); color: #fff; border-color: var(--use); }
.panel .footer .use:hover { filter: brightness(1.05); }
.panel .footer .back { color: var(--muted); }

/* Doc-style content (formats / library / video pages) */
.doc {
  max-width: 880px;
  margin: 0 auto;
}
.doc h2 { font-size: 18px; margin: 24px 0 8px; font-weight: 600; }
.doc p { margin: 0 0 12px; color: var(--ink); }
.doc .muted { color: var(--muted); }
