:root {
  --bg: #f4f7fb;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef3f9;
  --border: #d5e0ec;
  --text: #0f172a;
  --muted: #5b6b7c;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --radius: 12px;
  --sidebar: 240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { min-height: 100%; }

body {
  font-family: "DM Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1000px 420px at 8% -8%, rgba(37, 99, 235, 0.10), transparent 55%),
    radial-gradient(800px 360px at 100% 0%, rgba(14, 165, 233, 0.08), transparent 50%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 45%, #eef3f8 100%);
  background-attachment: fixed;
}

a { color: inherit; text-decoration: none; }

.app {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #ffffff;
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.03);
}

.brand {
  padding: 0 8px;
}

.brand strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
}

.brand span {
  color: var(--muted);
  font-size: 0.78rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
}

.nav a:hover { background: var(--surface); color: var(--text); }

.nav a.active {
  background: #dbeafe;
  color: #1d4ed8;
}

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

.status-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.status-hero .label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.status-hero .value {
  margin-top: 8px;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #0f172a;
}

.split-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Overview-only polish (white + blue) */
.overview-page .overview-head {
  align-items: center;
  margin-bottom: 20px;
}

.overview-page .overview-head h1 {
  color: #0f172a;
  letter-spacing: -0.04em;
}

.overview-page .overview-head p { display: none; }

.overview-page .status-hero {
  border: 1px solid #dbeafe;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.08);
  position: relative;
  overflow: hidden;
}

.overview-page .status-hero::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #93c5fd;
}

.overview-page .status-hero.is-accent::before,
.overview-page .status-hero.is-on::before,
.overview-page .status-hero.is-live::before {
  background: #2563eb;
}

.overview-page .status-hero .label {
  color: #2563eb;
}

.overview-page .status-hero .value {
  color: #0f172a;
}

.overview-page .status-hero.is-on .value,
.overview-page .status-hero.is-live .value,
.overview-page .status-hero.is-accent .value {
  color: #1d4ed8;
}

.overview-page .status-hero .meta {
  margin-top: 6px;
  font-size: 0.82rem;
  color: #64748b;
  font-weight: 500;
}

.overview-page .channel-card {
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.08);
  overflow: hidden;
}

.overview-page .channel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 8px;
  font-weight: 700;
  color: #1e3a8a;
}

.overview-page .channel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2563eb;
}

.overview-page .channel-dot.wa { background: #16a34a; }
.overview-page .channel-dot.em { background: #2563eb; }

.overview-page .metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 4px 16px 16px;
}

.overview-page .metric-grid .label {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 4px;
  font-weight: 600;
}

.overview-page .metric-grid strong {
  font-size: 1.35rem;
  color: #0f172a;
}

.panel.soft {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 4px 16px 16px;
}

.metric-grid .label {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.metric-grid strong {
  font-size: 1.25rem;
}

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

.chip-row input { flex: 1; min-width: 160px; }

.history-list { max-height: 320px; overflow: auto; }
.history-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.history-item:last-child { border-bottom: 0; }
.history-item.status-failed { background: #fef2f2; }
.history-item.status-running,
.history-item.status-started { background: #eff6ff; }

@media (max-width: 980px) {
  .status-board,
  .split-stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .status-board,
  .split-stats { grid-template-columns: 1fr; }
}

.nav .group-label {
  margin: 14px 12px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6d7d8e;
}

.nav-user {
  padding: 8px 12px 4px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}
.nav-user strong { color: var(--text); font-weight: 600; }

.main {
  min-width: 0;
  padding: 28px 32px 56px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.page-head p { color: var(--muted); max-width: 62ch; line-height: 1.5; }

.btn, button.run, button.stop, button.secondary, button.accent-cyan, button.danger {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary, button.accent-cyan {
  color: #ffffff;
  background: var(--accent);
}

.btn-primary:hover, button.accent-cyan:hover { filter: brightness(1.06); }

.btn-ghost, button.secondary {
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface-2);
}

button.run {
  color: #fff;
  background: var(--accent, var(--accent-2));
}

button.run:disabled, button.stop:disabled, .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.stop, .btn-danger, button.danger {
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fecaca;
  background: rgba(239, 68, 68, 0.15);
}

.flashes { display: grid; gap: 8px; margin-bottom: 16px; }

.flash {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
}

.flash.ok { background: rgba(34, 197, 94, 0.12); color: #166534; }
.flash.err { background: rgba(239, 68, 68, 0.12); color: #991b1b; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.stat, .card, .panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat { padding: 16px 18px; }
.stat .label { color: var(--muted); font-size: 0.78rem; margin-bottom: 6px; }
.stat .value { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.03em; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.card {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
}

.card h2 { font-size: 1.12rem; }
.card p { color: var(--muted); font-size: 0.92rem; line-height: 1.5; flex: 1; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 6px;
  width: fit-content;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: color-mix(in srgb, var(--accent) 85%, white);
}

.badge.missing, .badge.off {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.panel { overflow: hidden; }
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.panel-header h3 { font-size: 0.95rem; font-weight: 600; }
.panel-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.dot.running {
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
  animation: pulse 1.2s ease-in-out infinite;
}
.dot.ok { background: var(--ok); }
.dot.err { background: var(--err); }
@keyframes pulse { 50% { opacity: 0.55; } }

.log, .prompt-box, .results-box {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  padding: 16px 18px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #e2e8f0;
  background: #0f172a;
  border-radius: 12px;
}

.log {
  height: min(420px, 50vh);
}

.log:empty::before {
  content: "Select a module and click Run. Output will appear here.";
  color: #5a6a7c;
}

.meta { margin-top: 10px; font-size: 0.8rem; color: var(--muted); }

.extract-body { padding: 18px; display: grid; gap: 18px; }
.extract-form, .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 720px) {
  .extract-form, .form-grid { grid-template-columns: 1fr; }
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .nav-toggle { display: inline-flex; }
  .sidebar:not(.open) .nav { display: none; }
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.field input, .field textarea, .field select {
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
.field textarea {
  min-height: 88px;
  resize: vertical;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.8rem;
}

.hint { font-size: 0.78rem; color: var(--muted); line-height: 1.45; }
.path-box {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  background: #0b1015;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  word-break: break-all;
  color: #9fd4ff;
}

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

table.data, table.tasks {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

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

table.data th, table.tasks th {
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.row-actions, .task-actions, .extract-actions, .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.row-actions button, .task-actions button, .row-actions .btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 0.72rem;
  font-weight: 600;
}

.thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text);
}

.suggest {
  font-size: 0.8rem;
  color: #9fd4ff;
  min-height: 1.2em;
}

.prompt-editor {
  min-height: 420px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
}

.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tabs a {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.tabs a.active { background: var(--accent); color: #ffffff; border-color: var(--accent); }

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 40;
  padding: 24px;
}
.modal-backdrop.open { display: grid; place-items: center; }
.modal {
  width: min(860px, 100%);
  max-height: 86vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.results-box { max-height: 280px; border-radius: 10px; padding: 12px; font-size: 0.72rem; }
.extract-msg { font-size: 0.85rem; color: var(--muted); min-height: 1.2em; }
.extract-msg.ok { color: #166534; }
.extract-msg.err { color: #991b1b; }
.muted { color: var(--muted); }
.media-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.media-row:last-child { border-bottom: 0; }
.media-row form { margin-left: auto; }

.soft-rule {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

.image-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

.image-pick {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  background: var(--surface-2);
  cursor: pointer;
  position: relative;
}

.image-pick.is-on {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.image-pick input {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
}

.image-pick img {
  width: 100%;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  background: #dbe4ef;
}

.image-pick span {
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.thumb-row .thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.channel-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0 16px;
}

.channel-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-weight: 600;
}

/* Campaigns page — white + blue, progress instead of terminal */
.campaigns-page .overview-head {
  align-items: center;
  margin-bottom: 20px;
}

.campaigns-page .overview-head h1 {
  color: #0f172a;
  letter-spacing: -0.04em;
}

.campaigns-page .channel-card {
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.08);
  overflow: hidden;
}

.campaigns-page .channel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 8px;
  font-weight: 700;
  color: #1e3a8a;
}

.campaigns-page .channel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2563eb;
}

.campaigns-page .channel-dot.wa { background: #16a34a; }
.campaigns-page .channel-dot.em { background: #2563eb; }

.campaigns-page .metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  padding: 4px 16px 16px;
}

.campaigns-page .metric-grid .label {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  margin-bottom: 4px;
  font-weight: 600;
}

.campaigns-page .metric-grid strong {
  font-size: 1.35rem;
  color: #0f172a;
}

.campaigns-page .camp-card {
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.08);
  padding: 18px;
}

.campaigns-page .camp-card-title {
  margin: 0 0 14px;
  color: #1e3a8a;
  font-size: 1.05rem;
}

.campaigns-page .channel-picks {
  margin: 0 0 16px;
}

.campaigns-page .channel-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  cursor: pointer;
  font-weight: 600;
  color: #0f172a;
  user-select: none;
}

.campaigns-page .channel-toggle.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.campaigns-page .channel-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.campaigns-page .toggle-ui {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.campaigns-page .toggle-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
  transition: transform 0.15s ease;
}

.campaigns-page .channel-toggle input:checked + .toggle-ui {
  background: #2563eb;
}

.campaigns-page .channel-toggle input:checked + .toggle-ui::after {
  transform: translateX(18px);
}

.campaigns-page .camp-schedule-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
  margin-bottom: 14px;
}

.campaigns-page .camp-schedule-row .field {
  min-width: 180px;
}

.campaigns-page .camp-schedule-row .field label {
  color: #2563eb;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.campaigns-page .camp-schedule-row input[type="time"] {
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #fff;
}

.campaigns-page .schedule-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}

.campaigns-page .schedule-summary .label {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 4px;
}

.campaigns-page .schedule-summary strong {
  font-size: 1.05rem;
  color: #0f172a;
}

.campaigns-page .channel-progress-card {
  margin-top: 0;
}

@media (max-width: 720px) {
  .campaigns-page .schedule-summary {
    grid-template-columns: 1fr;
  }
}

.campaigns-page .camp-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.campaigns-page .progress-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.campaigns-page .progress-track {
  height: 14px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  border: 1px solid #dbeafe;
}

.campaigns-page .progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  transition: width 0.35s ease;
}

.campaigns-page .progress-pct {
  font-weight: 700;
  color: #1d4ed8;
  min-width: 3.2rem;
  text-align: right;
}

.campaigns-page .progress-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.campaigns-page .progress-stats .label {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 4px;
}

.campaigns-page .progress-stats strong {
  font-size: 1.15rem;
  color: #0f172a;
}

.campaigns-page .progress-status {
  padding: 12px 14px;
  border-radius: 12px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: #1e3a8a;
  font-weight: 600;
  min-height: 1.4em;
}

@media (max-width: 720px) {
  .campaigns-page .metric-grid,
  .campaigns-page .progress-stats {
    grid-template-columns: 1fr 1fr;
  }
}

.keyword-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.keyword-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #e8f0fe;
  color: #1e3a8a;
  font-size: 0.82rem;
  font-weight: 600;
}

.keyword-chip button {
  border: 0;
  background: transparent;
  color: #1e3a8a;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

/* Extractor page — schedules + modal + progress (matches campaigns theme) */
.extractor-page .overview-head {
  align-items: center;
  margin-bottom: 20px;
}

.extractor-page .overview-head h1 {
  color: #0f172a;
  letter-spacing: -0.04em;
}

.extractor-page .camp-card {
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.08);
  padding: 18px;
}

.extractor-page .camp-card-title {
  margin: 0 0 14px;
  color: #1e3a8a;
  font-size: 1.05rem;
}

.extractor-page .camp-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.extractor-page .camp-actions {
  gap: 10px;
  flex-wrap: wrap;
}

.extractor-page .progress-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.extractor-page .progress-track {
  height: 14px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  border: 1px solid #dbeafe;
}

.extractor-page .progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  transition: width 0.35s ease;
}

.extractor-page .progress-pct {
  font-weight: 700;
  color: #1d4ed8;
  min-width: 3.2rem;
  text-align: right;
}

.extractor-page .progress-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.extractor-page .progress-stats .label {
  display: block;
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 4px;
}

.extractor-page .progress-stats strong {
  font-size: 1.15rem;
  color: #0f172a;
}

.extractor-page .progress-status {
  padding: 12px 14px;
  border-radius: 12px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  color: #1e3a8a;
  font-weight: 600;
  min-height: 1.4em;
}

.extractor-page .channel-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  cursor: pointer;
  font-weight: 600;
  color: #0f172a;
  user-select: none;
}

.extractor-page .channel-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.extractor-page .toggle-ui {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.extractor-page .toggle-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
  transition: transform 0.15s ease;
}

.extractor-page .channel-toggle input:checked + .toggle-ui {
  background: #2563eb;
}

.extractor-page .channel-toggle input:checked + .toggle-ui::after {
  transform: translateX(18px);
}

.extractor-page .schedule-list {
  display: grid;
  gap: 10px;
}

.extractor-page .schedule-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.extractor-page .schedule-row.status-running,
.extractor-page .schedule-row.status-started {
  border-color: #93c5fd;
  background: #eff6ff;
}

.extractor-page .schedule-row.status-completed {
  border-color: #86efac;
  background: #f0fdf4;
}

.extractor-page .schedule-row.status-failed {
  border-color: #fca5a5;
  background: #fef2f2;
}

.extractor-page .schedule-main {
  min-width: 0;
  flex: 1;
}

.extractor-page .schedule-main strong {
  color: #0f172a;
  font-size: 0.98rem;
}

.extractor-page .meta-line {
  margin-top: 4px;
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.4;
}

.extractor-page .empty-note {
  margin: 0;
  padding: 18px;
  text-align: center;
  color: #64748b;
  border: 1px dashed #bfdbfe;
  border-radius: 12px;
  background: #f8fbff;
}

.extractor-page .schedule-row .form-actions {
  flex-wrap: wrap;
  gap: 8px;
}

.modal.extract-modal {
  width: min(720px, 100%);
  border: 1px solid #dbeafe;
  box-shadow: 0 24px 64px rgba(37, 99, 235, 0.18);
}

.modal.extract-modal .panel-header {
  background: #eff6ff;
  border-bottom: 1px solid #dbeafe;
  padding: 14px 18px;
}

.modal.extract-modal .panel-header h3 {
  color: #1e3a8a;
  margin: 0;
}

.modal.extract-modal .modal-body {
  padding: 18px;
}

.modal.extract-modal .field label {
  color: #2563eb;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal.extract-modal input,
.modal.extract-modal select {
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #fff;
}

@media (max-width: 720px) {
  .extractor-page .progress-stats {
    grid-template-columns: 1fr 1fr;
  }
}

/* Product sections — list + edit modal */
.sections-page .overview-head {
  align-items: center;
  margin-bottom: 20px;
}

.sections-page .overview-head h1 {
  color: #0f172a;
  letter-spacing: -0.04em;
}

.sections-page .overview-head p {
  color: #64748b;
  max-width: 48ch;
}

.sections-page .camp-card,
.sections-status-card {
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.08);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.sections-page .camp-card-title {
  margin: 0;
  color: #1e3a8a;
  font-size: 1.05rem;
}

.sections-page .camp-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pdf-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1e3a8a;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.82rem;
  max-width: 220px;
}

.pdf-chip span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-chip:hover {
  border-color: #93c5fd;
  background: #dbeafe;
}

.pdf-chip-badge {
  flex-shrink: 0;
  padding: 2px 6px;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.modal.section-edit-modal {
  width: min(820px, 100%);
  border: 1px solid #dbeafe;
  box-shadow: 0 24px 64px rgba(37, 99, 235, 0.18);
}

.modal.section-edit-modal .panel-header {
  background: #eff6ff;
  border-bottom: 1px solid #dbeafe;
  padding: 14px 18px;
  align-items: flex-start;
}

.modal.section-edit-modal .panel-header h3 {
  margin: 0;
  color: #1e3a8a;
}

.modal.section-edit-modal .modal-sub {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 0.85rem;
}

.section-modal-body {
  padding: 18px;
}

.section-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.section-modal-grid .field.full {
  grid-column: 1 / -1;
}

.modal.section-edit-modal .field label {
  color: #2563eb;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal.section-edit-modal input,
.modal.section-edit-modal textarea {
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #fff;
}

.modal.section-edit-modal textarea {
  min-height: 0;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #0f172a;
}

.pdf-attach {
  display: grid;
  gap: 10px;
}

.pdf-attach-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.pdf-attach-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.pdf-attach-meta {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
}

.pdf-attach-meta strong {
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-attach-meta a {
  color: #2563eb;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
}

.pdf-attach-meta a:hover {
  text-decoration: underline;
}

.pdf-attach-empty {
  padding: 14px;
  border: 1px dashed #bfdbfe;
  border-radius: 12px;
  background: #f8fbff;
  color: #64748b;
  text-align: center;
}

.pdf-upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #fff;
  color: #1e3a8a;
  font-weight: 600;
  font-size: 0.88rem;
}

.pdf-upload-row input[type="file"] {
  max-width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
}

@media (max-width: 720px) {
  .section-modal-grid {
    grid-template-columns: 1fr;
  }
}

/* Products list + edit modal */
.products-page .overview-head {
  align-items: center;
  margin-bottom: 20px;
}

.products-page .overview-head h1 {
  color: #0f172a;
  letter-spacing: -0.04em;
}

.products-page .overview-head p {
  color: #64748b;
  max-width: 52ch;
}

.modal.product-edit-modal {
  width: min(860px, 100%);
  border: 1px solid #dbeafe;
  box-shadow: 0 24px 64px rgba(37, 99, 235, 0.18);
}

.modal.product-edit-modal .panel-header {
  background: #eff6ff;
  border-bottom: 1px solid #dbeafe;
  padding: 14px 18px;
  align-items: flex-start;
}

.modal.product-edit-modal .modal-sub:empty,
.modal.section-edit-modal .modal-sub:empty {
  display: none;
}

.modal.product-edit-modal .field label {
  color: #2563eb;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal.product-edit-modal input,
.modal.product-edit-modal select,
.modal.product-edit-modal textarea {
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #fff;
}

.modal.product-edit-modal textarea {
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #0f172a;
}

.product-checks {
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: end;
  padding-top: 22px;
}

.product-sections-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #eff6ff;
}

.product-sections-bar strong {
  display: block;
  color: #1e3a8a;
}

.media-library {
  display: grid;
  gap: 8px;
  margin: 8px 0 10px;
  max-height: 220px;
  overflow: auto;
  padding-right: 4px;
}

.media-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.media-card-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  background: #e2e8f0;
  flex-shrink: 0;
}

.media-card-name {
  flex: 1;
  min-width: 0;
  color: #0f172a;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-card-name:hover,
.media-card-file:hover {
  color: #2563eb;
}

.media-card-file {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #0f172a;
  font-weight: 600;
  font-size: 0.85rem;
}

.media-card-file .pdf-attach-icon {
  width: 36px;
  height: 36px;
  font-size: 0.65rem;
}

.media-card-file span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-card form {
  margin-left: auto;
}

/* Gemini prompts page */
.prompts-page .overview-head {
  align-items: center;
  margin-bottom: 20px;
}

.prompts-page .overview-head h1 {
  color: #0f172a;
  letter-spacing: -0.04em;
}

.prompts-page .camp-card,
.prompts-card {
  background: #ffffff;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.08);
  padding: 18px;
}

.prompts-tabs {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 16px;
  padding: 4px;
  border-radius: 12px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
}

.prompts-tabs a {
  padding: 8px 16px;
  border-radius: 10px;
  color: #1e3a8a;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.prompts-tabs a:hover {
  background: rgba(37, 99, 235, 0.08);
}

.prompts-tabs a.active {
  background: #2563eb;
  color: #ffffff;
}

.prompts-page .field label {
  color: #2563eb;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.prompts-page .prompt-editor {
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #fff;
  color: #0f172a;
  padding: 14px 16px;
  line-height: 1.55;
  min-height: 420px;
  resize: vertical;
}

.prompts-page .prompt-editor:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
