/* CE Portal — main stylesheet */
:root {
  --bg: #0a0e1a;
  --bg2: #111827;
  --bg3: #1e2535;
  --border: #2a3347;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --text3: #64748b;
  --accent: #3b82f6;
  --accent-h: #2563eb;
  --pass: #22c55e;
  --warn: #f59e0b;
  --fail: #ef4444;
  --nav-h: 52px;
  --foot-h: 36px;
  --radius: 8px;
}
[data-theme="light"] {
  --bg: #f8fafc;
  --bg2: #ffffff;
  --bg3: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }

/* ── Nav ── */
.topnav {
  height: var(--nav-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topnav-left  { display: flex; align-items: center; gap: 10px; flex: 1; }
.topnav-center{ display: flex; align-items: center; gap: 4px; }
.topnav-right { display: flex; align-items: center; flex: 1; justify-content: flex-end; }
.nav-logo { height: 26px; width: auto; }
.nav-brand { font-weight: 700; font-size: 15px; letter-spacing: -0.3px; }
.nav-link {
  padding: 5px 12px;
  border-radius: 6px;
  color: var(--text2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--bg3); color: var(--text); }
.nav-link.active { background: var(--accent); color: #fff; }
.theme-toggle { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; cursor: pointer; color: var(--text2); font-size: 14px; }

/* ── Layout ── */
.page-content { flex: 1; padding: 24px 28px; max-width: 1200px; width: 100%; margin: 0 auto; }
.page-title { font-size: 22px; font-weight: 700; margin-bottom: 20px; }
.section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text3); margin-bottom: 12px; }

/* ── Cards ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.card + .card { margin-top: 12px; }

/* ── Stat grid (DB-01) ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat-value { font-size: 32px; font-weight: 900; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text3); margin-top: 4px; }
.stat-pending .stat-value { color: var(--warn); }
.stat-pass .stat-value   { color: var(--pass); }
.stat-cost .stat-value   { color: var(--accent); }

/* ── Queue table ── */
.queue-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.queue-table th { text-align: left; padding: 8px 12px; color: var(--text3); font-weight: 600; border-bottom: 1px solid var(--border); }
.queue-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.queue-table tr:last-child td { border-bottom: none; }
.queue-table tr:hover td { background: var(--bg3); }

/* ── Badges ── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge-pass { background: rgba(34,197,94,0.15); color: var(--pass); }
.badge-warn { background: rgba(245,158,11,0.15); color: var(--warn); }
.badge-fail { background: rgba(239,68,68,0.15); color: var(--fail); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--accent); }

/* ── Image cards (IR-01) ── */
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.image-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.image-card img { width: 100%; aspect-ratio: 9/16; object-fit: cover; display: block; background: var(--bg3); }
.image-card-body { padding: 12px; }
.image-card-meta { font-size: 12px; color: var(--text3); margin-top: 4px; }
.image-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 6px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: opacity 0.15s; text-decoration: none; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-h); }
.btn-success  { background: rgba(34,197,94,0.2); color: var(--pass); border: 1px solid var(--pass); }
.btn-success:hover { background: rgba(34,197,94,0.35); }
.btn-danger   { background: rgba(239,68,68,0.2); color: var(--fail); border: 1px solid var(--fail); }
.btn-danger:hover { background: rgba(239,68,68,0.35); }
.btn-warn     { background: rgba(245,158,11,0.2); color: var(--warn); border: 1px solid var(--warn); }
.btn-warn:hover { background: rgba(245,158,11,0.35); }
.btn-ghost    { background: var(--bg3); color: var(--text2); }
.btn-ghost:hover { color: var(--text); }

/* ── Detail view (ID-01, BR-01, VR-01) ── */
.detail-grid { display: grid; grid-template-columns: 1fr 360px; gap: 20px; align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-preview img { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); }
.panel-section { margin-bottom: 16px; }
.panel-section:last-child { margin-bottom: 0; }
.panel-label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.panel-value { font-size: 13px; color: var(--text); line-height: 1.5; }
.critique-box { background: var(--bg3); border-radius: 6px; padding: 10px 12px; font-size: 13px; color: var(--warn); line-height: 1.5; }
.notes-input { width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; color: var(--text); font-size: 13px; font-family: inherit; resize: vertical; min-height: 70px; }
.notes-input:focus { outline: none; border-color: var(--accent); }
.iteration-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 20px; font-size: 12px; background: var(--bg3); color: var(--text3); }

/* ── Video clip cards (VR-01) ── */
.clip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.clip-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.clip-card video { width: 100%; aspect-ratio: 9/16; object-fit: cover; background: #000; display: block; }
.clip-card-body { padding: 14px; }
.clip-meta { font-size: 12px; color: var(--text3); margin: 4px 0 10px; }

/* ── Toast ── */
#toast { position: fixed; bottom: 24px; right: 24px; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 12px 18px; font-size: 13px; z-index: 9999; opacity: 0; pointer-events: none; transition: opacity 0.3s; max-width: 320px; }
#toast.show { opacity: 1; pointer-events: auto; }
#toast.success { border-color: var(--pass); }
#toast.error   { border-color: var(--fail); }

/* ── Blog preview (BR-01) ── */
.blog-preview { background: var(--bg3); border-radius: var(--radius); padding: 20px; font-size: 14px; line-height: 1.7; max-height: 60vh; overflow-y: auto; }
.blog-preview h1, .blog-preview h2, .blog-preview h3 { color: var(--text); margin: 16px 0 8px; }
.blog-preview p { margin-bottom: 10px; }
.blog-preview img { max-width: 100%; border-radius: 6px; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text3); }
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state-text { font-size: 15px; }

/* ── Footer ── */
.footer { height: var(--foot-h); background: var(--bg2); border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 11px; color: var(--text3); }
.footer-sep { opacity: 0.4; }
.footer-link { color: var(--text3); text-decoration: none; }
.footer-link:hover { color: var(--accent); }

/* ── Platform status widget ── */
.platform-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.platform-dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-ok   { background: var(--pass); }
.dot-warn { background: var(--warn); }
.dot-err  { background: var(--fail); }

/* ── Auth gate ── */
.auth-gate { max-width: 360px; margin: 80px auto; }
.auth-gate .card { padding: 32px; }
.auth-input { width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; color: var(--text); font-size: 14px; margin: 12px 0; }
.auth-input:focus { outline: none; border-color: var(--accent); }
