/* StormReach — Campaigns tab (real data build).
   Layered on top of radar.css + workspace.css: this file only styles what the
   rebuilt campaign console added. Tones match the radar's severity ramp so a
   "high" area looks the same colour on the map, in the list, and on the card. */

:root {
  --tone-critical: #ff5f6d;
  --tone-high: #ff9f1a;
  --tone-watch: #ffd21a;
  --tone-quiet: #5fd6a4;
}

/* ---------------------------------------------------------------- */
/* Layout                                                            */
/* ---------------------------------------------------------------- */

.panel-stack { display: grid; gap: 18px; align-content: start; }

.rail-empty {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.rail-empty a { color: var(--cyan); }

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--cyan);
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.muted { color: var(--subtle); }

.chip-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  transition: border-color 140ms var(--ease), background 140ms var(--ease);
}
.chip-button:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.08); }
.chip-button.danger { color: var(--tone-critical); }
.chip-button.is-off { opacity: 0.45; cursor: default; }

/* ---------------------------------------------------------------- */
/* Radar opportunities rail                                          */
/* ---------------------------------------------------------------- */

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

.opp {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--tone-quiet);
  border-radius: 12px;
  background: var(--surface-2);
}
.opp[data-tone="critical"] { border-left-color: var(--tone-critical); }
.opp[data-tone="high"] { border-left-color: var(--tone-high); }
.opp[data-tone="watch"] { border-left-color: var(--tone-watch); }

.opp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.opp-head strong { font-size: 14px; }
.opp .chip {
  padding: 3px 9px;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.opp .chip[data-tone="critical"] { color: var(--tone-critical); }
.opp .chip[data-tone="high"] { color: var(--tone-high); }
.opp .chip[data-tone="watch"] { color: var(--tone-watch); }
.opp .chip[data-tone="quiet"] { color: var(--tone-quiet); }

.opp-meta { margin: 7px 0 11px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.opp-meta b { color: var(--text); }
.opp-foot { display: flex; justify-content: flex-end; }
.opp-done { color: var(--subtle); font-size: 12px; font-weight: 650; }

.mini-action.hot {
  border-color: transparent;
  background: linear-gradient(120deg, var(--orange), #ff5f2e);
  color: #170600;
  font-weight: 800;
}
.mini-action.ghost { background: rgba(255, 255, 255, 0.05); color: var(--muted); }

/* ---------------------------------------------------------------- */
/* Campaign cards                                                    */
/* ---------------------------------------------------------------- */

.camp-empty {
  padding: 30px 26px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  text-align: left;
}
.camp-empty strong { display: block; margin-bottom: 8px; font-size: 16px; }
.camp-empty p { margin: 0 0 16px; max-width: 62ch; color: var(--muted); line-height: 1.65; }

.campaign-card { display: block; padding: 0; overflow: hidden; }
.campaign-card[data-tone="critical"] { border-left: 3px solid var(--tone-critical); }
.campaign-card[data-tone="high"] { border-left: 3px solid var(--tone-high); }
.campaign-card[data-tone="watch"] { border-left: 3px solid var(--tone-watch); }
.campaign-card[data-tone="quiet"] { border-left: 3px solid var(--tone-quiet); }

.camp-top {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(180px, 240px) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
}
.camp-title h3 { margin: 6px 0 4px; font-size: 15.5px; }
.camp-title p { margin: 0; color: var(--muted); font-size: 12.5px; }

.progress-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--subtle);
  font-size: 11.5px;
}

.camp-toggle {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12.5px;
  font-weight: 650;
}
.camp-toggle:hover { border-color: var(--line-strong); }

.camp-body {
  display: grid;
  gap: 18px;
  padding: 4px 18px 20px;
  border-top: 1px solid var(--line);
}

/* Caption ------------------------------------------------------- */

.copy-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 16px 0 10px; }
.copy-head h4 { margin: 0; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.copy-head div { display: flex; gap: 8px; }

.caption-box {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.62;
  resize: vertical;
  white-space: pre-wrap;
}
.caption-box:read-only { color: #dbe6e8; }
.caption-box:not(:read-only) { border-color: var(--cyan); background: #04121a; }

.camp-source { margin: 8px 0 0; color: var(--subtle); font-size: 12px; }

/* Images -------------------------------------------------------- */

.camp-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  align-items: start;
}
.camp-images.is-loading {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
}
.camp-images.is-loading p { margin: 12px 0 0; font-size: 13px; }

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: sr-spin 720ms linear infinite;
}
@keyframes sr-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

.shot {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
}
.shot img { display: block; width: 100%; height: auto; }
.shot figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  font-size: 11.5px;
  color: var(--muted);
}
.shot figcaption small { display: block; color: var(--subtle); font-size: 10.5px; }
.shot-dl { color: var(--cyan); font-weight: 700; text-decoration: none; }
.shot-dl:hover { text-decoration: underline; }
.shot-note { grid-column: 1 / -1; margin: 2px 0 0; color: var(--subtle); font-size: 11.5px; }

/* Post log ------------------------------------------------------ */

.post-log { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.post-log-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--line);
}
.post-log-head h4 { margin: 0; font-size: 13px; }
.post-log-head span { color: var(--subtle); font-size: 12px; }

.post-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(151, 190, 202, 0.1);
}
.post-row:last-of-type { border-bottom: 0; }
.post-row.is-posted { background: rgba(95, 214, 164, 0.05); }

.post-check { display: inline-flex; cursor: pointer; }
.post-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.post-check span {
  display: block;
  width: 20px;
  height: 20px;
  border: 1.6px solid var(--line-strong);
  border-radius: 6px;
  transition: background 140ms var(--ease), border-color 140ms var(--ease);
}
.post-check input:checked + span {
  border-color: var(--tone-quiet);
  background: var(--tone-quiet) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23041410' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 4 4L19 6'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.post-check input:focus-visible + span { outline: 3px solid var(--cyan); outline-offset: 2px; }

.post-id strong { display: block; font-size: 13.5px; }
.post-id small { color: var(--subtle); font-size: 11.5px; }
.post-actions { display: flex; gap: 7px; }

/* The results strip only appears once a group is ticked as posted. */
.post-results {
  grid-column: 2 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding-top: 2px;
}
.post-results label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--subtle);
  font-size: 11.5px;
}
.post-results input {
  width: 74px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
}
.post-results input:focus { border-color: var(--cyan); outline: none; }

.post-leads { display: inline-flex; align-items: center; gap: 8px; }
.post-leads button {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 15px;
  line-height: 1;
}
.post-leads button:hover { border-color: var(--line-strong); }
.post-leads span { min-width: 62px; color: var(--muted); font-size: 12px; }
.post-results .post-leads { color: var(--subtle); font-size: 11.5px; }
.post-leads b { color: var(--text); font-size: 13.5px; }

.post-note { margin: 0; padding: 11px 14px; border-top: 1px solid var(--line); color: var(--subtle); font-size: 11.5px; line-height: 1.55; }
.post-note b { color: var(--muted); }
.post-note.warn { color: var(--tone-high); }
.post-note a { color: var(--cyan); }

.camp-footer { display: flex; justify-content: flex-end; gap: 8px; }

/* Group performance table --------------------------------------- */

.perf-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.perf-table th {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  color: var(--subtle);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: right;
  text-transform: uppercase;
}
.perf-table th:first-child { text-align: left; }
.perf-table td { padding: 10px 6px; border-bottom: 1px solid rgba(151, 190, 202, 0.1); text-align: right; }
.perf-table td:first-child { text-align: left; }
.perf-table strong { display: block; font-size: 13px; font-weight: 650; }
.perf-table small { color: var(--subtle); font-size: 11px; }
.perf-note { margin: 10px 0 0; color: var(--subtle); font-size: 11.5px; line-height: 1.55; }

/* Live strip tones ---------------------------------------------- */

.live-strip[data-tone="critical"] { border-color: rgba(255, 95, 109, 0.4); color: #ffc2c7; }
.live-strip[data-tone="high"] { border-color: rgba(255, 159, 26, 0.4); color: #ffd8a3; }

@media (max-width: 900px) {
  .camp-top { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "num title" "prog prog" "act act"; }
  .camp-top .campaign-number { grid-area: num; }
  .camp-title { grid-area: title; }
  .campaign-progress { grid-area: prog; }
  .camp-toggle { grid-area: act; justify-self: start; }
  .post-row { grid-template-columns: auto minmax(0, 1fr); }
  .post-actions, .post-results { grid-column: 2; }
}

.chip-button.posted-link { border-color: rgba(95, 214, 164, .45); color: var(--tone-quiet); }

/* ---------------------------------------------------------------- */
/* Tracking status + measured counts                                 */
/* ---------------------------------------------------------------- */

.tracking-status {
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--subtle);
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 12.5px;
  line-height: 1.55;
}
.tracking-status strong { display: block; margin-bottom: 2px; }
.tracking-status span { color: var(--muted); }
.tracking-status code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 11.5px;
}
.tracking-status[data-tone="ok"] { border-left-color: var(--tone-quiet); }
.tracking-status[data-tone="info"] { border-left-color: var(--cyan); }
.tracking-status[data-tone="warn"] { border-left-color: var(--tone-high); }

.measured {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid rgba(95, 214, 164, 0.35);
  border-radius: 8px;
  background: rgba(95, 214, 164, 0.08);
  color: var(--muted);
  font-size: 11.5px;
}
.measured b { color: var(--text); font-size: 13px; }

.chip-button.publish {
  border-color: transparent;
  background: linear-gradient(120deg, var(--orange), #ff5f2e);
  color: #170600;
  font-weight: 800;
}
