:root {
  color-scheme: light;
  --bg: #f3f7fb;
  --panel: #ffffff;
  --ink: #121826;
  --muted: #6b7787;
  --line: #dbe7f4;
  --accent: #7637ff;
  --accent-2: #00c8ff;
  --accent-3: #e02cff;
  --warn: #f5a623;
  --shadow: 0 14px 34px rgba(23, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, rgba(0, 200, 255, 0.16), transparent 34%),
    radial-gradient(circle at 85% 8%, rgba(224, 44, 255, 0.13), transparent 32%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

.hidden {
  display: none !important;
}

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

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.app-locked {
  display: none;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(3, 4, 10, 0.92), rgba(17, 18, 54, 0.86)),
    url("/assets/cinem-ai-logo.png") center / min(92vw, 980px) auto no-repeat,
    #020611;
}

.auth-card {
  width: min(100%, 520px);
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid rgba(110, 245, 255, 0.28);
  border-radius: 8px;
  background: rgba(5, 10, 20, 0.86);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  color: #fff;
}

.auth-logo {
  width: min(100%, 320px);
  height: 92px;
  object-fit: contain;
  justify-self: center;
  border-radius: 8px;
}

.auth-copy {
  color: #cbd5e1;
  line-height: 1.55;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.auth-tabs button {
  border: 1px solid rgba(110, 245, 255, 0.2);
  border-radius: 8px;
  padding: 10px;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.auth-tabs button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form .field span,
.auth-card .step-title span,
.auth-card .step-title h1 {
  color: #fff;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.sidebar {
  background: linear-gradient(180deg, #03040a 0%, #111827 55%, #161236 100%);
  color: #fff;
  padding: 22px 16px;
}

.brand {
  display: block;
  margin-bottom: 28px;
}

.brand-logo {
  width: 100%;
  max-width: 194px;
  height: 64px;
  border-radius: 8px;
  object-fit: contain;
  background: #000;
  box-shadow: 0 0 22px rgba(0, 200, 255, 0.42), 0 0 28px rgba(224, 44, 255, 0.22);
}

nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  text-align: left;
  color: #cbd5e1;
  background: transparent;
  cursor: pointer;
}

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

main {
  padding: 26px;
  overflow: auto;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

.topbar p {
  margin-top: 7px;
  color: #506174;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: max-content;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.inline-switch {
  align-self: end;
  margin-bottom: 14px;
  box-shadow: none;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

.panel,
.status-panel,
.result-summary {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.step-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.step-title span {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.step-title h2 {
  font-size: 18px;
}

.niche-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(94px, 1fr));
  gap: 10px;
}

.niche {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 10px;
  background: #f8fafc;
  cursor: pointer;
  text-align: center;
  font-weight: 700;
}

.niche.active {
  border-color: var(--accent);
  color: var(--accent);
  background: #f3f0ff;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field span {
  color: #334155;
  font-weight: 700;
  font-size: 14px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
  outline: none;
}

.field textarea {
  resize: vertical;
  line-height: 1.55;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(111, 63, 245, 0.12);
}

.controls-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
  align-items: end;
  gap: 14px;
}

.advanced-row {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  margin-bottom: 14px;
}

.field.small {
  width: 100%;
}

.estimate {
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--muted);
  background: #f8fafc;
}

.primary,
.secondary {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 800;
  cursor: pointer;
}

.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent), var(--accent-3));
  box-shadow: 0 12px 26px rgba(118, 55, 255, 0.24);
}

.primary:disabled {
  cursor: not-allowed;
  background: #a9a5b8;
}

.secondary {
  color: var(--accent);
  background: #f1f7ff;
}

.button-row,
.result-toolbar,
.card-actions,
.tabs,
.asset-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.key-status {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.key-status div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  color: var(--muted);
}

.key-status .ok {
  color: #057a5f;
  border-color: rgba(10, 163, 127, 0.28);
  background: rgba(10, 163, 127, 0.09);
}

.key-status .bad {
  color: #9b1c1c;
  border-color: rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.08);
}

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

.quota-panel,
.license-panel {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
}

.quota-panel strong,
.license-panel strong {
  color: var(--ink);
}

.setup-guide {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px 16px;
}

.setup-guide > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  color: var(--ink);
  font-size: 14px;
}

.setup-guide > summary::-webkit-details-marker { display: none; }

.setup-guide > summary small {
  font-weight: 400;
  color: var(--muted);
  font-size: 12px;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.setup-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #f8fafc;
  font-size: 13px;
}

.setup-card[open] {
  background: #fff;
}

.setup-card > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--ink);
}

.setup-card > summary::-webkit-details-marker { display: none; }

.setup-card > summary strong {
  font-size: 13px;
  font-weight: 600;
}

.setup-card > summary span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.setup-card ol {
  margin: 10px 0 8px;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.setup-card ol li + li {
  margin-top: 4px;
}

.setup-card a {
  color: var(--accent, #2563eb);
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}

.setup-card a:hover { border-bottom-style: solid; }

.setup-card code {
  background: #eef2f7;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--ink);
}

.setup-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
  color: var(--accent, #2563eb);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-button:hover { opacity: 0.85; }

.voice-picker {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 6px;
}

.voice-picker select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  font-size: 13px;
  color: var(--ink);
}

.voice-picker button {
  white-space: nowrap;
}

.panel-intro {
  color: var(--muted);
  font-size: 13px;
  margin: -4px 0 14px;
  line-height: 1.55;
}

.extension-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.extension-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.extension-card.premium {
  border-color: #c7d2fe;
  background: linear-gradient(180deg, #ffffff 0%, #f5f3ff 100%);
}

.extension-card.locked {
  opacity: 0.92;
}

.extension-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.extension-card header strong {
  font-size: 15px;
  color: var(--ink);
}

.ext-tag {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
  background: #eef2f7;
  color: var(--muted);
}

.extension-card.premium .ext-tag {
  background: #ede9fe;
  color: #6d28d9;
}

.ext-desc {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.ext-bullets {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  font-size: 12.5px;
  line-height: 1.7;
}

.ext-note {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
  font-style: italic;
}

.ext-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 6px;
}

.ext-actions a.primary,
.ext-actions button.primary {
  text-align: center;
  text-decoration: none;
  display: inline-block;
  padding: 9px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  background: var(--accent, #2563eb);
  color: #fff;
  border: none;
}

.ext-actions a.primary:hover,
.ext-actions button.primary:hover {
  filter: brightness(0.96);
}

.extension-card.locked .ext-actions button.primary {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
}

.ext-install,
.ext-lock {
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
}

.ext-lock {
  color: #6d28d9;
}

.extension-card.coming-soon,
.extension-card.soon {
  border-color: #fde68a;
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
}

.extension-card.coming-soon .ext-tag,
.extension-card.soon .ext-tag {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fbbf24;
}

.extension-card.soon .ext-actions button[disabled] {
  background: #94a3b8;
  cursor: not-allowed;
  opacity: 0.85;
}

.ext-coming {
  color: #b45309;
  font-weight: 500;
}

.ext-sessions-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 12px;
}

.ext-sessions-table th,
.ext-sessions-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.ext-sessions-table thead th {
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.ext-sessions-table button.secondary {
  padding: 4px 10px;
  font-size: 12px;
}

.founding-queue-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 12.5px;
}

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

.founding-queue-table thead th {
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.founding-queue-table small { color: var(--muted); font-size: 11.5px; }

.founding-queue-table .founding-note {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 12px;
}

.founding-queue-table .badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.founding-queue-table .badge-green { background: rgba(16,185,129,0.15); color: #065f46; }
.founding-queue-table .badge-amber { background: rgba(245,158,11,0.18); color: #92400e; }
.founding-queue-table .badge-red   { background: rgba(220,38,38,0.18); color: #7f1d1d; }

.founding-queue-table button {
  padding: 4px 10px;
  font-size: 12px;
  margin-right: 4px;
}

.founding-widget {
  border-left: 4px solid #fbbf24;
  background: linear-gradient(135deg, rgba(251,191,36,0.08), rgba(124,58,237,0.06));
  margin-bottom: 12px;
}

.founding-widget.active {
  border-left-color: #10b981;
  background: linear-gradient(135deg, rgba(16,185,129,0.08), rgba(0,240,255,0.05));
}

.founding-widget.rejected {
  border-left-color: #dc2626;
  background: rgba(220,38,38,0.08);
}

.founding-widget strong { color: var(--ink); }
.founding-widget span { display: block; margin-top: 4px; font-size: 13px; }

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

.quota-row {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 10px;
  align-items: center;
}

.quota-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.quota-meter span {
  display: block;
  height: 100%;
  background: var(--accent-2);
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.status-panel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.status-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  background: #f8fafc;
  font-weight: 700;
  text-align: center;
}

.status-step.done {
  color: #057a5f;
  border-color: rgba(10, 163, 127, 0.28);
  background: rgba(10, 163, 127, 0.09);
}

.status-step.active {
  color: #7a4b00;
  border-color: rgba(245, 166, 35, 0.34);
  background: rgba(245, 166, 35, 0.11);
}

.result-summary {
  display: flex;
  align-items: center;
  gap: 12px;
}

.result-summary span {
  color: var(--muted);
  flex: 1;
}

.result-toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.result-toolbar input {
  flex: 1;
  min-width: 250px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.tab {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.tab.active {
  border-color: var(--accent);
  color: var(--accent);
  background: #f3f0ff;
}

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

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

.video-wrap {
  aspect-ratio: 16 / 9;
  background: #0f172a;
}

.video-wrap video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.video-wrap img {
  width: 100%;
  height: 100%;
  display: none;
  object-fit: cover;
}

.result-card.image-card video,
.result-card.prompt-card video {
  display: none;
}

.result-card.image-card img,
.result-card.prompt-card img {
  display: block;
}

.result-body {
  padding: 14px;
}

.result-head,
.keywords {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.clip-number,
.provider,
.timeline,
.rating,
.keywords span {
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

.clip-number {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
}

.provider,
.timeline,
.rating,
.keywords span {
  color: #475569;
  background: #eef2f7;
}

.rating.good {
  color: #057a5f;
  background: rgba(10, 163, 127, 0.11);
}

.rating.bad {
  color: #9b1c1c;
  background: rgba(239, 68, 68, 0.1);
}

.result-card h3 {
  margin-top: 10px;
  font-size: 15px;
}

.result-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.keywords {
  margin-top: 12px;
}

.asset-stack {
  margin-top: 12px;
}

.select-asset {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.asset-stack a {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.asset-stack a[hidden],
.prompt-box[hidden] {
  display: none;
}

.prompt-box {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.prompt-box span {
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.prompt-box textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  resize: vertical;
  color: #475569;
  background: #f8fafc;
  line-height: 1.4;
}

.generated-preview {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #f8fafc;
}

.generated-preview[hidden] {
  display: none;
}

.generated-preview img {
  width: 84px;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  object-fit: cover;
}

.generated-preview span,
.manual-keywords span {
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.manual-keywords {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.manual-keywords input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.card-actions {
  margin-top: 14px;
}

.card-actions .secondary,
.card-actions a.secondary {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 8px;
  padding: 8px 10px;
  text-decoration: none;
  font-size: 12px;
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8fafc;
}

.history-item strong {
  display: block;
}

.history-item span {
  color: var(--muted);
  font-size: 13px;
}

.studio-controls {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.production-output {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.production-card,
.score-strip {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.production-card strong {
  display: block;
  margin-bottom: 6px;
}

.production-card pre {
  max-height: 260px;
  overflow: auto;
  margin: 8px 0 0;
  white-space: pre-wrap;
  color: #334155;
}

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

.variant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.mini-result {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mini-result strong {
  line-height: 1.35;
}

.mini-result small,
.mini-result span {
  color: var(--muted);
}

.score-pill {
  border-radius: 8px;
  padding: 6px 8px;
  color: #334155;
  background: #eef2f7;
  font-size: 12px;
  font-weight: 800;
}

.score-pill.best {
  color: #057a5f;
  background: rgba(10, 163, 127, 0.11);
}

.audio-preview {
  width: 100%;
  margin-top: 8px;
}

.timeline-editor {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 34px 1fr 86px auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.timeline-row[draggable="true"] {
  cursor: grab;
}

.timeline-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.timeline-row .drag-handle {
  color: var(--accent);
  font-weight: 900;
  text-align: center;
}

.max-hero {
  border-color: rgba(0, 200, 255, 0.34);
}

.max-card pre {
  max-height: 520px;
}

.extension-actions {
  display: grid;
  gap: 8px;
}

.extension-actions a.secondary {
  display: inline-flex;
  width: max-content;
  align-items: center;
  min-height: 38px;
  text-decoration: none;
}

.key-status {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(110, 245, 255, 0.2);
  border-radius: 8px;
  background: rgba(7, 13, 24, 0.72);
}

.key-status div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.key-status strong {
  color: var(--text);
}

.key-status .ok span {
  color: var(--success);
}

.key-status .bad span {
  color: var(--danger);
}

.key-status em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.script-generator {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin: 12px 0;
}

.preview-stage {
  position: relative;
  overflow: hidden;
  width: min(100%, 720px);
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #020611;
}

.portrait-preview .preview-stage {
  width: min(100%, 360px);
  aspect-ratio: 9 / 16;
}

.preview-stage video,
.preview-stage img,
.thumbnail-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.caption-overlay {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.62);
  color: white;
  font-weight: 800;
  text-align: center;
}

.thumbnail-preview {
  max-width: 520px;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.client-dashboard {
  display: grid;
  gap: 10px;
}

.client-dashboard article {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.plan-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.plan-card.active {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(0, 200, 255, 0.12);
}

.plan-card h3 {
  font-size: 24px;
}

.plan-card ul {
  display: grid;
  gap: 7px;
  padding-left: 18px;
  color: var(--muted);
}

.payment-panel {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.admin-payments {
  display: grid;
  gap: 10px;
}

.admin-payments article,
.admin-users article {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-toolbar,
.admin-actions {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 0.8fr;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.admin-actions {
  grid-template-columns: 0.8fr 0.8fr 1.6fr auto;
  margin-top: 4px;
}

.admin-alert {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(245, 166, 35, 0.35);
  border-radius: 8px;
  background: rgba(245, 166, 35, 0.1);
}

.admin-alert strong {
  color: #9a5b00;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-metrics article {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.admin-metrics span,
.admin-mini-grid span,
.admin-user-head span {
  color: var(--muted);
}

.admin-metrics strong {
  font-size: 24px;
}

.admin-users {
  display: grid;
  gap: 12px;
}

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

.admin-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.admin-users summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 800;
}

#adminRevenueCanvas {
  width: 100%;
  max-width: 920px;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }

  nav {
    grid-auto-flow: column;
  }

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

@media (max-width: 720px) {
  main {
    padding: 16px;
  }

  .topbar,
  .controls-row,
  .result-summary,
  .result-toolbar,
  .sidebar {
    flex-direction: column;
    align-items: stretch;
  }

  nav {
    grid-auto-flow: row;
  }

  .niche-grid,
  .results-grid,
  .plans-grid,
  .admin-metrics,
  .admin-mini-grid,
  .admin-toolbar,
  .admin-actions,
  .settings-grid,
  .script-generator,
  .status-panel,
  .controls-row,
  .history-item {
    grid-template-columns: 1fr;
  }
}

/* Cursor-inspired clean UI pass: calmer surfaces, tighter contrast, less visual noise. */
:root {
  --bg: #f7f8fa;
  --panel: #ffffff;
  --ink: #111318;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #6d5efc;
  --accent-2: #0ea5e9;
  --accent-3: #8b5cf6;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
}

body {
  background: var(--bg);
}

.sidebar {
  background: #0b0f17;
  border-right: 1px solid #1f2937;
}

.brand-logo {
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.panel,
.status-panel,
.result-summary,
.production-card,
.plan-card,
.result-card {
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.primary,
.auth-tabs button.active {
  background: #111318;
  color: #fff;
  box-shadow: none;
}

.secondary,
.niche,
.tab {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

input,
textarea,
select {
  border-color: var(--line);
  background: #fff;
}

/* Phase 3: Cursor-style clean SaaS UI layer. Visual polish only; app behavior stays unchanged. */
:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --soft-line: #f1f5f9;
  --soft-panel: #f8fafc;
  --sidebar: #ffffff;
  --sidebar-2: #f8fafc;
  --accent: #6d5efc;
  --accent-2: #0ea5e9;
  --accent-3: #8b5cf6;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 10px 30px rgba(0, 0, 0, 0.04);
}

html {
  background: var(--bg);
}

body {
  background: var(--bg);
  color: var(--ink);
  letter-spacing: 0;
}

.shell {
  grid-template-columns: 236px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 12px;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  border-right: 1px solid var(--line);
}

.brand {
  margin-bottom: 20px;
  padding: 0 4px;
}

.brand-logo {
  width: 100%;
  max-width: 204px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

nav {
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 9px 12px;
  border-radius: 7px;
  color: #475569;
  font-size: 14px;
  font-weight: 650;
  transition: background 140ms ease, color 140ms ease;
}

.nav-item.active,
.nav-item:hover {
  color: var(--accent);
  background: #f1f5f9;
}

main {
  padding: 24px 28px 36px;
  background: var(--bg);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  align-items: center;
  margin: -24px -28px 20px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.8);
  backdrop-filter: blur(16px);
}

h1 {
  font-size: 26px;
  font-weight: 760;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
}

.topbar p,
.auth-copy {
  color: var(--muted);
}

.user-chip,
.switch {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: none;
}

.view.active {
  gap: 14px;
}

.panel,
.status-panel,
.result-summary,
.result-toolbar,
.production-card,
.plan-card,
.result-card,
.history-item,
.admin-users > article,
.quota-panel,
.license-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.step-title {
  gap: 10px;
  margin-bottom: 14px;
}

.step-title span {
  color: #6b7280;
  font-size: 11px;
  letter-spacing: 0.04em;
}

.step-title h2,
.step-title h1 {
  color: var(--ink);
  font-weight: 760;
}

.field {
  gap: 6px;
  margin-bottom: 12px;
}

.field span {
  color: #475569;
  font-size: 13px;
  font-weight: 680;
}

.field input,
.field textarea,
.field select,
.result-toolbar input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg);
  color: var(--ink);
  padding: 10px 11px;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.field textarea {
  line-height: 1.5;
}

.field input:hover,
.field textarea:hover,
.field select:hover,
.result-toolbar input:hover {
  border-color: var(--accent);
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.result-toolbar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.primary,
.secondary,
.tab,
.niche,
.auth-tabs button {
  min-height: 38px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: none;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.primary {
  border: 1px solid var(--accent);
  color: #fff;
  background: var(--accent);
}

.primary:hover:not(:disabled) {
  background: var(--accent-3);
  border-color: var(--accent-3);
}

.secondary,
.tab,
.niche,
.auth-tabs button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--soft-panel);
}

.secondary:hover:not(:disabled),
.tab:hover,
.niche:hover,
.auth-tabs button:hover {
  border-color: var(--accent);
  background: var(--line);
  color: #fff;
}

.primary:active:not(:disabled),
.secondary:active:not(:disabled),
.tab:active,
.niche:active {
  transform: translateY(1px);
}

.primary:disabled,
.secondary:disabled {
  color: #8b9099;
  border-color: #eceef2;
  background: #f2f3f5;
  cursor: not-allowed;
}

.niche-grid {
  gap: 8px;
}

.niche {
  padding: 12px 10px;
  color: #4b4f58;
  background: #fff;
}

.niche.active,
.tab.active {
  border-color: #b8bcc6;
  color: #111;
  background: #f4f4f5;
}

.estimate,
.key-status div,
.status-step,
.quota-panel,
.license-panel {
  border-color: var(--line);
  background: var(--soft-panel);
  color: var(--muted);
}

.status-panel {
  background: transparent;
  box-shadow: none;
}

.status-step.done {
  color: #047857;
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.status-step.active {
  color: #92400e;
  border-color: #fde68a;
  background: #fffbeb;
}

.results-grid {
  gap: 14px;
}

.result-card {
  overflow: hidden;
}

.production-card {
  background: #fff;
}

.production-card pre,
.admin-output pre,
.max-card pre {
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  background: #fafafa;
  color: #303238;
}

.score-pill {
  border: 1px solid var(--line);
  color: #4b5563;
  background: #fafafa;
}

.score-pill.best {
  border-color: #a7f3d0;
  color: #047857;
  background: #ecfdf5;
}

.variant-grid {
  gap: 8px;
}

.mini-result {
  border-color: var(--line);
  background: #fff;
  box-shadow: none;
}

.admin-metrics article,
.settings-grid > *,
.plans-grid article,
.payment-card,
.api-vault-card {
  border-radius: 8px;
}

.auth-screen {
  background: radial-gradient(circle at 20% 0%, rgba(14, 165, 233, 0.12), transparent 40%), radial-gradient(circle at 80% 90%, rgba(139, 92, 246, 0.1), transparent 40%), #f8fafc;
}

.auth-card {
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.06);
}

.auth-tabs button {
  color: var(--muted);
  background: #f8fafc;
  border-color: var(--line);
}

.auth-tabs button.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.auth-form .field input {
  border-color: var(--line);
  color: var(--ink);
  background: #ffffff;
}

.auth-form .field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

@media (max-width: 1050px) {
  .sidebar {
    height: auto;
  }

  .topbar {
    margin: 0 0 18px;
    padding: 14px 0;
    background: var(--bg);
  }
}

@media (max-width: 720px) {
  main {
    padding: 16px;
  }

  .topbar {
    margin: 0 0 16px;
    padding: 0 0 14px;
  }
}

/* Phase 4: UI-only product polish for a cleaner Cursor-like workspace. */
* {
  scrollbar-width: thin;
  scrollbar-color: #c8ccd3 transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: #c8ccd3;
  background-clip: content-box;
}

::selection {
  color: #111;
  background: #dbeafe;
}

.sidebar nav {
  padding-top: 2px;
}

.nav-item.active {
  position: relative;
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 6px;
  width: 3px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent);
}

.nav-item.active,
.nav-item:hover {
  padding-left: 16px;
}

.topbar h1 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel {
  position: relative;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(17, 17, 17, 0.08), transparent);
}

.step-title {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--soft-line);
}

.controls-row,
.settings-grid,
.script-generator {
  align-items: end;
}

.script-generator {
  grid-template-columns: repeat(3, minmax(150px, 1fr)) repeat(3, max-content);
}

.script-studio {
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(420px, 1.12fr);
  gap: 14px;
  align-items: stretch;
}

.script-chat,
.script-output {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft-panel);
  padding: 14px;
}

.script-ai-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}

.script-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
}

.script-ai-row strong {
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.script-ai-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.script-ai-row em {
  border: 1px solid rgba(10, 163, 127, 0.24);
  border-radius: 999px;
  padding: 5px 8px;
  color: #057a5f;
  background: rgba(10, 163, 127, 0.08);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.script-ai-row em.missing {
  color: #9b1c1c;
  border-color: rgba(239, 68, 68, 0.24);
  background: rgba(239, 68, 68, 0.08);
}

.script-prompt input {
  min-height: 50px;
  font-size: 15px;
}

.script-output {
  display: grid;
}

.script-output textarea {
  min-height: 388px;
  background: var(--bg);
}

.button-row {
  row-gap: 8px;
}

.button-row .secondary,
.button-row .primary,
.result-toolbar .secondary,
.card-actions .secondary,
.extension-actions a.secondary {
  white-space: nowrap;
}

.field input[type="color"] {
  height: 40px;
  padding: 5px;
  cursor: pointer;
}

.field input[type="file"] {
  cursor: pointer;
}

.result-toolbar {
  position: sticky;
  top: 82px;
  z-index: 2;
}

.result-summary strong,
.production-card strong,
.plan-card h3,
.admin-metrics strong {
  letter-spacing: 0;
}

.result-card {
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.result-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15), 0 16px 38px rgba(0, 0, 0, 0.4);
  transform: translateY(-2px);
}

.video-wrap {
  border-bottom: 1px solid var(--soft-line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent),
    #101217;
}

.clip-number,
.provider,
.timeline,
.rating,
.keywords span,
.score-pill {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 8px;
}

.clip-number {
  color: var(--ink);
  border-color: var(--line);
  background: var(--bg);
}

.provider,
.timeline,
.rating,
.keywords span {
  border-color: var(--line);
  color: var(--muted);
  background: var(--bg);
}

.rating.good {
  border-color: rgba(16, 185, 129, 0.3);
  color: #10b981;
  background: rgba(16, 185, 129, 0.08);
}

.rating.bad {
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.prompt-box textarea,
.manual-keywords input,
.timeline-row input {
  border-color: var(--line);
  background: var(--bg);
  color: var(--ink);
}

.generated-preview,
.timeline-row,
.client-dashboard article,
.history-item {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.timeline-row {
  grid-template-columns: 34px minmax(0, 1fr) 86px auto;
}

.timeline-row .drag-handle {
  color: #8a8f99;
}

.preview-stage,
.thumbnail-preview {
  border: 1px solid #242832;
  box-shadow: 0 12px 32px rgba(17, 17, 17, 0.12);
}

.caption-overlay {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 14, 18, 0.72);
  backdrop-filter: blur(10px);
}

.max-hero {
  border-color: var(--line);
}

.max-hero .step-title span {
  color: #525760;
}

.key-status {
  border-color: var(--line);
  background: var(--bg);
}

.key-status div {
  min-height: 34px;
  align-items: center;
  border-color: var(--line);
  background: var(--panel);
}

.key-status strong {
  color: var(--ink);
}

.key-status .ok,
.key-status .bad {
  border-radius: 7px;
}

.extension-actions {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--soft-line);
}

.plans-grid {
  gap: 14px;
}

.plan-card {
  align-content: start;
  min-height: 100%;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.plan-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.plan-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset, var(--shadow);
}

.plan-card h3 {
  font-size: 22px;
}

.plan-card ul {
  gap: 8px;
  padding-left: 0;
  list-style: none;
}

.plan-card li {
  position: relative;
  padding-left: 18px;
}

.plan-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca3af;
}

.payment-panel {
  padding-top: 18px;
  border-top: 1px solid var(--soft-line);
}

.admin-toolbar,
.admin-actions {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.admin-alert {
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.08);
  color: var(--warn);
}

.admin-metrics article {
  min-height: 88px;
  background: var(--panel);
}

.admin-mini-grid > *,
.admin-users article,
.admin-payments article {
  border-color: var(--line);
  background: var(--panel);
}

.admin-user-head strong {
  font-size: 15px;
}

.admin-users summary {
  width: max-content;
  color: var(--ink);
}

#adminRevenueCanvas {
  background: var(--bg);
}

.auth-logo {
  height: 82px;
}

.auth-card .primary {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.auth-card .primary:hover:not(:disabled) {
  border-color: var(--accent-3);
  background: var(--accent-3);
}

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

  .script-generator {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .script-generator button {
    width: 100%;
  }

  .result-toolbar {
    position: static;
  }
}

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

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

  .brand-logo {
    max-width: 160px;
  }

  nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-item {
    flex: 0 0 auto;
  }
}

@media (max-width: 720px) {
  .panel {
    padding: 14px;
  }

  .button-row .secondary,
  .button-row .primary,
  .result-toolbar .secondary,
  .result-toolbar .primary {
    width: 100%;
    justify-content: center;
  }

  .timeline-row {
    grid-template-columns: 28px 1fr;
  }
}

/* Phase 5: final UI QA pass, accessibility polish, and denser SaaS dashboard finish. */
:where(button, a, input, textarea, select, summary):focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

a.secondary,
.file-button.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.primary,
.secondary,
.tab,
.niche,
.nav-item,
.file-button {
  user-select: none;
}

.primary,
.secondary,
.file-button,
.tab {
  line-height: 1.15;
}

.field input::placeholder,
.field textarea::placeholder,
.result-toolbar input::placeholder {
  color: #a1a5ad;
}

.field select {
  cursor: pointer;
}

.field.small span {
  white-space: nowrap;
}

.switch {
  min-height: 40px;
  color: #3f4249;
  font-size: 14px;
  font-weight: 650;
}

.switch input {
  accent-color: #111;
}

.topbar .switch,
.topbar .user-chip {
  height: 40px;
}

.user-chip {
  color: #303238;
  font-size: 14px;
}

.user-chip .secondary {
  min-height: 32px;
  padding: 7px 10px;
}

.panel + .panel {
  margin-top: 0;
}

.panel > .button-row:last-child,
.production-card > .button-row:last-child {
  margin-top: 12px;
}

.production-output:empty,
.results-grid:empty,
.history-list:empty,
.key-status:empty {
  display: none;
}

.production-output:not(:empty),
.history-list:not(:empty) {
  animation: cinemFadeIn 180ms ease-out;
}

@keyframes cinemFadeIn {
  from {
    opacity: 0;
    transform: translateY(3px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-summary {
  min-height: 64px;
}

.result-summary strong {
  font-size: 15px;
}

.result-toolbar {
  row-gap: 10px;
}

.tabs {
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
}

.tabs .tab {
  min-height: 32px;
  border-color: transparent;
  background: transparent;
}

.tabs .tab.active {
  border-color: var(--line);
  background: #fff;
  box-shadow: 0 1px 2px rgba(17, 17, 17, 0.04);
}

.result-body {
  display: grid;
  gap: 10px;
}

.result-card h3,
.result-card p,
.keywords,
.asset-stack,
.prompt-box,
.manual-keywords,
.card-actions {
  margin-top: 0;
}

.result-head {
  align-items: center;
}

.select-asset {
  width: max-content;
}

.select-asset input {
  accent-color: #111;
}

.asset-stack a {
  color: #303238;
}

.asset-stack a:hover {
  text-decoration: underline;
}

.prompt-box textarea {
  min-height: 92px;
  font-size: 12px;
}

.card-actions {
  padding-top: 10px;
  border-top: 1px solid var(--soft-line);
}

.card-actions .rate-good:hover {
  border-color: #86efac;
  color: #047857;
  background: #f0fdf4;
}

.card-actions .rate-bad:hover,
.card-actions .remove-card:hover {
  border-color: #fecaca;
  color: #b91c1c;
  background: #fef2f2;
}

.studio-controls .field,
.advanced-row .field {
  margin-bottom: 0;
}

.timeline-editor:empty {
  display: none;
}

.timeline-row:hover {
  border-color: #d3d6dc;
}

.production-card > span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.production-card > span + span {
  margin-top: 4px;
}

.production-card pre {
  font-size: 12px;
  line-height: 1.55;
}

.variant-grid .mini-result:hover {
  border-color: #d3d6dc;
  background: #fcfcfd;
}

.audio-preview {
  height: 40px;
}

.license-panel,
.quota-panel {
  line-height: 1.5;
}

.license-panel strong,
.quota-panel strong {
  display: block;
  margin-bottom: 3px;
}

.plans-grid .primary,
.plans-grid .secondary {
  width: 100%;
}

.payment-panel .step-title {
  margin-top: 0;
}

#paymentStatus .production-card,
#usageOutput .production-card {
  border-color: var(--line);
}

.admin-toolbar .field,
.admin-actions .field {
  margin-bottom: 0;
}

.admin-output,
#adminOutput {
  min-width: 0;
}

.admin-metrics article span {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.admin-metrics article strong {
  font-size: 26px;
}

.admin-mini-grid > * {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-users details {
  display: grid;
  gap: 8px;
}

.admin-users summary {
  padding: 6px 0;
}

.admin-users summary:hover {
  color: #525760;
}

.admin-payments article:hover,
.admin-users article:hover {
  border-color: #d3d6dc;
}

#vaultShareList:not(:empty),
#vaultStatusBox:not(:empty),
#whiteLabelStatus:not(:empty),
#paymentAccounts:not(:empty),
#keyStatus:not(:empty),
#projectStatus:not(:empty) {
  display: grid;
}

.file-button {
  cursor: pointer;
}

.file-button:hover {
  border-color: #d4d7dd;
  background: #f9fafb;
}

.auth-card {
  backdrop-filter: blur(16px);
}

.auth-card .step-title {
  border-bottom-color: var(--line);
}

.auth-card .field span {
  color: #334155;
}

.auth-card .key-status:not(:empty) {
  display: grid;
  border-color: var(--line);
  background: #f8fafc;
}

@media (max-width: 1180px) {
  .controls-row,
  .advanced-row,
  .studio-controls,
  .settings-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .topbar .switch,
  .topbar .user-chip {
    width: 100%;
    justify-content: space-between;
  }

  .result-summary {
    align-items: stretch;
  }

  .tabs {
    width: 100%;
  }

  .tabs .tab {
    flex: 1 1 auto;
  }

  .card-actions .secondary,
  .card-actions a.secondary {
    flex: 1 1 130px;
    justify-content: center;
  }

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

@media (max-width: 560px) {
  .controls-row,
  .advanced-row,
  .studio-controls,
  .settings-grid,
  .script-generator,
  .plans-grid,
  .admin-metrics {
    grid-template-columns: 1fr;
  }

  .result-head,
  .keywords {
    gap: 6px;
  }

  .clip-number,
  .provider,
  .timeline,
  .rating,
  .keywords span {
    font-size: 11px;
  }
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 705;
  text-transform: uppercase;
  color: #fff;
  letter-spacing: 0.03em;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  vertical-align: middle;
  margin: 0 4px;
}
.badge-pexels {
  background-color: #07a081;
}
.badge-pixabay {
  background-color: #1aa056;
}
.badge-unsplash {
  background-color: #1f2937;
  border: 1px solid rgba(255,255,255,0.1);
}


/* Scenes where no stock asset could be fetched (B-roll fault tolerance) */
.result-card.missing-asset {
  border: 1px dashed rgba(255, 176, 32, 0.65);
  background: rgba(255, 176, 32, 0.06);
}
.result-card.missing-asset img,
.result-card.missing-asset video {
  opacity: 0.35;
}
.result-card.missing-asset .provider::after {
  content: "no stock match";
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(255, 176, 32, 0.18);
  color: #ffb020;
}

/* Inline "Save anyway" action inside key-status messages */
.link-btn {
  background: none;
  border: none;
  padding: 0 0 0 8px;
  font: inherit;
  font-size: 12px;
  color: #6ea8ff;
  text-decoration: underline;
  cursor: pointer;
}
.link-btn:hover { color: #9cc4ff; }
.link-btn:disabled { color: #7a8394; cursor: default; text-decoration: none; }
