:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --text: #e7ecf3;
  --muted: #8b98a8;
  --accent: #3d8bfd;
  --danger: #e55353;
  --border: #2a3544;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}
a { color: var(--accent); }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
.topbar nav { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.topbar .nav, button, .btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}
button.secondary, .btn.secondary, a.btn.secondary { background: #3a4555; color: #fff; }
button.secondary:disabled { opacity: 0.45; cursor: not-allowed; }
button.danger { background: var(--danger); }
.topbar .nav.active { outline: 2px solid #fff; outline-offset: 2px; }
main { padding: 1.25rem; max-width: 1200px; margin: 0 auto; }
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}
.stat-label { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.25rem; }
.stat-value { font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--muted); font-size: 0.8rem; margin-top: 0.2rem; }
.cost-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.login-page { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: min(400px, 92vw); }
label { display: block; margin-bottom: 0.75rem; }
input, select, textarea {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #0c1016;
  color: var(--text);
  font: inherit;
}
textarea { min-height: 280px; font-family: ui-monospace, monospace; font-size: 0.85rem; }
.muted { color: var(--muted); }
.row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-bottom: 0.75rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--border); }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #222b38; }
.badge { display: inline-block; padding: 0.15rem 0.45rem; border-radius: 999px; background: #2d3a4d; font-size: 0.8rem; }
.error { color: var(--danger); }
.warn { color: #e6a23c; }
.ig-meta { font-size: 0.9rem; margin: 0.35rem 0; }
.ig-meta code { font-size: 0.85rem; }
.yt-meta { font-size: 0.9rem; margin: 0.35rem 0; }
.yt-meta code { font-size: 0.85rem; }
.publication-section { margin-top: 0.65rem; }
.publication-section:first-of-type { margin-top: 0.5rem; }
.publication-disclosure {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #141c28;
}
.publication-disclosure-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.publication-disclosure-summary::-webkit-details-marker { display: none; }
.publication-disclosure-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1rem;
  font-weight: 600;
}
.publication-disclosure-title::before {
  content: '▸';
  display: inline-block;
  color: var(--muted);
  font-size: 0.85rem;
  transition: transform 0.15s ease;
}
.publication-disclosure[open] .publication-disclosure-title::before {
  transform: rotate(90deg);
}
.publication-disclosure-body {
  padding: 0.75rem 0.85rem 0.85rem;
  border-top: 1px solid var(--border);
}
.publication-disclosure-body > h5:first-child { margin-top: 0; }
.tt-meta { font-size: 0.9rem; margin: 0.35rem 0; }
.tt-publish-split {
  display: grid;
  grid-template-columns: 1fr min(300px, 38%);
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 900px) {
  .tt-publish-split { grid-template-columns: 1fr; }
  .tt-publish-preview-col { order: -1; }
}
.tt-publish-fields { min-width: 0; }
.tt-publish-preview-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.tt-preview-heading {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  width: 100%;
  text-align: center;
}
.tt-preview-frame {
  width: 100%;
  max-width: 280px;
  aspect-ratio: 9 / 16;
  max-height: min(480px, 62vh);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0c1016;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-sizing: border-box;
}
.tt-preview-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
textarea.tt-caption-input {
  min-height: 7rem;
  height: auto;
  resize: vertical;
  font-family: inherit;
  font-size: 0.95rem;
}
.tt-snapshot pre {
  margin: 0.35rem 0 0;
  padding: 0.5rem;
  background: #0c1016;
  border-radius: 6px;
  font-size: 0.85rem;
  white-space: pre-wrap;
}
.toolbar { margin-bottom: 0.75rem; }
.list-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
}
.list-filters label {
  margin-bottom: 0;
  flex: 1 1 10rem;
  min-width: 8rem;
  max-width: 16rem;
}
.list-filters .filter-search {
  flex: 2 1 16rem;
  max-width: 28rem;
}
.list-filters input,
.list-filters select {
  width: 100%;
}
.list-filters .filter-actions {
  display: flex;
  gap: 0.5rem;
  flex: 0 0 auto;
  margin-bottom: 0;
}
.hidden { display: none !important; }
.now-hint { font-size: 0.75rem; margin-top: 0.15rem; }
.progress-wrap { margin: 0.5rem 0; }
.progress-bar {
  height: 8px;
  background: #0c1016;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.3s ease;
}
.activity-log {
  max-height: 280px;
  overflow: auto;
  margin: 0;
  padding: 0.75rem;
  background: #0c1016;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.file-tree { list-style: none; margin: 0; padding-left: 0; }
.file-tree ul { list-style: none; margin: 0.15rem 0 0.15rem 1rem; padding-left: 0; }
.tree-toggle {
  background: transparent;
  color: var(--text);
  padding: 0.15rem 0.35rem;
  font: inherit;
}
.tree-file { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; margin: 0.2rem 0; }
.tree-file .file-del { padding: 0.2rem 0.45rem; font-size: 0.75rem; }
.tree-size { font-size: 0.75rem; min-width: 4rem; }
.tree-dl { font-size: 0.85rem; text-decoration: none; }
.detail-split-card { padding: 1rem; }
.detail-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 900px) {
  .detail-split { grid-template-columns: 1fr; }
}
.split-col { min-width: 0; }
.split-col h3 { margin-top: 0; }
.patch-textarea {
  min-height: 320px;
  height: 320px;
  resize: vertical;
}
.preview-frame {
  width: 100%;
  min-height: 320px;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0c1016;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  box-sizing: border-box;
}
.preview-placeholder { margin: 0; padding: 1rem; text-align: center; }
.job-video {
  width: 100%;
  height: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
}
.scenes-split-card { padding: 1rem; }
.scenes-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 900px) {
  .scenes-split { grid-template-columns: 1fr; }
}
.scenes-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  background: #121a24;
}
.scenes-panel h3 { margin-top: 0; }
.scene-list-scroll {
  flex: 0 1 auto;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}
.scenes-preview-panel .scene-preview-meta {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  flex: 0 0 auto;
}
.scenes-preview-panel {
  overflow: hidden;
  box-sizing: border-box;
}
.scene-preview-frame {
  width: 100%;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0c1016;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  box-sizing: border-box;
}
.scene-preview-video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #000;
}
.scene-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  cursor: pointer;
}
.scene-row:hover { background: #1e2836; }
.scene-row-active {
  background: #243044;
  outline: 1px solid var(--accent);
}
.scene-row .scene-id { pointer-events: none; }

.legal-page { min-height: 100vh; }
.legal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  flex-wrap: wrap;
}
.legal-brand {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}
.legal-brand:hover { color: var(--accent); }
.legal-nav { display: flex; gap: 1rem; }
.legal-nav a {
  color: var(--muted);
  text-decoration: none;
}
.legal-nav a:hover,
.legal-nav a[aria-current="page"] { color: var(--accent); }
.legal-main {
  max-width: 42rem;
  margin: 1.25rem auto 2rem;
  padding: 1.25rem 1.5rem;
}
.legal-main h1 { margin-top: 0; }
.legal-main h2 {
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}
.legal-main h3 {
  margin-top: 1rem;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 600;
}
.legal-main ul { padding-left: 1.25rem; }
.legal-main li { margin-bottom: 0.25rem; }

.ideas-manager .ideas-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.ideas-table { margin-top: 0.5rem; }
.ideas-col-handle { width: 2.25rem; text-align: center; vertical-align: middle; }
.ideas-drag-handle {
  display: inline-block;
  cursor: grab;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  user-select: none;
}
.ideas-drag-disabled { cursor: default; opacity: 0.35; }
.ideas-row-reorderable { cursor: default; }
.ideas-row-reorderable:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.ideas-row-dragging { opacity: 0.45; }
.ideas-row-drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; }
.ideas-row-actions { white-space: nowrap; }
.ideas-col-processed { white-space: nowrap; }
.ideas-processed-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
}
.ideas-row-processed td { color: var(--muted); }
