﻿* { box-sizing: border-box; }

:root {
  --bg: #090b10;
  --card: #101522;
  --card-2: #0c111d;
  --border: #27314a;
  --text: #f4f7ff;
  --muted: #a8b6d9;
  --accent-1: #fd1d1d;
  --accent-2: #c13584;
  --accent-3: #833ab4;
  --accent-4: #405de6;
  --brand-kortex: #17c8ad;
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 700px at 90% -10%, rgba(64, 93, 230, 0.18), transparent 60%),
    radial-gradient(1100px 620px at -10% -20%, rgba(193, 53, 132, 0.16), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 16px 28px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 2px 14px;
}

h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: 0;
}

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

.pill {
  position: fixed;
  top: 12px;
  right: max(12px, calc((100vw - 980px) / 2 + 12px));
  z-index: 60;
  border-radius: 999px;
  border: 1px solid rgba(23, 200, 173, 0.55);
  background: linear-gradient(90deg, #111728, #111a2b);
  padding: 7px 12px;
  font-size: 12px;
  color: #dfe6ff;
  box-shadow: 0 0 0 1px rgba(23, 200, 173, 0.12) inset;
}

.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  position: relative;
  z-index: 1;
  padding: 6px 0 8px;
  background: transparent;
  backdrop-filter: none;
}

.kpi-chip {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(64, 93, 230, 0.28);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(16, 21, 34, 0.96), rgba(12, 17, 29, 0.96));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

.kpi-chip span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.kpi-chip b {
  color: #fff;
  font-size: 18px;
  line-height: 1;
}

.kpi-chip.attention {
  border-color: rgba(253, 29, 29, 0.55);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.24),
    0 0 0 1px rgba(253, 29, 29, 0.14) inset;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.autopub-panel {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
}

.control-stack {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.control-label {
  color: #c3d2f4;
  font-size: 12px;
  font-weight: 700;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(54px, 1fr);
  gap: 4px;
  width: min(100%, 360px);
  padding: 4px;
  border: 1px solid rgba(64, 93, 230, 0.34);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(253, 29, 29, 0.12), rgba(193, 53, 132, 0.10), rgba(23, 200, 173, 0.10)),
    #090f1d;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}

.segmented button {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 999px;
  background: transparent;
  border: 0;
  color: #c8d4f2;
  box-shadow: none;
}

.segmented button.active {
  color: #fff;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2) 42%, var(--accent-3) 72%, var(--brand-kortex));
  box-shadow:
    0 8px 22px rgba(193, 53, 132, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.18) inset;
}

.mode-control {
  width: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: row;
  border-radius: 20px;
  padding: 6px;
}

.subtitle-control {
  width: min(100%, 440px);
}

.template-control {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row;
  border-radius: 20px;
  padding: 6px;
}

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

.template-control button {
  min-height: 52px;
  border-radius: 16px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.2;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-head h3 {
  margin: 0;
}

.section-head.subhead {
  margin: 0 0 8px;
}

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

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

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

.card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-top: 10px;
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.32),
    0 0 0 1px rgba(23, 200, 173, 0.08) inset;
}

.card canvas {
  width: 100% !important;
  height: 240px !important;
}

.kpi p {
  font-size: 32px;
  margin: 6px 0 0;
  font-weight: 700;
  color: #f7f9ff;
}

h3 {
  margin: 0 0 12px;
  font-size: 19px;
  letter-spacing: 0;
}

button {
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2) 46%, var(--accent-3) 76%, var(--brand-kortex));
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(23, 200, 173, 0.18);
}

button:hover {
  filter: brightness(1.08);
}

.ghost-btn {
  background: #0d1528;
  border: 1px solid #34507a;
  border-radius: 999px;
  color: #dbe6ff;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
}

.ghost-btn:hover {
  border-color: #4f6ea1;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

input,
textarea,
select {
  background: #0b1120;
  color: #f0f5ff;
  border: 1px solid #2e3b5f;
  border-radius: 8px;
  padding: 10px;
  width: 100%;
}

select {
  width: auto;
  min-height: 40px;
  border-radius: 999px;
  padding: 8px 34px 8px 12px;
}

.compact-input {
  width: 112px;
  min-height: 40px;
  border-radius: 999px;
}

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

label {
  display: block;
  margin-bottom: 6px;
  color: #c3d2f4;
  font-size: 12px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px;
  margin-left: 4px;
}

.toggle input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.toggle span {
  color: #dbe6ff;
  font-size: 14px;
}

.switch-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin: 0;
  padding: 8px 12px 8px 8px;
  border: 1px solid rgba(64, 93, 230, 0.34);
  border-radius: 999px;
  background: #0b1120;
  cursor: pointer;
}

.switch-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch-card b {
  display: block;
  color: #f2f6ff;
  font-size: 13px;
  line-height: 1.1;
}

.switch-card small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.switch-track {
  position: relative;
  width: 52px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #182238;
  border: 1px solid #31466d;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #dce7ff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.18s ease, background 0.18s ease;
}

.switch-card input:checked + .switch-track {
  border-color: rgba(23, 200, 173, 0.7);
  background: linear-gradient(90deg, var(--accent-2), var(--accent-3), var(--brand-kortex));
}

.switch-card input:checked + .switch-track .switch-thumb {
  transform: translateX(22px);
  background: #fff;
}

.metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #27314a;
  padding-top: 10px;
  margin-top: 10px;
}

.metric span {
  color: #b2b7c6;
  font-size: 13px;
}

.metric b {
  color: #f2f6ff;
}

details summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::after {
  content: ">";
  color: #c1c6d4;
  margin-left: auto;
}

details[open] summary::after {
  content: "v";
}

.info-panel > summary {
  margin: -2px 0;
}

.info-panel[open] > summary {
  margin-bottom: 10px;
}

.draft-item,
.history-item {
  border: 1px solid #2e3b5f;
  border-radius: 8px;
  padding: 10px;
  margin-top: 10px;
  background: #0b1120;
}

.draft-card {
  padding: 0;
  overflow: hidden;
}

.draft-card > summary {
  padding: 12px 14px;
  min-height: 64px;
}

.draft-card[open] > summary {
  border-bottom: 1px solid #27314a;
}

.draft-summary {
  align-items: flex-start;
}

.draft-summary-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.draft-summary-title {
  color: #cdd8f5;
  font-size: 13px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.draft-summary-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding-right: 18px;
}

.draft-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(64, 93, 230, 0.34);
  background: rgba(15, 22, 39, 0.95);
  color: #dce6ff;
  font-size: 11px;
  font-weight: 700;
}

.draft-pill-live {
  border-color: rgba(255, 106, 0, 0.48);
  background: rgba(255, 70, 125, 0.12);
  color: #ffd7e5;
}

.draft-pill-accent {
  border-color: rgba(23, 200, 173, 0.42);
  background: rgba(23, 200, 173, 0.10);
  color: #cffff1;
}

.draft-pill-mode {
  border-color: rgba(255, 170, 52, 0.40);
  background: rgba(255, 170, 52, 0.10);
  color: #ffe9b5;
}

.draft-body {
  padding: 12px 14px 14px;
}

.draft-script {
  margin-top: 10px;
  color: #f1f5ff;
  line-height: 1.52;
  white-space: normal;
  word-break: break-word;
}

.value-report {
  border-color: rgba(253, 29, 29, 0.22);
}

.readiness-state {
  color: #dce7ff;
  font-size: 12px;
  font-weight: 700;
}

.readiness-state.ok {
  color: #9ff6d8;
}

.readiness-state.miss {
  color: #ffd1db;
}

.readiness-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #27314a;
  padding-top: 10px;
  margin-top: 10px;
}

.readiness-item b {
  color: #eff5ff;
  font-size: 13px;
}

.readiness-item span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.readiness-item.ok b {
  color: #cffff1;
}

.readiness-item.miss b {
  color: #ffd7e5;
}

.compact-grid {
  margin-top: 8px;
}

.metric-tile {
  min-height: 76px;
  border: 1px solid rgba(64, 93, 230, 0.34);
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(18, 25, 43, 0.96), rgba(10, 17, 32, 0.96));
}

.metric-tile span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-tile b {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  margin-left: 6px;
  box-shadow: 0 0 0 0 rgba(253, 29, 29, 0.7);
  animation: badgePulse 1.8s infinite;
}

@keyframes badgePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(253, 29, 29, 0.55);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(253, 29, 29, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(253, 29, 29, 0);
  }
}

.draft-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.draft-actions .btn-publish-ready {
  background: linear-gradient(90deg, #ff6a00, #ff2f6d, #c13584, #833ab4);
  box-shadow: 0 0 0 0 rgba(255, 69, 124, 0.72);
  animation: publishPulse 1.45s infinite;
}

@keyframes publishPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 69, 124, 0.72);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(255, 69, 124, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 69, 124, 0);
  }
}

pre {
  white-space: pre-wrap;
  margin: 0;
  color: #e2e4ec;
  font-family: inherit;
  line-height: 1.45;
}

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

a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-content {
  width: min(920px, 100%);
  background: #0d1220;
  border: 1px solid #2e3b5f;
  border-radius: 8px;
  padding: 10px;
}

.modal-close {
  margin-bottom: 8px;
}

#previewVideo {
  width: 100%;
  max-height: 78vh;
  border-radius: 8px;
  background: #000;
}

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

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

  .template-control,
  .music-control {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 26px;
  }

  .pill {
    top: 10px;
    right: 10px;
  }
}

