:root {
  --page: #f4f7fb;
  --shell: #0b1437;
  --shell-2: #121c47;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #e3e8f2;
  --line-strong: #cfd8e8;
  --ink: #172033;
  --muted: #667085;
  --blue: #3264ff;
  --blue-2: #1239c5;
  --green: #168a4a;
  --red: #c0342b;
  --amber: #b76a00;
  --shadow: 0 18px 45px rgba(16, 24, 40, .08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: var(--page);
  color: var(--ink);
  letter-spacing: 0;
  overflow-x: hidden;
}

a {
  color: var(--blue);
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.button-link {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 700;
  font-size: 13px;
}

button:hover,
.button-link:hover {
  border-color: var(--blue);
}

button:disabled {
  cursor: wait;
  opacity: .82;
}

button.is-busy {
  position: relative;
  border-color: var(--blue);
  background: #eef3ff;
  color: var(--blue-2);
}

button.is-busy::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 2px solid rgba(18, 57, 197, .25);
  border-top-color: var(--blue-2);
  border-radius: 999px;
  animation: spin .8s linear infinite;
}

button.is-done {
  border-color: #9bddb5;
  background: #eefaf3;
  color: var(--green);
}

button.is-failed {
  border-color: #f1b5af;
  background: #fff5f4;
  color: var(--red);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

button.primary,
.button-link.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

button.primary.is-busy {
  background: var(--blue-2);
  border-color: var(--blue-2);
  color: #fff;
}

button.primary.is-busy::before {
  border-color: rgba(255, 255, 255, .35);
  border-top-color: #fff;
}

button.primary.is-done,
button.primary.is-failed {
  color: #fff;
}

button.primary.is-done {
  background: var(--green);
  border-color: var(--green);
}

button.primary.is-failed {
  background: var(--red);
  border-color: var(--red);
}

button.good {
  color: var(--green);
}

button.bad {
  color: var(--red);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 11px;
}

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}

input[type=file] {
  padding: 7px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.inline-check input {
  width: auto;
}

.app-shell {
  display: grid;
  grid-template-columns: 288px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--shell), var(--shell-2));
  color: #e8edff;
  padding: 22px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand {
  display: grid;
  gap: 4px;
  padding: 4px 4px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  margin-bottom: 16px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--shell);
  font-weight: 900;
  margin-bottom: 8px;
}

.brand-title {
  font-size: 18px;
  font-weight: 850;
}

.brand-subtitle {
  color: #aab6e8;
  font-size: 12px;
  line-height: 1.4;
}

.nav-group {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.nav-item {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  color: #dfe6ff;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, .04);
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .12);
  color: #fff;
}

.nav-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .12);
  display: grid;
  place-items: center;
  font-size: 13px;
}

.sidebar-note {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .07);
  border-radius: 8px;
  color: #cdd6ff;
  font-size: 12px;
  line-height: 1.45;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 25px;
  line-height: 1.18;
}

h2 {
  font-size: 16px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel {
  padding: 16px;
  margin-bottom: 16px;
}

.head {
  min-height: 45px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-weight: 850;
  font-size: 13px;
  background: #fff;
}

.body {
  padding: 14px;
}

.grid {
  display: grid;
  gap: 10px;
}

.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.analytics-source-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.source-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 12px;
}

.source-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-weight: 850;
}

.source-title small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  text-align: right;
}

.source-stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.activity-strip {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 12px;
  margin-bottom: 16px;
}

.activity-strip.busy {
  border-color: #b8c8ff;
  box-shadow: 0 0 0 3px rgba(50, 100, 255, .10), var(--shadow);
}

.activity-strip.done {
  border-color: #a6dfba;
  box-shadow: 0 0 0 3px rgba(22, 138, 74, .10), var(--shadow);
}

.activity-strip.failed {
  border-color: #efb5af;
  box-shadow: 0 0 0 3px rgba(192, 52, 43, .10), var(--shadow);
}

.activity-now {
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 8px 10px;
  border-right: 1px solid var(--line);
}

.activity-now > div:last-child {
  font-weight: 850;
  line-height: 1.35;
}

.activity-events {
  min-height: 64px;
  max-height: 118px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  color: #344054;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.output-strip {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: center;
  background: #f0fbf4;
  border: 1px solid #bfe8cd;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 12px;
  margin-bottom: 16px;
}

.output-title {
  font-weight: 850;
  line-height: 1.35;
}

.output-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  box-shadow: var(--shadow);
  min-height: 82px;
}

.stat .value {
  font-size: 20px;
  font-weight: 850;
  margin-top: 6px;
}

.project-form {
  display: grid;
  grid-template-columns: 1fr 180px 130px 130px auto;
  gap: 10px;
}

.start-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  margin-bottom: 12px;
}

.start-tab {
  min-height: 34px;
  border-color: transparent;
  background: transparent;
}

.start-tab.active {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--blue-2);
}

.start-form {
  display: none;
}

.start-form.active {
  display: grid;
}

.title-first-form {
  grid-template-columns: 1fr 180px 150px 130px 110px auto;
}

.project-form .wide {
  grid-column: 1 / -1;
}

.project-list {
  display: grid;
  gap: 8px;
}

.project-row {
  display: grid;
  grid-template-columns: 1fr 130px 120px 120px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.project-row:hover {
  border-color: var(--blue);
}

.analytics-project-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.analytics-project-card:hover {
  border-color: var(--blue);
}

.project-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.project-source-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.project-source-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 11px;
  min-width: 0;
}

.project-source-block.youtube {
  border-left: 3px solid var(--red);
}

.project-source-block.internal {
  border-left: 3px solid var(--blue);
}

.project-source-block.extension {
  border-left: 3px solid var(--green);
}

.source-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
}

.project-metric-row {
  display: grid;
  grid-template-columns: minmax(80px, auto) minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  margin-bottom: 5px;
}

.project-metric-row b {
  font-size: 16px;
}

.project-metric-row span {
  color: var(--muted);
  font-size: 12px;
}

.operation-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.operation-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  background: #fff;
  color: #344054;
  font-size: 11px;
  font-weight: 750;
}

.recommendation-board {
  display: grid;
  gap: 12px;
}

.recommendation-empty {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 14px;
  font-size: 13px;
}

.recommendation-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.recommendation-section h3 {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.3;
}

.recommendation-section p {
  margin: 0 0 10px;
  color: #344054;
  font-size: 13px;
  line-height: 1.5;
}

.recommendation-section p:last-child,
.recommendation-list:last-child {
  margin-bottom: 0;
}

.recommendation-list {
  margin: 0 0 8px;
  padding-left: 18px;
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 13px;
  line-height: 1.45;
}

.recommendation-list strong,
.recommendation-section p strong {
  color: var(--ink);
}

.recommendation-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.recommendation-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  font-size: 12px;
}

.recommendation-table th,
.recommendation-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
}

.recommendation-table th {
  background: var(--panel-soft);
  color: var(--ink);
  font-weight: 850;
}

.recommendation-table tr:last-child td {
  border-bottom: 0;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  background: #fff;
  font-size: 11px;
  font-weight: 800;
}

.badge.blue {
  color: var(--blue-2);
  background: #eef3ff;
  border-color: #cfdbff;
}

.badge.green {
  color: var(--green);
  background: #eefaf3;
  border-color: #ccefd9;
}

.badge.amber {
  color: var(--amber);
  background: #fff7e8;
  border-color: #ffe2ad;
}

.badge.red {
  color: var(--red);
  background: #fff5f4;
  border-color: #f1b5af;
}

.badge.neutral {
  color: var(--muted);
  background: #eef1f6;
  border-color: var(--line-strong);
}

.project-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.rail {
  display: grid;
  gap: 12px;
}

.work-zone {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.work-tabbar {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  box-shadow: var(--shadow);
}

.work-tab {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.work-tab.is-active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.work-panels {
  display: grid;
  gap: 12px;
}

.work-panel {
  display: none;
  min-width: 0;
}

.work-panel.is-active {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.stage {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 9px;
  padding: 9px 10px;
  border-bottom: 1px solid #edf1f7;
}

.dot {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--muted);
  font-weight: 850;
}

.active .dot {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.done .dot {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.chat {
  display: grid;
  gap: 9px;
}

.msg {
  padding: 10px 11px;
  border-radius: 8px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.45;
}

.msg.user {
  background: #eef3ff;
  border-color: #d7e1ff;
}

.msg.sys {
  background: #fff;
}

.flow-card {
  border: 1px solid #cfdcff;
  background: #f7f9ff;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 12px;
}

.flow-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid #d7e1ff;
  border-radius: 8px;
  background: #fff;
}

.flow-step {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 11px;
  border: 1px solid #d7e1ff;
  border-radius: 8px;
  background: #fff;
}

.flow-step-num {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 850;
}

.flow-step-main {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.flow-step-title {
  font-weight: 850;
  color: var(--ink);
}

.flow-finish {
  border-color: #cbe4d3;
  background: #f8fdf9;
}

.flow-fallbacks {
  border: 1px dashed #b8c8ff;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.flow-fallbacks summary {
  min-height: 42px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 850;
  color: var(--blue-2);
  list-style-position: inside;
}

.flow-fallbacks[open] summary {
  border-bottom: 1px solid var(--line);
}

.flow-fallback-body {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.flow-mini-section {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.zip-helper {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px dashed #b8c8ff;
  border-radius: 8px;
  background: #fff;
}

.zip-helper textarea {
  min-height: 58px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.flow-organizer {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid #cbe4d3;
  border-radius: 8px;
  background: #f5fbf7;
}

.revision-box {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d8e2f3;
  border-radius: 8px;
  background: #f8fafc;
}

.revision-box textarea {
  min-height: 88px;
}

.script-review,
.narration-repair {
  display: grid;
  gap: 10px;
  border: 1px solid #d8e2f3;
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.script-review-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.script-review-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.script-review-flag {
  min-height: 0;
  padding: 5px 8px;
  font-size: 12px;
  border-color: #e6bf57;
  background: #fff8df;
  color: #7b5800;
}

.script-review-reader {
  columns: 2 360px;
  column-gap: 28px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.script-review-sentence.attention {
  background: #fff1bc;
  box-shadow: 0 0 0 2px #fff1bc;
}

.script-editor-details,
.narration-repair,
.script-history {
  border: 1px solid #d8e2f3;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.script-editor-details summary,
.narration-repair summary,
.script-history summary,
.script-version-full summary {
  cursor: pointer;
  color: var(--blue-2);
  font-weight: 800;
}

.script-editor-details[open],
.narration-repair[open],
.script-history[open] {
  display: grid;
  gap: 10px;
}

.script-editor {
  min-height: 62vh;
}

.narration-repair-list {
  display: grid;
  gap: 10px;
}

.narration-repair-item {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid #e0e7f1;
  border-radius: 8px;
  background: #f8fafc;
}

.narration-repair-item textarea {
  min-height: 84px;
}

.script-version-list {
  display: grid;
  gap: 10px;
}

.script-version-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #e0e7f1;
  border-radius: 8px;
  background: #f8fafc;
}

.script-version-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.script-version-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.script-version-instruction {
  padding: 8px;
  border-left: 3px solid var(--blue);
  background: #eef3ff;
  color: #243250;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.script-version-preview {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.script-version-full textarea {
  min-height: 320px;
  margin-top: 8px;
  background: #fff;
}

@media (max-width: 800px) {
  .script-review-reader {
    columns: 1;
  }

  .script-editor {
    min-height: 50vh;
  }

  .script-version-head {
    display: grid;
  }

  .script-version-actions {
    justify-content: stretch;
  }

  .script-version-actions button {
    flex: 1 1 150px;
  }
}

.gate {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid #edf1f7;
  padding: 10px;
}

.gate:last-child {
  border-bottom: 0;
}

.gate.approved {
  background: #f0fbf4;
}

.gate.needs_work {
  background: #fff5f4;
}

.check {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 8px;
  font-size: 12px;
  padding: 6px 0;
}

.ok {
  color: var(--green);
  font-weight: 900;
}

.warn {
  color: var(--red);
  font-weight: 900;
}

.ideas {
  display: grid;
  gap: 8px;
}

.idea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  background: #fff;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.links a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  color: var(--blue);
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  background: white;
}

.links .button-link {
  min-height: 0;
  padding: 7px 9px;
}

.zip-picker {
  display: grid;
  gap: 7px;
}

.zip-picker-trigger {
  width: 100%;
}

.zip-picker input[type=file] {
  display: none;
}

.zip-file-name {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 34px;
  padding: 8px 10px;
  font-size: 12px;
  display: flex;
  align-items: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
}

.timeline-wrapper {
  display: grid;
  gap: 10px;
}

.timeline-pager {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.timeline-pager__summary {
  font-size: 12px;
}

.timeline-pager__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.timeline-pager select {
  min-height: 34px;
  width: auto;
  max-width: 110px;
}

.tl {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  cursor: default;
}

.tl.drop {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(50, 100, 255, .16);
}

.tl.is-selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(50, 100, 255, .12);
}

.tl.dragging {
  opacity: 0.6;
}

.tlImageDragSet {
  cursor: grab;
}

.tlImageDragSet:active {
  cursor: grabbing;
}

.tlImageDragSet textarea {
  cursor: text;
}

.tl img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #fff;
  display: block;
}

.empty-frame {
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  background: #f3f6fb;
}

.tlBody {
  padding: 10px;
  font-size: 12px;
  display: grid;
  gap: 7px;
}

.tlCardHead {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
}

.animated-review-help {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fd;
  margin-bottom: 10px;
}

.animated-step-guide {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.animated-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 8px;
  align-items: start;
  min-height: 56px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
}

.animated-step.is-done {
  background: #f0fbf4;
  border-color: #b8e7c9;
}

.animated-repair-workflow {
  display: grid;
  gap: 8px;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid #93c5fd;
  border-radius: 10px;
  background: #eff6ff;
}

.animated-advanced-controls {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.animated-advanced-controls summary,
.animated-optional-image summary {
  cursor: pointer;
  font-weight: 800;
}

.animated-clip-preview video {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  background: #0f172a;
  object-fit: contain;
}

.animated-optional-image {
  padding: 9px 10px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

.animated-optional-image-body {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.compact-head {
  margin-top: 12px;
  padding: 0 0 8px;
  border: 0;
}

.animated-scene-card .empty-frame {
  padding: 12px;
  text-align: center;
}

.clip-editor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.clip-editor-grid input {
  margin-top: 4px;
}

.editor-workspace {
  display: grid;
  gap: 12px;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.editor-transport {
  display: grid;
  grid-template-columns: auto minmax(150px, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #1f2937;
  color: #f8fafc;
}

.editor-transport-buttons,
.editor-edit-buttons,
.editor-zoom {
  display: flex;
  gap: 6px;
  align-items: center;
}

.editor-transport button {
  min-height: 34px;
  border-color: #475569;
  background: #374151;
  color: #f8fafc;
}

.editor-transport button.primary {
  background: var(--blue);
  border-color: var(--blue);
}

.editor-timecode {
  justify-self: center;
  min-width: 180px;
  padding: 7px 10px;
  border: 1px solid #020617;
  border-radius: 6px;
  background: #0f172a;
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: center;
}

.editor-zoom input {
  width: 120px;
  accent-color: var(--blue);
}

.editor-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.editor-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 9px 10px;
  display: grid;
  gap: 3px;
}

.editor-stat span {
  color: var(--muted);
  font-size: 12px;
}

.editor-stat b {
  font-size: 18px;
}

.editor-main {
  display: grid;
  grid-template-columns: minmax(220px, .55fr) minmax(320px, 1fr) minmax(300px, .85fr);
  gap: 12px;
  align-items: start;
}

.editor-media-bin,
.editor-preview-panel,
.editor-inspector {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.editor-media-bin {
  max-height: 520px;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  gap: 10px;
}

.editor-bin-head,
.editor-bin-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.editor-bin-head b {
  font-size: 14px;
}

.editor-bin-head span,
.editor-bin-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.editor-bin-audio,
.editor-bin-item {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.editor-bin-audio {
  padding: 8px;
  display: grid;
  gap: 6px;
}

.editor-bin-audio span,
.editor-bin-audio b {
  display: block;
}

.editor-bin-audio .editor-waveform {
  height: 34px;
  border-radius: 6px;
  background: #0f172a;
  overflow: hidden;
}

.editor-bin-section {
  display: grid;
  gap: 7px;
}

.editor-bin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.editor-bin-item {
  padding: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 28px;
}

.editor-bin-item.is-selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(50, 100, 255, .14);
}

.editor-bin-item img,
.editor-bin-item .editor-clip-empty {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: #e5e7eb;
}

.editor-bin-item span {
  min-width: 0;
  padding: 6px;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-preview {
  background: #0f172a;
}

.editor-preview img,
.editor-preview video {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  display: block;
  background: #0f172a;
}

.editor-preview-panel audio {
  width: 100%;
  display: block;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

.editor-inspector {
  padding: 10px;
  display: grid;
  gap: 8px;
}

.editor-upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.editor-inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-sequencer {
  display: grid;
  gap: 8px;
  overflow-x: auto;
  padding: 10px;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #1f2937;
  min-height: 270px;
}

.editor-track-row {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  border: 1px solid #334155;
  border-radius: 6px;
  overflow: hidden;
  background: #111827;
}

.editor-track-label {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e5e7eb;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  background: #374151;
  border-right: 1px solid #334155;
}

.editor-track-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  border: 0;
  border-radius: 0;
  background: #0f172a;
}

.editor-track-surface {
  position: relative;
  height: 78px;
  cursor: pointer;
}

.editor-track-surface.drop {
  outline: 2px dashed #38bdf8;
  outline-offset: -6px;
  background: #13233a;
}

.editor-ruler-row .editor-track-scroll {
  border-color: #334155;
  background: #374151;
}

.editor-ruler-surface {
  height: 30px;
  background: repeating-linear-gradient(90deg, #475569 0 1px, transparent 1px 40px);
}

.editor-ruler-surface span {
  position: absolute;
  top: 5px;
  transform: translateX(-50%);
  color: #e5e7eb;
  font-size: 11px;
}

.editor-voice-surface {
  height: 76px;
}

.editor-voice-bar {
  position: absolute;
  top: 9px;
  bottom: 9px;
  border-radius: 6px;
  overflow: hidden;
  background: #111827;
  border: 1px solid #14b8a6;
}

.editor-voice-bar .editor-waveform {
  height: 100%;
}

.editor-voice-bar span {
  position: absolute;
  right: 10px;
  bottom: 6px;
  color: #e5e7eb;
  font-size: 11px;
  font-weight: 700;
}

.editor-voice-segment {
  position: absolute;
  top: 11px;
  bottom: 11px;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-width: 40px;
  padding: 0 7px;
  border: 1px solid rgba(148, 163, 184, .74);
  border-radius: 5px;
  background: rgba(15, 23, 42, .52);
  color: #f8fafc;
  cursor: pointer;
  overflow: hidden;
}

.editor-voice-segment .editor-waveform {
  height: 100%;
  min-width: 0;
  opacity: .78;
}

.editor-voice-segment span {
  font-size: 10px;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(15, 23, 42, .55);
}

.editor-voice-segment.is-selected {
  border-color: var(--blue);
  background: rgba(37, 99, 235, .36);
  box-shadow: 0 0 0 2px rgba(96, 165, 250, .28);
}

.editor-track-block {
  position: absolute;
  top: 8px;
  bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
  cursor: grab;
  display: grid;
  grid-template-columns: 22px minmax(38px, 72px) minmax(0, 1fr) 22px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .08);
}

.editor-track-block:focus,
.editor-track-block.is-selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(50, 100, 255, .16);
}

.editor-track-block.drop {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .18);
}

.editor-track-block.is-flagged {
  border-color: #f59e0b;
}

.editor-track-video {
  background: #f8fafc;
}

.editor-track-handle {
  width: 22px;
  min-width: 22px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: repeating-linear-gradient(90deg, #64748b 0 2px, #cbd5e1 2px 5px);
  cursor: ew-resize;
  opacity: .86;
}

.editor-track-block.is-selected .editor-track-handle,
.editor-track-block:hover .editor-track-handle,
.editor-track-handle:hover {
  background: var(--blue);
  opacity: 1;
}

.editor-track-media {
  background: #e5e7eb;
}

.editor-track-media img,
.editor-track-media .editor-clip-empty {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.editor-track-copy {
  min-width: 0;
  padding: 8px 7px;
  display: grid;
  gap: 3px;
  align-content: center;
}

.editor-track-copy b,
.editor-track-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-track-copy b {
  font-size: 12px;
}

.editor-track-copy span {
  color: var(--muted);
  font-size: 11px;
}

.editor-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 18px;
  transform: translateX(-50%);
  z-index: 12;
  pointer-events: auto;
  cursor: ew-resize;
  touch-action: none;
  filter: drop-shadow(0 0 3px rgba(50, 100, 255, .38));
}

.editor-playhead::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--blue);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .25);
}

.editor-playhead::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  border-left: 2px solid var(--blue);
}

.editor-playhead span {
  position: absolute;
  top: 1px;
  left: calc(50% + 8px);
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
}

.editor-track-surface:not(.editor-ruler-surface) .editor-playhead span {
  display: none;
}

body.editor-scrubbing,
body.editor-scrubbing *,
body.editor-resizing,
body.editor-resizing * {
  cursor: ew-resize !important;
  user-select: none;
}

.editor-clip {
  flex: 1 0 var(--basis, 12%);
  min-width: 126px;
  max-width: 230px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: grid;
  grid-template-rows: auto 30px 9px auto;
  overflow: hidden;
  cursor: grab;
}

.editor-clip:focus,
.editor-clip.is-selected {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(50, 100, 255, .16);
}

.editor-clip.drop {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .18);
}

.editor-clip.is-flagged {
  border-color: #f59e0b;
}

.editor-clip.has-video .editor-clip-meta b::after {
  content: " clip";
  color: var(--blue);
  font-weight: 700;
}

.editor-clip-media {
  aspect-ratio: 16 / 9;
  background: #e5e7eb;
}

.editor-clip-media img,
.editor-clip-empty {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.editor-waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 6px;
  background: #111827;
}

.editor-waveform span {
  width: 3px;
  height: var(--bar, 40%);
  min-height: 4px;
  border-radius: 3px;
  background: #93c5fd;
  flex: 1;
}

.editor-trim-mini {
  position: relative;
  background: #d1d5db;
}

.editor-trim-mini span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--trim-left, 0%);
  right: var(--trim-right, 0%);
  background: #22c55e;
}

.editor-clip-meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 8px;
  font-size: 12px;
  align-items: center;
}

.editor-clip-meta span {
  color: var(--muted);
  overflow-wrap: anywhere;
  text-align: right;
}

.editor-trim-control {
  display: grid;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.editor-trim-readout {
  color: var(--muted);
  font-size: 12px;
}

.editor-trim-track {
  position: relative;
  height: 34px;
  border-radius: 8px;
  background: #e5e7eb;
  overflow: hidden;
}

.editor-trim-window {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(34, 197, 94, .34);
  border-left: 3px solid #16a34a;
  border-right: 3px solid #16a34a;
}

.editor-trim-range {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}

.editor-trim-range::-webkit-slider-thumb {
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 34px;
  border: 2px solid #0f172a;
  border-radius: 6px;
  background: #fff;
  cursor: ew-resize;
}

.editor-trim-range::-moz-range-thumb {
  pointer-events: auto;
  width: 18px;
  height: 30px;
  border: 2px solid #0f172a;
  border-radius: 6px;
  background: #fff;
  cursor: ew-resize;
}

.drag-help {
  padding: 7px 9px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
  font-size: 12px;
}

.caption {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.log {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  background: #0f1720;
  color: #e8edf5;
  border-radius: 8px;
  padding: 11px;
  max-height: 290px;
  overflow: auto;
}

video {
  width: 100%;
  max-height: 460px;
  background: #000;
  border-radius: 8px;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #f5f7fc, #eef3fb);
}

.auth-card {
  width: min(430px, 92vw);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 16px;
}

.auth-card .brand-mark {
  margin: 0;
}

.auth-card h1 {
  font-size: 24px;
}

.auth-footer {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-group {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }

  .project-layout {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
  }

  .source-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .project-source-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  button,
  .button-link,
  input,
  select {
    min-height: 44px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .workspace {
    padding: 10px;
  }

  .source-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .source-title {
    display: grid;
  }

  .source-title small {
    text-align: left;
  }

  .project-card-head {
    grid-template-columns: 1fr;
  }

  .sidebar {
    padding: 10px;
    position: sticky;
    top: 0;
    z-index: 30;
  }

  .sidebar-note {
    display: none;
  }

  .brand {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px 10px;
    padding: 0 2px 10px;
    margin-bottom: 10px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    margin-bottom: 0;
  }

  .brand-title {
    font-size: 16px;
  }

  .brand-subtitle {
    grid-column: 1 / -1;
    font-size: 11px;
  }

  .nav-group {
    display: flex;
    gap: 8px;
    margin: 10px -4px 0;
    overflow-x: auto;
    padding: 0 4px 4px;
    scrollbar-width: none;
  }

  .nav-group::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    grid-template-columns: auto auto;
    flex: 0 0 auto;
    min-height: 40px;
    padding: 7px 10px;
    white-space: nowrap;
  }

  h1 {
    font-size: 20px;
    overflow-wrap: anywhere;
  }

  .topbar,
  .activity-strip,
  .output-strip,
  .project-form,
  .title-first-form,
  .project-row,
  .two,
  .three,
  .four,
  .stat-grid,
  .nav-group {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .stat {
    min-height: 70px;
  }

  .project-layout,
  .work-zone,
  .work-panel.is-active,
  .card,
  .panel,
  .flow-card,
  .flow-organizer,
  .zip-helper,
  .timeline,
  .tl {
    min-width: 0;
  }

  .card,
  .panel,
  .stat,
  .activity-strip,
  .output-strip {
    border-radius: 12px;
  }

  .activity-now {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .activity-events {
    max-height: 96px;
  }

  .output-actions {
    justify-content: stretch;
  }

  .output-actions > * {
    width: 100%;
  }

  .work-tabbar {
    padding: 7px 6px;
  }

  .work-tab {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
  }

  .head {
    align-items: flex-start;
  }

  .zip-file-name,
  .links,
  .output-actions,
  .timeline-pager__summary,
  .caption,
  .msg {
    overflow-wrap: anywhere;
  }

  .timeline-pager {
    justify-content: center;
  }

  .timeline-pager__actions {
    width: 100%;
    justify-content: stretch;
  }

  .timeline-pager__actions button,
  .timeline-pager__actions select {
    flex: 1;
    min-width: 0;
  }

  .timeline-pager select {
    max-width: none;
  }

  .clip-editor-grid {
    grid-template-columns: 1fr;
  }

  .editor-main {
    grid-template-columns: 1fr;
  }

  .editor-media-bin {
    max-height: 300px;
  }

  .editor-bin-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .editor-toolbar button {
    flex: 1 1 calc(50% - 8px);
  }

  .editor-transport {
    grid-template-columns: 1fr;
  }

  .editor-transport-buttons,
  .editor-edit-buttons,
  .editor-zoom {
    justify-content: stretch;
  }

  .editor-transport button {
    flex: 1;
  }

  .editor-timecode {
    justify-self: stretch;
  }

  .editor-zoom input {
    flex: 1;
    width: auto;
  }

  .editor-sequencer {
    min-height: 210px;
  }

  .editor-track-row {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .editor-track-label {
    font-size: 11px;
  }

  .editor-track-block {
    grid-template-columns: 16px 42px minmax(0, 1fr) 16px;
  }

  .editor-track-handle {
    width: 16px;
    min-width: 16px;
  }

  .auth-page {
    padding: 12px;
  }

  .auth-card {
    width: 100%;
    max-width: none;
    padding: 16px;
  }
}

@media (max-width: 560px) {
  .timeline {
    grid-template-columns: 1fr;
  }

  .editor-bin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .body {
    padding: 11px;
  }

  .source-stat-grid {
    grid-template-columns: 1fr;
  }

  .work-tab {
    flex: 1 1 100%;
  }

  .grid,
  .flow-card,
  .flow-intro,
  .flow-step-main,
  .flow-fallback-body,
  .flow-mini-section,
  .flow-organizer,
  .zip-helper,
  .chat,
  .tlBody {
    gap: 8px;
  }

  .flow-intro {
    display: grid;
  }

  .flow-step {
    grid-template-columns: 26px 1fr;
    gap: 8px;
    padding: 9px;
  }

  .flow-step-num {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  .tlBody {
    padding: 9px;
  }
}

/* ---------- Enterprise UI revamp ---------- */

.shorts-modes {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  box-shadow: var(--shadow);
}

.shorts-mode {
  flex: 1 1 220px;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  padding: 8px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.shorts-mode:hover:not(:disabled) {
  border-color: var(--blue);
}

.shorts-mode.is-active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.shorts-mode:disabled {
  cursor: not-allowed;
  opacity: .7;
}

.shorts-mode-panel {
  display: none;
}

.shorts-mode-panel.is-active {
  display: grid;
  gap: 12px;
}

.danger-zone {
  border: 1px dashed #f1b5af;
  border-radius: 8px;
  background: #fff5f4;
  overflow: hidden;
}

.danger-zone > summary {
  min-height: 42px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 850;
  color: var(--red);
  list-style-position: inside;
}

.danger-zone[open] > summary {
  border-bottom: 1px solid var(--line);
}

.danger-zone > .card {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

button.bad {
  color: var(--red);
  border-color: #f1b5af;
  background: #fff5f4;
}

button.bad:hover {
  border-color: var(--red);
}

.timeline-toolbar {
  display: grid;
  gap: 10px;
  margin-bottom: 4px;
}

.timeline-toolbar input[type=search] {
  width: 100%;
}

.timeline-selection-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.timeline-selection-tools button {
  min-height: 34px;
}

/* Desktop-only step notice (Google Flow handoff). Hidden on desktop,
   shown on mobile so users know to use the paid API image path instead. */
.mobile-desktop-notice {
  display: none;
}

/* V12 stage progress strip */
#stages {
  display: grid;
  gap: 0;
}

.stage .dot {
  transition: none;
}

.stage.active {
  background: #eef3ff;
}

/* Shorts Studio scene grid (vertical 9:16 thumbnails) */
.short-scenes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}

.short-scene {
  display: grid;
  gap: 6px;
  font-size: 11px;
}

.short-scene textarea {
  min-height: 48px;
  font-size: 10px;
  line-height: 1.3;
}

/* ---------- Mobile responsive (multi-user ready) ----------
   Layered on top of the breakpoints above. Later rules of equal
   specificity win, so this refines the new revamp elements and fixes
   touch targets without re-touching the working base.            */

@media (max-width: 800px) {
  /* Compact sticky app bar: keep the dark sidebar slim, hide the long subtitle. */
  .sidebar {
    padding: 8px 10px;
  }

  .brand {
    padding: 0 0 8px;
    margin-bottom: 6px;
  }

  .brand-subtitle {
    display: none;
  }

  .nav-group {
    margin-top: 0;
  }

  .nav-item {
    min-height: 44px;
    padding: 8px 12px;
  }

  /* Work tabs: horizontal scroll strip (not 6 stacked blocks). */
  .work-tabbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 6px;
  }

  .work-tabbar::-webkit-scrollbar {
    display: none;
  }

  .work-tab {
    flex: 0 0 auto;
    min-height: 44px;
    white-space: nowrap;
    padding: 8px 14px;
  }

  /* Stat grid: 2x2 instead of 4 stacked rows. */
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Shorts Studio modes stack vertically on phones. */
  .shorts-modes {
    flex-direction: column;
    padding: 8px;
  }

  /* Show the desktop-only notice on mobile so Flow handoff is clearly
     marked as not mobile-doable, and point users to the paid API card. */
  .mobile-desktop-notice {
    display: block;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid #ffe2ad;
    background: #fff7e8;
    color: var(--amber);
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.45;
  }

  .shorts-mode {
    flex: 1 1 auto;
    min-height: 48px;
  }

  /* Timeline toolbar: search sits above the pager, both full width. */
  .timeline-toolbar {
    gap: 8px;
  }

  /* Output actions wrap full width so nothing overlaps the title. */
  .output-actions > * {
    width: 100%;
  }

  /* Topbar: stack title above the back link cleanly. */
  .topbar {
    align-items: flex-start;
  }

  /* Flow handoff steps tighten up. */
  .flow-step {
    padding: 9px;
  }

  .flow-intro {
    flex-direction: column;
    align-items: flex-start;
  }

  /* Gates and ideas: single column, actions below. */
  .gate {
    grid-template-columns: 1fr;
  }

  .idea {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  /* Keep work tabs as a horizontal scroll strip (override the base 100% stack). */
  .work-tab {
    flex: 0 0 auto;
    min-height: 44px;
  }

  .stat {
    min-height: 60px;
    padding: 10px;
  }

  .stat .value {
    font-size: 17px;
  }

  h1 {
    font-size: 18px;
  }

  .head {
    min-height: 40px;
    padding: 10px 11px;
    font-size: 12px;
  }

  .body {
    padding: 10px;
  }

  .chat .msg {
    font-size: 12px;
  }

  /* Buttons get full 44px touch targets and wider padding. */
  button,
  .button-link {
    min-height: 44px;
    padding: 10px 12px;
  }

  .shorts-mode {
    min-height: 48px;
  }

  /* Timeline cards already go 1-col here; keep image ratio stable. */
  .tl img,
  .empty-frame {
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 380px) {
  /* Very small phones: stats collapse to one column, tabs scroll. */
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 8px;
  }

  .card,
  .panel,
  .stat,
  .activity-strip,
  .output-strip {
    border-radius: 10px;
  }
}
