/* ===== ReelForge design system — dark + purple (Corvus Hub family) ===== */
:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #252540;
  --border: rgba(139, 92, 246, 0.15);
  --border-hover: rgba(139, 92, 246, 0.3);
  --accent: #8b5cf6;
  --accent-hover: #7c3aed;
  --accent-glow: rgba(139, 92, 246, 0.2);
  --text-primary: #f4f0ec;
  --text-secondary: rgba(244, 240, 236, 0.6);
  --text-faint: rgba(244, 240, 236, 0.3);
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 248px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3, h4 { font-family: var(--font-sans); font-weight: 700; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
p { margin: 0 0 1rem; }
small { color: var(--text-secondary); }

/* ---- Scrollbars ---- */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--bg-tertiary); border-radius: 8px; border: 2px solid var(--bg-primary); }
::-webkit-scrollbar-thumb:hover { background: #33335a; }

/* ---- Layout ---- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; height: 100vh; z-index: 40;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 22px 18px;
  font-family: var(--font-sans); font-size: 1.5rem; font-weight: 700;
}
.sidebar-brand .logo-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #c084fc);
  display: grid; place-items: center; color: #fff; font-size: 1rem; box-shadow: 0 4px 14px var(--accent-glow);
}
.nav { flex: 1; padding: 8px 12px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; margin: 3px 0; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-weight: 600; font-size: .95rem;
  transition: background .15s, color .15s; cursor: pointer;
}
.nav-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.nav-item.active { background: var(--accent-glow); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--border-hover); }
.nav-item .ico { width: 19px; height: 19px; flex: 0 0 19px; opacity: .85; }
.nav-foot { padding: 12px; border-top: 1px solid var(--border); }
.nav-user { font-size: .82rem; color: var(--text-faint); padding: 4px 14px 10px; }

.main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: none; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg-secondary);
  position: sticky; top: 0; z-index: 30;
}
.content { padding: 30px 34px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-secondary); margin: 0; }

/* ---- Cards ---- */
.card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.card.hoverable:hover { border-color: var(--border-hover); box-shadow: 0 0 0 1px var(--border-hover), 0 8px 26px var(--accent-glow); }
.card-pad-sm { padding: 16px; }
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.two-pane { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 22px; align-items: start; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-weight: 700; font-size: .92rem; line-height: 1;
  padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  cursor: pointer; transition: background .15s, border-color .15s, opacity .15s, transform .05s; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px var(--accent-glow); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost { background: var(--bg-tertiary); color: var(--text-primary); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--border-hover); background: #2c2c4d; }
.btn-outline { background: transparent; color: var(--text-secondary); border-color: var(--border); }
.btn-outline:hover { color: var(--text-primary); border-color: var(--border-hover); }
.btn-danger { background: transparent; color: var(--error); border-color: rgba(239,68,68,.3); }
.btn-danger:hover { background: rgba(239,68,68,.12); }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 24px; font-size: 1.02rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 7px 12px; font-size: .82rem; }

/* ---- Forms ---- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: 6px; color: var(--text-secondary); }
.input, .select, .textarea {
  width: 100%; background: var(--bg-primary); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 13px; font-family: inherit; font-size: .95rem; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.5; }
.hint { font-size: .8rem; color: var(--text-faint); margin-top: 5px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }

/* ---- Pills / badges ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: .76rem; font-weight: 700; background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border); }
.pill.accent { background: var(--accent-glow); color: #d7c8ff; border-color: var(--border-hover); }
.pill.success { background: rgba(34,197,94,.12); color: #86efac; border-color: rgba(34,197,94,.3); }
.pill.warning { background: rgba(245,158,11,.12); color: #fcd34d; border-color: rgba(245,158,11,.3); }
.pill.muted { opacity: .65; }
.tag { font-size: .74rem; padding: 3px 9px; border-radius: 6px; background: var(--bg-tertiary); color: var(--text-secondary); }

/* segmented toggle */
.segmented { display: inline-flex; background: var(--bg-primary); border: 1px solid var(--border); border-radius: 999px; padding: 4px; gap: 4px; }
.segmented button { border: none; background: transparent; color: var(--text-secondary); font-family: inherit; font-weight: 700; font-size: .9rem; padding: 8px 18px; border-radius: 999px; cursor: pointer; transition: all .15s; }
.segmented button.on { background: var(--accent); color: #fff; box-shadow: 0 4px 12px var(--accent-glow); }

/* filter pills */
.filter-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.filter-pill { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-secondary); color: var(--text-secondary); font-weight: 700; font-size: .84rem; cursor: pointer; transition: all .15s; }
.filter-pill:hover { border-color: var(--border-hover); color: var(--text-primary); }
.filter-pill.active { background: var(--accent-glow); color: #fff; border-color: var(--border-hover); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; padding: 13px 16px; color: var(--text-secondary); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); background: var(--bg-secondary); position: sticky; top: 0; }
table.data td { padding: 13px 16px; border-bottom: 1px solid var(--border); }
table.data tbody tr { background: var(--bg-secondary); transition: background .12s; }
table.data tbody tr:nth-child(even) { background: var(--bg-primary); }
table.data tbody tr:hover { background: var(--bg-tertiary); }
table.data tr:last-child td { border-bottom: none; }

/* ---- Stars ---- */
.stars { display: inline-flex; gap: 3px; font-size: 1.35rem; line-height: 1; }
.stars .star { cursor: pointer; color: var(--text-faint); transition: color .12s, transform .08s; background: none; border: none; padding: 0; }
.stars .star.on { color: #fbbf24; }
.stars .star:hover { transform: scale(1.15); }
.stars.readonly .star { cursor: default; font-size: 1rem; }

/* ---- Dropzone ---- */
.dropzone { border: 2px dashed var(--border-hover); border-radius: var(--radius); padding: 30px 20px; text-align: center; color: var(--text-secondary); cursor: pointer; transition: all .15s; background: var(--bg-primary); }
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-glow); color: var(--text-primary); }
.dropzone .big { font-size: 1.6rem; margin-bottom: 6px; }

/* ---- Toggle switch ---- */
.switch { position: relative; display: inline-block; width: 44px; height: 25px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: 999px; transition: .2s; }
.switch .slider:before { content: ""; position: absolute; height: 17px; width: 17px; left: 3px; bottom: 3px; background: var(--text-secondary); border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .slider:before { transform: translateX(19px); background: #fff; }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tab { padding: 11px 18px; font-weight: 700; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }

/* ---- Misc ---- */
.empty { text-align: center; padding: 56px 20px; color: var(--text-secondary); }
.empty .big { font-size: 2.4rem; margin-bottom: 10px; opacity: .5; }
.muted { color: var(--text-secondary); }
.faint { color: var(--text-faint); }
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.wrap-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.thumb { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: var(--radius-sm); background: var(--bg-primary); }
.thumb-3-4 { aspect-ratio: 3 / 4; }
.avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: var(--bg-tertiary); display: grid; place-items: center; font-family: var(--font-sans); font-size: 1.3rem; color: var(--accent); }
.divider { height: 1px; background: var(--border); margin: 18px 0; border: none; }
.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.code-block { white-space: pre-wrap; word-break: break-word; font-family: var(--font-sans); background: var(--bg-primary); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px; line-height: 1.6; font-size: .95rem; }

/* ---- Modal ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.62); display: none; z-index: 80; align-items: flex-start; justify-content: center; padding: 46px 16px; overflow-y: auto; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg-secondary); border: 1px solid var(--border-hover); border-radius: var(--radius); width: 100%; max-width: 560px; box-shadow: var(--shadow); animation: toastin .18s ease; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { background: none; border: none; color: var(--text-secondary); font-size: 1.5rem; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text-primary); }

/* ---- Toast ---- */
.toast-host { position: fixed; bottom: 22px; right: 22px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--bg-tertiary); border: 1px solid var(--border-hover); border-radius: var(--radius-sm); padding: 13px 18px; box-shadow: var(--shadow); animation: toastin .2s ease; font-weight: 600; }
.toast.success { border-color: rgba(34,197,94,.4); }
.toast.error { border-color: rgba(239,68,68,.4); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

/* ---- Login ---- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo .logo-mark { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 12px; background: linear-gradient(135deg, var(--accent), #c084fc); display: grid; place-items: center; font-size: 1.6rem; box-shadow: 0 8px 28px var(--accent-glow); }

/* ---- Mobile ---- */
.hamburger { background: var(--bg-tertiary); border: 1px solid var(--border); color: var(--text-primary); border-radius: var(--radius-sm); padding: 9px 12px; cursor: pointer; font-size: 1.1rem; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 39; }
@media (max-width: 900px) {
  .two-pane { grid-template-columns: 1fr; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar { display: flex; }
  .scrim.show { display: block; }
  .content { padding: 20px 16px; }
}
