/* Creative Engine — MUD\WTR design system (CLAUDE.md + CONTRACT.md) */

:root {
  --bg: #F8F8F8;
  --surface: #FFFFFF;
  --text: #0A0A0A;
  --text-2: #525252;
  --text-3: #A3A3A3;
  --border: #E5E5E5;
  --border-hover: #D4D4D4;
  --accent: #5B5BD6;
  --accent-soft: #F0F0FF;
  --green: #22C55E;
  --amber: #F59E0B;
  --red: #EF4444;
  --mono: 'Space Mono', monospace;
  --sans: 'Inter', -apple-system, sans-serif;
  --radius: 10px;
}

html[data-theme="dark"] {
  --bg: #111111;
  --surface: #1A1A1A;
  --text: #F5F5F5;
  --text-2: #A3A3A3;
  --text-3: #525252;
  --border: #2A2A2A;
  --border-hover: #3A3A3A;
  --accent: #818CF8;
  --accent-soft: rgba(129, 140, 248, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono { font-family: var(--mono); }

/* ---------- nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}
.nav-logo:hover { text-decoration: none; }
.nav-logo img { height: 20px; display: block; color: var(--text); }
html[data-theme="dark"] .nav-logo img { filter: invert(1); }

.nav-app {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-3);
  white-space: nowrap;
}

.nav-tabs { display: flex; gap: 4px; margin: 0 auto; }

.nav-tab {
  font-family: var(--mono);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 6px;
  color: var(--text-2);
}
.nav-tab:hover { color: var(--text); text-decoration: none; background: var(--accent-soft); }
.nav-tab-active { color: var(--accent); background: var(--accent-soft); }

.nav-status { display: flex; align-items: center; gap: 12px; }

.gen-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-2);
  white-space: nowrap;
}

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }
.dot-gray { background: var(--text-3); }

.key-pill {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.5px;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(245, 158, 11, 0.12);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.4);
  white-space: nowrap;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-2);
  font-size: 15px;
  width: 30px;
  height: 30px;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--border-hover); color: var(--text); }

/* ---------- banners ---------- */

.banner {
  max-width: 1080px;
  margin: 12px auto 0;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid var(--border);
}
.banner-warn {
  background: rgba(245, 158, 11, 0.10);
  border-color: rgba(245, 158, 11, 0.4);
  color: var(--text);
}

/* ---------- layout ---------- */

.main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px 96px;
}

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-2);
  font-family: var(--mono);
  font-size: 13px;
  padding: 48px 0;
}

.section-head { margin-bottom: 24px; }
.section-head-2 { margin-top: 48px; }

.section-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.section-title {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.5px;
}
.section-title-sm { font-size: 20px; }

.section-sub { color: var(--text-2); font-size: 14px; margin: 8px 0 0; max-width: 720px; }

/* ---------- buttons / inputs ---------- */

.btn {
  font-family: var(--mono);
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
}
.btn:hover { border-color: var(--border-hover); background: var(--accent-soft); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: default; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 85%, #000); border-color: var(--accent); }

.btn-sm { font-size: 12px; padding: 5px 12px; }
.btn-ghost { border-color: transparent; background: none; color: var(--text-2); }
.btn-link { display: inline-block; }

.input {
  font-family: var(--sans);
  font-size: 14px;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  width: 100%;
}
.input:focus { outline: none; border-color: var(--accent); }
.input-sm { font-size: 12px; padding: 6px 10px; }
.textarea { resize: vertical; min-height: 90px; }
.select { appearance: auto; }

/* ---------- chips / badges / pills ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--text-2);
  background: var(--surface);
  white-space: nowrap;
}
.chip-territory { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); }
.chip-flagged {
  color: var(--amber);
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.10);
  font-weight: 700;
}

.lane-badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.lane-founder { color: #0EA5E9; border-color: rgba(14, 165, 233, 0.4); background: rgba(14, 165, 233, 0.08); }
.lane-ugc { color: #D946EF; border-color: rgba(217, 70, 239, 0.4); background: rgba(217, 70, 239, 0.08); }
.lane-static { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); }

.verdict-pill {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 8px;
  border-radius: 99px;
  color: #fff;
}
.verdict-scale { background: var(--green); }
.verdict-wait { background: var(--amber); }
.verdict-kill { background: var(--red); }

/* ---------- filters ---------- */

.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
}
.filter-row::-webkit-scrollbar { height: 4px; }

.filter-name {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-3);
  min-width: 76px;
  flex: 0 0 auto;
}

.fchip {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 11px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}
.fchip:hover { border-color: var(--border-hover); color: var(--text); }
.fchip-active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- feed ---------- */

.week-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 32px 0 12px;
}
.week-head:first-of-type { margin-top: 0; }

.week-label {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.week-count { font-family: var(--mono); font-size: 11px; color: var(--text-3); }

.card-list { display: flex; flex-direction: column; gap: 12px; }

.idea-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  transition: border-color 120ms;
  position: relative;
}
.idea-card:hover { border-color: var(--border-hover); }

.idea-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.idea-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.idea-code { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--text-3); }

.idea-status { flex: 0 0 auto; }

.idea-angle { font-family: var(--sans); font-size: 16px; font-weight: 600; margin: 0 0 6px; }

.idea-hook {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-2);
  padding: 8px 12px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
  margin-bottom: 12px;
}

.idea-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }

.idea-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.idea-actions-right { display: flex; gap: 8px; }

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

.vote-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
}
.vote-btn:hover { border-color: var(--border-hover); background: var(--accent-soft); }
.vote-mine { border-color: var(--accent); background: var(--accent-soft); }

.vote-net {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
  min-width: 28px;
  text-align: center;
}
.vote-net.pos { color: var(--green); }
.vote-net.neg { color: var(--red); }

.reason-pop {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}
.reason-pop .input { flex: 1; }
.reason-pop .btn { flex: 0 0 auto; }

/* expanded detail */

.idea-detail { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }

.detail-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--text-3);
  margin: 16px 0 6px;
}
.detail-label:first-child { margin-top: 0; }

.detail-body { margin: 0 0 4px; color: var(--text-2); font-size: 14px; }
.detail-muted { color: var(--text-3); font-style: italic; }

.copy-block {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  padding-right: 80px;
}
.copy-hook { font-family: var(--mono); font-size: 15px; font-weight: 700; }
.copy-subline { font-family: var(--mono); font-size: 13px; color: var(--text-2); margin-top: 4px; }
.copy-btn { position: absolute; top: 10px; right: 10px; }

.receipt-list { display: flex; flex-direction: column; gap: 10px; }

.receipt {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--bg);
}

.receipt-quote {
  margin: 0;
  font-size: 14px;
  font-style: italic;
  color: var(--text);
  border-left: 3px solid var(--border-hover);
  padding-left: 12px;
}

.receipt-body { font-size: 14px; color: var(--text); }
.receipt-cap {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.receipt-link { font-family: var(--mono); font-size: 11px; }

.flag-callout {
  border: 1px solid rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.08);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 12px 0;
}
.flag-title { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--amber); }
.flag-notes { margin: 6px 0 0; font-size: 13px; color: var(--text-2); }

.rails-callout {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 12px;
  background: var(--bg);
}
.rails-callout summary {
  font-family: var(--mono);
  font-size: 12px;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--text-2);
}
.rails-callout summary:hover { color: var(--text); }
.rails-body { margin: 0; padding: 0 14px 12px; font-size: 13px; color: var(--text-2); }

/* spark FAB */

.spark-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 40;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  padding: 12px 20px;
  border-radius: 99px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  transition: transform 120ms;
}
.spark-fab:hover { transform: translateY(-2px); }

/* ---------- coverage ---------- */

.coverage-wrap { margin-bottom: 8px; }

.coverage-grid {
  display: grid;
  grid-template-columns: 150px repeat(5, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cov-corner, .cov-colhead, .cov-rowhead, .cov-cell { background: var(--surface); padding: 10px; }

.cov-colhead, .cov-rowhead {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.5px;
  color: var(--text-2);
  display: flex;
  align-items: center;
}
.cov-colhead { justify-content: center; text-align: center; }

.cov-untagged-head { color: var(--text-3); font-style: italic; }

.cov-cell {
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-height: 64px;
  font-family: var(--sans);
  text-align: left;
  background:
    linear-gradient(color-mix(in srgb, var(--accent) calc(var(--heat, 0) * 22%), transparent),
                    color-mix(in srgb, var(--accent) calc(var(--heat, 0) * 22%), transparent)),
    var(--surface);
  transition: outline 120ms;
  outline: 2px solid transparent;
  outline-offset: -2px;
  color: var(--text);
}
.cov-cell:hover { outline-color: var(--accent); }

.cov-gap { background: var(--accent-soft); }
.cov-gap .cov-spend { color: var(--accent); }
.cov-gap .cov-meta { color: var(--accent); font-weight: 700; }

.cov-spend {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.cov-meta { font-family: var(--mono); font-size: 10px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.cov-untagged { cursor: default; }

.cov-detail-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 12px;
}
.cov-detail-title { font-size: 14px; }
.cov-detail-stats { color: var(--text-2); font-variant-numeric: tabular-nums; }
.cov-detail-actions { display: flex; gap: 8px; }

/* territory board */

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

.territory-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  font-family: var(--sans);
  color: var(--text);
  transition: border-color 120ms;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.territory-tile:hover { border-color: var(--accent); }
.territory-unshipped { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }

.tile-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile-name { font-family: var(--mono); font-size: 13px; font-weight: 700; }

.tile-status {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--text-2);
  flex: 0 0 auto;
}
.tile-status-unshipped { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.tile-status-active { color: var(--green); border-color: rgba(34, 197, 94, 0.45); }
.tile-status-fatigued { color: var(--amber); border-color: rgba(245, 158, 11, 0.45); }

.tile-spend {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tile-verdicts { display: flex; gap: 12px; }
.vdot-wrap { display: flex; align-items: center; gap: 4px; }
.vdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.vdot-scale { background: var(--green); }
.vdot-wait { background: var(--amber); }
.vdot-kill { background: var(--red); }
.vdot-n { font-family: var(--mono); font-size: 11px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.tile-shipped { font-family: var(--mono); font-size: 10.5px; color: var(--text-3); }

.span-all { grid-column: 1 / -1; }

/* ---------- pipeline (kanban) ---------- */

.kanban {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: flex-start;
}

.kanban-col {
  flex: 0 0 230px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 200px;
  transition: border-color 120ms, background 120ms;
}
.kanban-over { border-color: var(--accent); background: var(--accent-soft); }

.kanban-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.kanban-title { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.kanban-count { font-family: var(--mono); font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.kanban-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; }

.kanban-empty {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  text-align: center;
  padding: 18px 8px;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.kanban-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: grab;
  position: relative;
  transition: border-color 120ms, opacity 120ms;
}
.kanban-card:hover { border-color: var(--border-hover); }
.kanban-card.dragging { opacity: 0.45; cursor: grabbing; }

.kcard-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.kcard-top .idea-code { font-size: 11px; }
.kcard-top .lane-badge { font-size: 9px; padding: 1px 6px; }
.kcard-top .verdict-pill { font-size: 9px; }

.nudge-flag { color: var(--amber); font-size: 13px; }

.kcard-menu-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 15px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.kcard-menu-btn:hover { color: var(--text); }

.kcard-angle { font-size: 12.5px; font-weight: 500; line-height: 1.4; }

.kcard-meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.kcard-meta .vote-net { font-size: 11px; min-width: 0; text-align: left; }
.kcard-linked { font-size: 10px; color: var(--text-3); }

.move-menu {
  position: absolute;
  top: 30px;
  right: 8px;
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
  display: flex;
  flex-direction: column;
  min-width: 140px;
  overflow: hidden;
}
.move-item {
  background: none;
  border: none;
  font-family: var(--mono);
  font-size: 12px;
  text-align: left;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--text);
}
.move-item:hover { background: var(--accent-soft); color: var(--accent); }

.linkad-wrap { display: flex; gap: 6px; margin-top: 8px; }
.linkad-wrap .input { flex: 1; min-width: 0; }
.linkad-wrap .btn { flex: 0 0 auto; }

.archive-block {
  margin-top: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.archive-block summary {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 12px 16px;
  cursor: pointer;
  color: var(--text-2);
}
.archive-body {
  padding: 12px 16px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px 16px;
  overflow-y: auto;
}

.modal-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
}
.modal-wide { max-width: 760px; }

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-3);
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

body.modal-open { overflow: hidden; }

.modal-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--text-3);
  margin-bottom: 6px;
}
.modal-title { font-family: var(--mono); font-size: 20px; font-weight: 700; }
.modal-sub { color: var(--text-2); font-size: 13.5px; margin: 8px 0 0; }
.modal-fields { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }

/* ---------- brief view ---------- */

.brief-head { margin-bottom: 16px; padding-right: 24px; }
.brief-head .modal-title { margin-top: 8px; }

.brief-intro { color: var(--text-2); font-size: 14px; }

.brief-actions { margin-top: 16px; }

.brief-note {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 12px;
}
.brief-fail { border-color: rgba(239, 68, 68, 0.45); color: var(--red); }
.brief-note-inline { font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.brief-date { font-family: var(--mono); font-size: 11px; color: var(--text-3); margin-left: auto; }

.brief-generating {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 28px 0;
  color: var(--text-2);
  font-size: 14px;
}

.brief-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.key-pending {
  border: 1px solid rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.08);
  border-radius: 8px;
  padding: 18px 20px;
}
.key-pending-title {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--amber);
}
.key-pending-body { margin: 8px 0 0; font-size: 13.5px; color: var(--text-2); }

/* markdown body */

.md-body { font-size: 14.5px; }
.md-body h1, .md-body h2, .md-body h3 { font-family: var(--mono); letter-spacing: -0.3px; }
.md-body h1 { font-size: 21px; margin: 20px 0 8px; }
.md-body h2 { font-size: 17px; margin: 18px 0 6px; }
.md-body h3 { font-size: 14.5px; margin: 16px 0 4px; }
.md-body p { margin: 8px 0; color: var(--text); }
.md-body ul, .md-body ol { margin: 8px 0; padding-left: 22px; }
.md-body li { margin: 3px 0; }
.md-body hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.md-body code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ---------- gate ---------- */

.gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 240ms;
}
.gate-out { opacity: 0; pointer-events: none; }

.gate-box {
  width: 100%;
  max-width: 360px;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
}
.gate-logo { height: 24px; margin-bottom: 16px; }
html[data-theme="dark"] .gate-logo { filter: invert(1); }

.gate-title {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 4px;
  color: var(--text-3);
  margin-bottom: 4px;
}
.gate-sub { font-size: 13px; color: var(--text-2); margin-bottom: 20px; }
.gate-form { display: flex; flex-direction: column; gap: 10px; }
.gate-input { text-align: center; font-family: var(--mono); }
.gate-error { margin-top: 12px; font-size: 13px; color: var(--red); }

.shake { animation: shake 300ms; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ---------- toast / spinner / empty ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 16px);
  z-index: 300;
  background: var(--text);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms, transform 180ms;
  max-width: min(90vw, 520px);
  text-align: center;
}
.toast-show { opacity: 1; transform: translate(-50%, 0); }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  animation: spin 700ms linear infinite;
  flex: 0 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.empty-title { font-family: var(--mono); font-size: 15px; font-weight: 700; }
.empty-msg { color: var(--text-2); font-size: 13.5px; max-width: 440px; }
.empty-state .btn { margin-top: 8px; }

/* ---------- mobile (≤640px, usable at 390px) ---------- */

@media (max-width: 640px) {
  .nav-inner { padding: 10px 14px; gap: 12px; flex-wrap: wrap; }
  .nav-app { display: none; }
  .nav-tabs { order: 3; width: 100%; margin: 0; justify-content: space-between; }
  .nav-tab { flex: 1; text-align: center; padding: 6px 4px; }
  .gen-status #gen-status-text, .gen-status span:last-child { display: none; }

  .main { padding: 20px 14px 96px; }
  .section-title { font-size: 21px; }

  .idea-card { padding: 14px; }
  .idea-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .idea-actions-right { justify-content: stretch; }
  .idea-actions-right .btn { flex: 1; }

  .filter-name { min-width: 64px; font-size: 9px; }

  .coverage-grid { grid-template-columns: 92px repeat(5, minmax(84px, 1fr)); overflow-x: auto; display: grid; }
  .coverage-wrap { overflow-x: auto; }
  .cov-colhead { font-size: 9px; padding: 6px 4px; }
  .cov-rowhead { font-size: 9.5px; padding: 6px; }
  .cov-cell { padding: 6px; min-height: 56px; }
  .cov-spend { font-size: 12px; }
  .cov-meta { font-size: 9px; }

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

  /* kanban stays horizontal-scroll (already is), tighter columns */
  .kanban-col { flex-basis: 210px; }
  .archive-body { grid-template-columns: 1fr; }

  .modal-backdrop { padding: 4vh 8px 8px; }
  .modal-box { padding: 20px; }
  .spark-fab { bottom: 16px; right: 16px; }
}
