/* Golden Rule CEO Strategic Intelligence Dashboard — Design System */
/* DM Sans body, Instrument Serif headers. Dark theme with gold accents. */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Instrument+Serif:ital@0;1&display=swap');

/* ── Tokens ── */
:root {
  --bg: #0C0E14;
  --surface: #14161E;
  --surface-2: #1A1D27;
  --surface-3: #22252F;
  --surface-4: #2A2D38;
  --gold: #D4A853;
  --gold-hover: #E5A84B;
  --gold-muted: #B8912D;
  --gold-dim: rgba(212, 168, 83, 0.15);
  --gold-dim2: rgba(212, 168, 83, 0.08);
  --text: #F5F0E8;
  --text-secondary: #A69F92;
  --text-muted: #706B62;
  --red: #E5534B;
  --green: #56D364;
  --blue: #58A6FF;
  --orange: #D29922;
  --purple: #BC8CFF;
  --border: rgba(212, 168, 83, 0.12);
  --border-strong: rgba(212, 168, 83, 0.25);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Instrument Serif', Georgia, serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 18px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-variant-numeric: tabular-nums lining-nums;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--gold); text-decoration: none; transition: color 0.2s var(--ease); }
a:hover { color: var(--gold-hover); }
a[target="_blank"]::after { content: ' ↗'; font-size: 0.75em; opacity: 0.5; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }

/* ── Password Gate ── */
#login-gate {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 24px;
  transition: opacity 0.5s var(--ease), visibility 0.5s;
}
#login-gate.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
#login-gate .logo-text {
  font-family: var(--font-display);
  font-size: 2.4rem;
  color: var(--gold);
  letter-spacing: -0.02em;
}
#login-gate .subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: -16px;
}
#login-gate .login-form {
  display: flex; gap: 12px; align-items: center;
}
#login-gate input[type="password"] {
  padding: 12px 20px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  width: 260px;
  outline: none;
  transition: border-color 0.2s;
}
#login-gate input[type="password"]:focus {
  border-color: var(--gold);
}
#login-gate .login-btn {
  padding: 12px 24px;
  background: var(--gold);
  color: var(--bg);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s;
}
#login-gate .login-btn:hover { background: var(--gold-hover); }
#login-gate .error-msg { color: var(--red); font-size: 0.85rem; height: 20px; }

/* ── Dashboard Layout ── */
#dashboard {
  display: none;
  grid-template-columns: 260px 1fr;
  grid-template-rows: auto 1fr;
  height: 100dvh;
}
#dashboard.active { display: grid; }

/* ── Sidebar ── */
.sidebar {
  grid-row: 1 / -1;
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
}
.sidebar-logo {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.sidebar-logo h1 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--gold);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.sidebar-logo .tagline {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  transition: all 0.2s var(--ease);
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
  color: var(--text);
  background: var(--gold-dim2);
}
.sidebar-nav a::after { display: none; }
.sidebar-nav a.active {
  color: var(--gold);
  background: var(--gold-dim);
  border-left-color: var(--gold);
  font-weight: 600;
}
.sidebar-nav a .nav-icon { font-size: 1rem; width: 22px; text-align: center; flex-shrink: 0; }
.sidebar-phone {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.sidebar-phone a {
  display: flex; align-items: center; gap: 8px;
  color: var(--gold);
  font-weight: 600;
  font-size: 0.9rem;
}
.sidebar-phone a::after { display: none; }
.sidebar-phone .phone-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Header ── */
.header {
  grid-column: 2;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.header-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--text);
}
.header-right {
  display: flex; align-items: center; gap: 16px;
}
.header-date { font-size: 0.78rem; color: var(--text-muted); }
.hamburger {
  display: none;
  background: none; border: none; color: var(--text); cursor: pointer;
  font-size: 1.4rem; padding: 4px;
}

/* ── Main Content ── */
.main {
  grid-column: 2;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 32px;
  scroll-behavior: smooth;
}

/* ── KPI Cards ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color 0.2s;
}
.kpi-card:hover { border-color: var(--border-strong); }
.kpi-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.kpi-value { font-size: 1.5rem; font-weight: 700; color: var(--gold); line-height: 1.2; }
.kpi-sub { font-size: 0.78rem; color: var(--text-secondary); margin-top: 4px; }

/* ── Revenue Ops Panel ── */
.rev-ops-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}
.rev-ops-panel h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 16px;
}
.ops-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.ops-metric {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 14px;
}
.ops-metric-label { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 6px; }
.ops-metric-row { display: flex; align-items: center; gap: 8px; }
.ops-metric-target { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.status-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.status-dot.green { background: var(--green); }
.status-dot.yellow { background: var(--orange); }
.status-dot.red { background: var(--red); }
.ops-status-label { font-size: 0.7rem; color: var(--text-secondary); margin-top: 2px; }

/* ── Reading Guide ── */
.reading-guide {
  background: var(--gold-dim);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
}
.reading-guide h4 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 8px;
}
.reading-guide p { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6; }

/* ── Priority Actions ── */
.priority-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.priority-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex; gap: 14px;
}
.priority-badge {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
  color: var(--bg);
}
.priority-badge.urgent { background: var(--red); }
.priority-badge.high { background: var(--orange); }
.priority-badge.med { background: var(--blue); }
.priority-content h5 { font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
.priority-content p { font-size: 0.78rem; color: var(--text-secondary); }

/* ── Section Cards (Layer 2) ── */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
  overflow: hidden;
  content-visibility: auto;
  contain-intrinsic-size: 0 80px;
  transition: border-color 0.2s;
}
.section-card:hover { border-color: var(--border-strong); }
.section-card-header {
  padding: 20px 24px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  user-select: none;
}
.section-card-header:hover { background: var(--gold-dim2); }
.section-icon {
  font-size: 1.3rem;
  width: 40px; height: 40px;
  background: var(--gold-dim);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.section-card-info { flex: 1; min-width: 0; }
.section-card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-card-summary { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; }
.section-card-stat {
  font-size: 0.78rem;
  color: var(--gold);
  font-weight: 600;
  margin-top: 6px;
}
.section-expand-icon {
  font-size: 1rem;
  color: var(--text-muted);
  transition: transform 0.3s var(--ease);
  margin-top: 4px;
  flex-shrink: 0;
}
.section-card.expanded .section-expand-icon { transform: rotate(180deg); }

/* ── Section Detail (Layer 3) ── */
.section-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s var(--ease);
}
.section-card.expanded .section-detail {
  max-height: none;
}
.section-detail-inner {
  padding: 0 24px 24px;
  border-top: 1px solid var(--border);
}

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}
th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 1;
}
th:hover { color: var(--gold); }
th .sort-arrow {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.3;
  font-size: 0.65rem;
}
th.sort-asc .sort-arrow, th.sort-desc .sort-arrow { opacity: 1; color: var(--gold); }
th.sort-asc .sort-arrow::after { content: '▲'; }
th.sort-desc .sort-arrow::after { content: '▼'; }
tbody tr { transition: background 0.15s; }
tbody tr:hover { background: var(--gold-dim2); }
tbody tr:last-child td { border-bottom: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums lining-nums; }

/* ── Expandable Row ── */
.expandable-row { cursor: pointer; }
.expandable-row .expand-indicator { transition: transform 0.2s; display: inline-block; }
.expandable-row.expanded .expand-indicator { transform: rotate(90deg); }
.row-detail {
  display: none;
  background: var(--surface-2);
}
.row-detail.visible { display: table-row; }
.row-detail td { white-space: normal; padding: 16px 20px; }

/* ── Zone Badges ── */
.zone-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}
.zone-badge.hot { background: rgba(229,83,75,0.15); color: var(--red); }
.zone-badge.warm { background: rgba(210,153,34,0.15); color: var(--orange); }
.zone-badge.growth { background: rgba(88,166,255,0.15); color: var(--blue); }

/* ── Insight Cards ── */
.insight-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 12px 0;
}
.insight-card h5 { font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
.insight-card p { font-size: 0.82rem; color: var(--text-secondary); }
.insight-card.warning {
  border-color: rgba(229,83,75,0.3);
  background: rgba(229,83,75,0.08);
}
.insight-card.warning h5 { color: var(--red); }
.insight-card.gold-border {
  border-color: var(--border-strong);
  background: var(--gold-dim);
}
.insight-card.gold-border h5 { color: var(--gold); }

/* ── Playbook / Expandable Content ── */
.playbook-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 8px 0;
  overflow: hidden;
}
.playbook-header {
  padding: 14px 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.15s;
}
.playbook-header:hover { background: var(--surface-3); }
.playbook-header h5 {
  font-size: 0.85rem;
  font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.playbook-chevron {
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: transform 0.2s var(--ease);
}
.playbook-card.expanded .playbook-chevron { transform: rotate(180deg); }
.playbook-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease);
}
.playbook-card.expanded .playbook-body { max-height: 3000px; }
.playbook-content {
  padding: 0 18px 18px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
.playbook-content p { margin: 8px 0; }
.playbook-content ul, .playbook-content ol {
  margin: 8px 0; padding-left: 20px;
}
.playbook-content li { margin: 4px 0; }
.playbook-content strong { color: var(--text); }

/* ── Pricing Cards ── */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 16px 0;
}
.pricing-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  position: relative;
}
.pricing-card.featured {
  border-color: var(--gold);
  background: var(--gold-dim);
}
.pricing-card .plan-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: 4px;
}
.pricing-card .plan-price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 4px;
}
.pricing-card .plan-period {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.pricing-card ul {
  list-style: none;
  text-align: left;
  font-size: 0.8rem;
}
.pricing-card li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.pricing-card li:last-child { border-bottom: none; }
.pricing-card li .check { color: var(--green); margin-right: 6px; }
.pricing-card li .dash { color: var(--text-muted); margin-right: 6px; }

/* ── Tier / Implementation Cards ── */
.tier-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 12px;
}
.tier-badge {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tier-badge.t0 { background: rgba(229,83,75,0.15); color: var(--red); }
.tier-badge.t1 { background: rgba(86,211,100,0.15); color: var(--green); }
.tier-badge.t2 { background: rgba(88,166,255,0.15); color: var(--blue); }
.tier-badge.t3 { background: rgba(210,153,34,0.15); color: var(--orange); }
.tier-badge.t4 { background: rgba(188,140,255,0.15); color: var(--purple); }
.tier-badge.t5 { background: var(--gold-dim); color: var(--gold); }
.tier-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
}

/* ── Chart Container ── */
.chart-container {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 16px 0;
  position: relative;
}
.chart-container canvas { max-height: 350px; }

/* ── Checklist ── */
.checklist {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 16px 0;
}
.checklist h5 { font-size: 0.88rem; margin-bottom: 12px; color: var(--text); }
.checklist-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.checklist-icon { font-size: 0.9rem; flex-shrink: 0; }
.checklist-icon.done { color: var(--green); }
.checklist-icon.pending { color: var(--text-muted); }

/* ── Summary Paragraph ── */
.summary-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 72ch;
  margin: 12px 0;
}
.summary-text strong { color: var(--text); }

/* ── Section Subheading ── */
.section-subhead {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text);
  margin: 24px 0 12px;
}

/* ── Pain Cards ── */
.pain-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.pain-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.pain-card .pain-pct {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 4px;
}
.pain-card .pain-title {
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 6px;
}
.pain-card .pain-quote {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}
.pain-card .pain-counter {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.pain-card .pain-counter strong { color: var(--green); }

/* ── OWN/RENT Visual ── */
.own-rent-bar {
  display: flex;
  height: 32px;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 12px 0;
}
.own-rent-bar .own {
  background: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: var(--bg);
}
.own-rent-bar .rent {
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; color: var(--text-secondary);
}

/* ── PE Story Cards ── */
.pe-story {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 12px 0;
}
.pe-story h5 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px;
}
.pe-story p { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.6; }
.pe-story .badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
}
.pe-story .badge.danger { background: rgba(229,83,75,0.15); color: var(--red); }
.pe-story .badge.warn { background: rgba(210,153,34,0.15); color: var(--orange); }

/* ── Acquisition Tier Labels ── */
.acq-tier-label {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}
.acq-tier-label.tier-a { background: rgba(86,211,100,0.15); color: var(--green); }
.acq-tier-label.tier-b { background: rgba(88,166,255,0.15); color: var(--blue); }
.acq-tier-label.tier-c { background: rgba(229,83,75,0.15); color: var(--red); }

/* ── Footer ── */
.dashboard-footer {
  padding: 24px 0;
  margin-top: 40px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.dashboard-footer a { color: var(--text-muted); }
.dashboard-footer a:hover { color: var(--gold); }

/* ── Stat Highlight Cards ── */
.stat-row {
  display: flex; flex-wrap: wrap; gap: 12px; margin: 12px 0;
}
.stat-chip {
  background: var(--surface-3);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 0.78rem;
}
.stat-chip .stat-num { font-weight: 700; color: var(--gold); }

/* ── Click to Call ── */
.phone-cta {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--gold);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.9rem;
  transition: background 0.2s;
}
.phone-cta:hover { background: var(--gold-hover); color: var(--bg); }
.phone-cta::after { display: none; }

/* ── Cross Section Links ── */
.xref {
  color: var(--gold);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.xref:hover { color: var(--gold-hover); }

/* ── Mobile ── */
.mobile-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 98;
}
.mobile-overlay.active { display: block; }

@media (max-width: 768px) {
  .hamburger { display: block; }
  #dashboard { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: -280px; top: 0; bottom: 0;
    width: 280px; z-index: 99;
    transition: left 0.3s var(--ease);
  }
  .sidebar.open { left: 0; }
  .main { padding: 20px 16px; }
  .header { padding: 12px 16px; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
  .kpi-value { font-size: 1.2rem; }
  .priority-actions { grid-template-columns: 1fr; }
  .pain-grid { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
  table { font-size: 0.78rem; }
  th, td { padding: 10px 10px; }
  .section-card-header { padding: 16px; gap: 12px; }
  .section-detail-inner { padding: 0 16px 16px; }
}

/* ── PPC Audit Bars ── */
.ppc-bars { display: flex; flex-direction: column; gap: 20px; margin: 16px 0; }
.ppc-bar-group { display: flex; flex-direction: column; gap: 4px; }
.ppc-bar-label { font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.ppc-bar-track { background: var(--surface-3); border-radius: 6px; overflow: hidden; height: 32px; }
.ppc-bar { padding: 6px 12px; font-size: 0.8rem; font-weight: 600; line-height: 20px; border-radius: 6px; white-space: nowrap; }
.ppc-bar.yours { background: linear-gradient(90deg, #e74c3c, #c0392b); color: #fff; }
.ppc-bar.bench { background: linear-gradient(90deg, #27ae60, #219a52); color: #fff; }
.ppc-bar-gap { font-size: 0.78rem; color: var(--red); font-weight: 500; padding-left: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ═══ Diagnostic Grid (Red/Yellow/Green) ═══ */
.diagnostic-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.diag-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
}

.diag-light {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-top: 3px;
  box-shadow: 0 0 8px currentColor;
}

.diag-item.red .diag-light { background: var(--red); color: var(--red); }
.diag-item.yellow .diag-light { background: #FFCC02; color: #FFCC02; }
.diag-item.green .diag-light { background: var(--green); color: var(--green); }

.diag-item.red { border-left: 3px solid var(--red); }
.diag-item.yellow { border-left: 3px solid #FFCC02; }
.diag-item.green { border-left: 3px solid var(--green); }

.diag-content { flex: 1; min-width: 0; }

.diag-label {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.diag-detail {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 6px;
}

.diag-detail code {
  background: rgba(255,255,255,0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.8rem;
}

.diag-fix {
  font-size: 0.82rem;
  color: var(--gold);
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 4px;
}

.diag-source {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

@media (max-width: 768px) {
  .diag-item { padding: 12px; }
  .diag-label { font-size: 0.88rem; }
  .diag-detail { font-size: 0.82rem; }
  .diag-fix { font-size: 0.78rem; }
}

/* ── Category Badges (Search Terms) ── */
.cat-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-right: 4px;
}

.cat-brand {
  background: rgba(212, 168, 83, 0.18);
  color: var(--gold);
  border: 1px solid rgba(212, 168, 83, 0.3);
}

.cat-competitor {
  background: rgba(255, 59, 48, 0.12);
  color: var(--red);
  border: 1px solid rgba(255, 59, 48, 0.25);
}

.cat-service {
  background: rgba(88, 166, 255, 0.12);
  color: #58A6FF;
  border: 1px solid rgba(88, 166, 255, 0.25);
}

.cat-supply {
  background: rgba(166, 159, 146, 0.15);
  color: var(--text-secondary);
  border: 1px solid rgba(166, 159, 146, 0.25);
}

/* ── LSA Status Badges ── */
.lsa-charged {
  color: var(--green);
  font-weight: 600;
}

.lsa-not-charged {
  color: var(--text-muted);
}

.lsa-credited {
  color: var(--gold);
  font-weight: 600;
}

/* ── Ensure new section tables are readable ── */
#search-terms-tbody td,
#black-holes-tbody td,
#high-convert-tbody td,
#lsa-leads-tbody td,
#lsa-location-tbody td,
#lsa-jobtype-tbody td {
  font-size: 0.85rem;
}

#search-terms-tbody td:first-child,
#black-holes-tbody td:first-child,
#high-convert-tbody td:first-child {
  font-family: 'DM Sans', monospace;
  font-size: 0.82rem;
  word-break: break-all;
}

/* ── Data Connection Status Bar ── */
.data-status-bar {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 22px;
}

.conn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.conn-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.conn-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.conn-item.connected .conn-dot {
  background: var(--green);
  box-shadow: 0 0 6px rgba(52, 199, 89, 0.45);
}

.conn-item.stale .conn-dot {
  background: #F5A623;
  box-shadow: 0 0 6px rgba(245, 166, 35, 0.35);
}

.conn-item.disconnected .conn-dot {
  background: var(--red);
  box-shadow: 0 0 6px rgba(255, 59, 48, 0.35);
}

.conn-badge {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.conn-item.connected .conn-badge {
  background: rgba(52, 199, 89, 0.12);
  color: var(--green);
  border: 1px solid rgba(52, 199, 89, 0.25);
}

.conn-item.stale .conn-badge {
  background: rgba(245, 166, 35, 0.12);
  color: #F5A623;
  border: 1px solid rgba(245, 166, 35, 0.25);
}

.conn-item.disconnected .conn-badge {
  background: rgba(255, 59, 48, 0.1);
  color: var(--red);
  border: 1px solid rgba(255, 59, 48, 0.2);
}

@media (max-width: 768px) {
  .conn-grid {
    grid-template-columns: 1fr;
  }
  .conn-item {
    font-size: 0.78rem;
  }
}

/* ── Nav Group Headers ── */
.nav-group {
  padding: 14px 20px 6px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--gold-muted);
  text-transform: uppercase;
  margin-top: 4px;
}
.sidebar-nav a:first-child ~ .nav-group:first-of-type {
  margin-top: 8px;
}

/* ── TLDR Card ── */
.tldr-card {
  background: linear-gradient(135deg, rgba(212, 168, 83, 0.12) 0%, rgba(212, 168, 83, 0.04) 100%);
  border: 2px solid var(--gold);
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  margin-bottom: 24px;
}
.tldr-badge {
  display: inline-block;
  background: var(--gold);
  color: var(--bg);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  border-radius: 4px;
  margin-bottom: 14px;
  text-transform: uppercase;
}
.tldr-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tldr-list li {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
  padding-left: 18px;
  position: relative;
}
.tldr-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}

/* ── Macro Diagnostic Grid ── */
.macro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  margin-bottom: 24px;
}
.macro-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: background 0.2s var(--ease);
}
.macro-item:hover {
  background: var(--surface-2);
}
.macro-light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-red .macro-light { background: var(--red); box-shadow: 0 0 8px rgba(229, 83, 75, 0.4); }
.status-yellow .macro-light { background: var(--orange); box-shadow: 0 0 8px rgba(210, 153, 34, 0.4); }
.status-green .macro-light { background: var(--green); box-shadow: 0 0 8px rgba(86, 211, 100, 0.4); }
.macro-body {
  flex: 1;
  min-width: 0;
}
.macro-metric {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.macro-detail {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.macro-tag {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  text-transform: uppercase;
}
.status-red .macro-tag { background: rgba(229, 83, 75, 0.15); color: var(--red); }
.status-yellow .macro-tag { background: rgba(210, 153, 34, 0.15); color: var(--orange); }
.status-green .macro-tag { background: rgba(86, 211, 100, 0.15); color: var(--green); }

/* ── Data Connection Strip ── */
.data-conn-strip {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px 18px;
  margin-bottom: 24px;
}
.conn-strip-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}
.conn-strip-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.conn-chip {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.conn-chip.live {
  background: rgba(86, 211, 100, 0.12);
  color: var(--green);
  border: 1px solid rgba(86, 211, 100, 0.25);
}
.conn-chip.live::before { content: '\2705 '; }
.conn-chip.csv {
  background: rgba(86, 211, 100, 0.08);
  color: #8bd498;
  border: 1px solid rgba(86, 211, 100, 0.15);
}
.conn-chip.csv::before { content: '\2705 '; }
.conn-chip.warn {
  background: rgba(210, 153, 34, 0.12);
  color: var(--orange);
  border: 1px solid rgba(210, 153, 34, 0.25);
}
.conn-chip.warn::before { content: '\26A0\FE0F '; }
.conn-chip.missing {
  background: rgba(229, 83, 75, 0.08);
  color: var(--red);
  border: 1px solid rgba(229, 83, 75, 0.15);
}
.conn-chip.missing::before { content: '\274C '; }

/* ── Greg Actions ── */
.greg-actions {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid rgba(88, 166, 255, 0.2);
  border-left: 4px solid var(--blue);
  padding: 16px 20px;
  margin-bottom: 28px;
}
.greg-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 12px;
}
.greg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 8px;
}
.greg-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.greg-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--bg);
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Mobile adjustments for new elements ── */
@media (max-width: 768px) {
  .macro-grid {
    grid-template-columns: 1fr;
  }
  .greg-grid {
    grid-template-columns: 1fr;
  }
  .tldr-card {
    padding: 18px 20px;
  }
  .tldr-list li {
    font-size: 0.88rem;
  }
  .conn-strip-items {
    gap: 6px;
  }
  .conn-chip {
    font-size: 0.7rem;
  }
}

/* ═══ Project Plan Board ═══ */

.project-plan {
  margin-bottom: 32px;
}

/* ── Plan Intro Note ── */
.plan-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--gold-dim);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.plan-note-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 1px;
}
.plan-note-body {
  flex: 1;
  min-width: 0;
}
.plan-note-body strong {
  color: var(--text);
}
.plan-reset-btn {
  display: inline-block;
  margin-left: 12px;
  padding: 4px 14px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  vertical-align: middle;
}
.plan-reset-btn:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

/* ── Phase Cards ── */
.phase-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  margin-bottom: 20px;
  overflow: hidden;
}
.phase-card.phase-red {
  border-left: 4px solid var(--red);
}
.phase-card.phase-yellow {
  border-left: 4px solid var(--orange);
}
.phase-card.phase-green {
  border-left: 4px solid var(--green);
}

.phase-card-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  flex-wrap: wrap;
}

.phase-card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  margin-top: 2px;
}
.phase-badge-red {
  background: rgba(229, 83, 75, 0.15);
  color: var(--red);
}
.phase-badge-yellow {
  background: rgba(210, 153, 34, 0.15);
  color: var(--orange);
}
.phase-badge-green {
  background: rgba(86, 211, 100, 0.15);
  color: var(--green);
}

.phase-card-info {
  flex: 1;
  min-width: 200px;
}
.phase-card-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--text);
  margin: 0 0 6px;
  line-height: 1.3;
}
.phase-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 8px;
}
.phase-card-gate {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.gate-label {
  font-weight: 700;
  color: var(--gold-muted);
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  margin-right: 4px;
}

/* ── Phase Progress Bar ── */
.phase-progress {
  flex-shrink: 0;
  min-width: 160px;
  text-align: right;
}
.phase-progress-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}
.phase-progress-track {
  background: var(--surface-3);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
}
.phase-progress-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s var(--ease);
}
.phase-fill-red { background: var(--red); }
.phase-fill-yellow { background: var(--orange); }
.phase-fill-green { background: var(--green); }

/* ── Task Owner Group ── */
.task-owner-group {
  padding: 0 24px 16px;
}
.task-owner-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.task-owner-icon {
  font-size: 1rem;
}
.task-owner-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Task Plan Table ── */
.task-plan-table {
  display: flex;
  flex-direction: column;
}

/* ── Task Row ── */
.task-row {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.task-row:last-child {
  border-bottom: none;
}
.task-row-main {
  display: grid;
  grid-template-columns: 30px 40px 1fr auto auto auto 32px;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  transition: background 0.15s;
  cursor: default;
}
.task-row-main:hover {
  background: var(--gold-dim2);
}

/* ── Custom Checkbox ── */
.task-checkbox-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  width: 30px;
  height: 30px;
}
.task-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.task-checkbox-custom {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 2px solid var(--text-muted);
  border-radius: 4px;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
  position: relative;
}
.task-checkbox-custom::after {
  content: '';
  display: none;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}
.task-checkbox:checked + .task-checkbox-custom {
  background: var(--green);
  border-color: var(--green);
}
.task-checkbox:checked + .task-checkbox-custom::after {
  display: block;
}
.task-checkbox:focus-visible + .task-checkbox-custom {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
/* Auto-verified partial (task 17 style) */
.task-checkbox-partial + .task-checkbox-custom {
  border-color: var(--orange);
}

/* ── Task Row Cells ── */
.task-num {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}
.task-name {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-time {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: right;
}
.task-impact {
  font-size: 0.78rem;
  color: var(--gold);
  font-weight: 600;
  white-space: nowrap;
}

/* ── Status Pills ── */
.task-status-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.status-not-started {
  background: rgba(112, 107, 98, 0.15);
  color: var(--text-muted);
}
.status-in-progress {
  background: rgba(210, 153, 34, 0.15);
  color: var(--orange);
}
.status-done {
  background: rgba(86, 211, 100, 0.15);
  color: var(--green);
}

/* ── Completed Row State ── */
.task-row.completed .task-name {
  text-decoration: line-through;
  color: var(--text-muted);
}
.task-row.completed .task-row-main {
  background: rgba(86, 211, 100, 0.04);
}

/* ── Expand Button ── */
.task-expand-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  transition: all 0.2s;
  cursor: pointer;
}
.task-expand-btn:hover {
  background: var(--surface-3);
}
.task-expand-icon {
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: transform 0.25s var(--ease);
  display: inline-block;
}
.task-row.expanded .task-expand-icon {
  transform: rotate(90deg);
}

/* ── Task Detail (expandable) ── */
.task-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease);
}
.task-row.expanded .task-detail {
  max-height: 2000px;
}
.task-detail-inner {
  padding: 12px 16px 16px 80px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.task-detail-inner p {
  margin: 0 0 10px;
}
.task-detail-inner strong {
  color: var(--text);
}
.task-detail-inner ol,
.task-detail-inner ul {
  margin: 8px 0;
  padding-left: 20px;
}
.task-detail-inner li {
  margin: 4px 0;
}
.task-detail-inner code {
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.82rem;
}
.task-detail-source {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.task-detail-note {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 8px 0 0;
}

/* ── API Status Items (Task 17) ── */
.task-api-status {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}
.api-status-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.api-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.api-status-item.api-live {
  background: rgba(86, 211, 100, 0.06);
  border: 1px solid rgba(86, 211, 100, 0.15);
}
.api-status-item.api-live .api-status-dot {
  background: var(--green);
  box-shadow: 0 0 6px rgba(86, 211, 100, 0.4);
}
.api-status-item.api-blocked {
  background: rgba(229, 83, 75, 0.06);
  border: 1px solid rgba(229, 83, 75, 0.12);
}
.api-status-item.api-blocked .api-status-dot {
  background: var(--red);
  box-shadow: 0 0 6px rgba(229, 83, 75, 0.4);
}

/* ── Phase Summary ── */
.phase-summary {
  margin: 0 24px 20px;
  padding: 16px 20px;
  background: var(--gold-dim);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}
.phase-summary h5 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 8px;
}
.phase-summary p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}
.phase-summary p strong {
  color: var(--text);
}

/* ── Mobile Responsive ── */
@media (max-width: 768px) {
  .phase-card-header {
    flex-direction: column;
    padding: 16px;
    gap: 10px;
  }
  .phase-progress {
    width: 100%;
    min-width: unset;
    text-align: left;
  }
  .task-owner-group {
    padding: 0 12px 12px;
  }
  .task-row-main {
    grid-template-columns: 28px 1fr auto 28px;
    grid-template-rows: auto auto;
    gap: 4px 8px;
    padding: 10px 4px;
  }
  .task-num {
    display: none;
  }
  .task-name {
    grid-column: 2 / 3;
    font-size: 0.85rem;
    white-space: normal;
  }
  .task-time {
    grid-column: 2 / -1;
    grid-row: 2;
    font-size: 0.75rem;
    text-align: left;
    padding-left: 0;
  }
  .task-impact {
    display: none;
  }
  .task-status-pill {
    grid-column: 3 / 4;
    grid-row: 1;
    font-size: 0.65rem;
    padding: 2px 6px;
  }
  .task-expand-btn {
    grid-column: 4 / 5;
    grid-row: 1;
  }
  .task-detail-inner {
    padding: 12px 12px 16px 12px;
    font-size: 0.82rem;
  }
  .phase-summary {
    margin: 0 12px 16px;
    padding: 12px 14px;
  }
  .plan-note {
    padding: 12px 14px;
    font-size: 0.82rem;
  }
}

/* ═══════════════════════════════════════════════════════
   DEMAND PERFORMANCE CONSOLE
   ═══════════════════════════════════════════════════════ */
.demand-console {
  margin-bottom: 32px;
}
.demand-console-header {
  margin-bottom: 20px;
}
.demand-console-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--text);
  margin-bottom: 4px;
}
.demand-console-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* A. Channel Demand Cards — horizontal scroll */
.demand-cards-scroll {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 24px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.demand-cards-scroll::-webkit-scrollbar { height: 6px; }
.demand-cards-scroll::-webkit-scrollbar-track { background: var(--surface-2); border-radius: 3px; }
.demand-cards-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.demand-card {
  flex: 0 0 200px;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  scroll-snap-align: start;
  transition: border-color 0.2s var(--ease);
}
.demand-card:hover {
  border-color: var(--border-strong);
}
.demand-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.demand-card-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}
.demand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.demand-dot.green { background: var(--green); box-shadow: 0 0 6px rgba(86,211,100,0.4); }
.demand-dot.red { background: var(--red); box-shadow: 0 0 6px rgba(229,83,75,0.4); }
.demand-dot.yellow { background: var(--orange); box-shadow: 0 0 6px rgba(210,153,34,0.4); }
.demand-dot.neutral { background: var(--text-muted); }

.demand-card-metrics {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.demand-metric {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.demand-metric-val {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.2;
}
.demand-metric-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.demand-card-note {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.4;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.demand-note-red { color: var(--red); font-weight: 600; }
.demand-note-yellow { color: var(--orange); font-weight: 600; }

/* Demand card click state */
.demand-card {
  cursor: pointer;
}
.demand-card.active {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 1px var(--gold), 0 4px 16px rgba(212, 168, 83, 0.15);
}

/* Channel Detail Panel */
.demand-detail-panel {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 0;
  margin-bottom: 24px;
  overflow: hidden;
  animation: detailSlideIn 0.35s var(--ease) forwards;
}
@keyframes detailSlideIn {
  from { opacity: 0; max-height: 0; margin-bottom: 0; transform: translateY(-8px); }
  to   { opacity: 1; max-height: 800px; margin-bottom: 24px; transform: translateY(0); }
}
.demand-detail-panel.closing {
  animation: detailSlideOut 0.25s var(--ease) forwards;
}
@keyframes detailSlideOut {
  from { opacity: 1; max-height: 800px; margin-bottom: 24px; transform: translateY(0); }
  to   { opacity: 0; max-height: 0; margin-bottom: 0; transform: translateY(-8px); }
}
.demand-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border);
}
.demand-detail-channel-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--gold);
}
.demand-detail-close {
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  background: none;
  border: none;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: color 0.2s, background 0.2s;
}
.demand-detail-close:hover {
  color: var(--text);
  background: var(--surface-3);
}
.demand-detail-body {
  padding: 20px 24px 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.demand-detail-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.demand-detail-item.full-width {
  grid-column: 1 / -1;
}
.demand-detail-item h5 {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold);
  margin-bottom: 6px;
}
.demand-detail-item p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.demand-detail-item.recommendation {
  border-color: var(--border-strong);
  background: var(--gold-dim);
}
.demand-detail-item.recommendation h5 {
  color: var(--gold);
}
.demand-detail-item.recommendation p {
  color: var(--text);
  font-weight: 500;
}

@media (max-width: 768px) {
  .demand-detail-body {
    grid-template-columns: 1fr;
  }
  .demand-detail-body .demand-detail-item.full-width {
    grid-column: 1;
  }
}

/* B. Conversion Funnel Comparison */
.funnel-comparison {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}
.funnel-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 20px;
}
.funnel-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.funnel-col {
  text-align: center;
}
.funnel-col-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  font-weight: 600;
}
.funnel-stat-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 10px;
}
.funnel-big-num {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}
.funnel-num-red { color: var(--red); }
.funnel-num-green { color: var(--green); }
.funnel-num-black { color: var(--text-muted); }
.funnel-big-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.funnel-arrow-down {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 4px 0;
}
.funnel-rate-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}
.funnel-badge-red { background: rgba(229,83,75,0.15); color: var(--red); }
.funnel-badge-green { background: rgba(86,211,100,0.15); color: var(--green); }
.funnel-badge-black { background: rgba(255,255,255,0.06); color: var(--text-muted); }

.funnel-gap-callout {
  background: rgba(229,83,75,0.08);
  border-left: 3px solid var(--red);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 18px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.funnel-gap-callout strong {
  color: var(--red);
}

/* C. Spend Status Strip */
.spend-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}
.spend-strip-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 14px;
  font-weight: 600;
}
.spend-strip-items {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.spend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 10px 16px;
  flex: 1 1 200px;
  min-width: 200px;
}
.spend-light {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.spend-red .spend-light { background: var(--red); box-shadow: 0 0 6px rgba(229,83,75,0.4); }
.spend-green .spend-light { background: var(--green); box-shadow: 0 0 6px rgba(86,211,100,0.4); }
.spend-yellow .spend-light { background: var(--orange); box-shadow: 0 0 6px rgba(210,153,34,0.4); }
.spend-info {
  display: flex;
  flex-direction: column;
}
.spend-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}
.spend-status {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════
   SITE HEALTH BOARD
   ═══════════════════════════════════════════════════════ */
.site-health-board {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}
.site-health-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.site-health-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text);
}
.site-health-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.health-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.health-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: border-color 0.2s;
}
.health-item:hover {
  border-color: var(--border);
}
.health-light {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.health-item.health-red .health-light { background: var(--red); box-shadow: 0 0 8px rgba(229,83,75,0.35); }
.health-item.health-yellow .health-light { background: var(--orange); box-shadow: 0 0 8px rgba(210,153,34,0.35); }
.health-item.health-green .health-light { background: var(--green); box-shadow: 0 0 8px rgba(86,211,100,0.35); }

.health-body {
  flex: 1;
  min-width: 0;
}
.health-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}
.health-detail {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 2px;
}
.health-tag {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  white-space: nowrap;
}
.health-item.health-red .health-tag { background: rgba(229,83,75,0.15); color: var(--red); }
.health-item.health-yellow .health-tag { background: rgba(210,153,34,0.15); color: var(--orange); }
.health-item.health-green .health-tag { background: rgba(86,211,100,0.15); color: var(--green); }
.health-item.fixed-today {
  border-color: rgba(86,211,100,0.25);
  background: rgba(86,211,100,0.06);
}
.health-item.fixed-today .health-name::before {
  content: '\2705 ';
}

/* Demand Console + Site Health responsive */
@media (max-width: 768px) {
  .demand-console-title { font-size: 1.25rem; }
  .demand-card { flex: 0 0 170px; min-width: 170px; padding: 14px; }
  .demand-metric-val { font-size: 1rem; }
  .funnel-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .funnel-big-num { font-size: 1.2rem; }
  .spend-strip-items { flex-direction: column; }
  .spend-item { flex: 1 1 auto; min-width: 0; }
  .health-item { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  .health-tag { margin-left: auto; }
}

/* ═══════════════════════════════════════════════════════
   PHASE 1 — DONE TASK STYLES
   ═══════════════════════════════════════════════════════ */
.task-row.task-done .task-row-main {
  opacity: 0.65;
}
.task-row.task-done .task-name {
  text-decoration: line-through;
  text-decoration-color: var(--green);
}
.task-row.task-done .task-status-pill {
  background: rgba(86,211,100,0.15);
  color: var(--green);
}

/* ── Audit Log ── */
.audit-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 8px;
}
.audit-filter-chip {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 20px;
  white-space: nowrap;
  cursor: pointer;
  background: var(--surface-3);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all 0.2s var(--ease);
  user-select: none;
}
.audit-filter-chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.audit-filter-chip.active {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold);
  font-weight: 600;
}
.audit-status-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.audit-status-badge.success {
  background: rgba(86, 211, 100, 0.12);
  color: var(--green);
  border: 1px solid rgba(86, 211, 100, 0.25);
}
.audit-status-badge.failed {
  background: rgba(229, 83, 75, 0.12);
  color: var(--red);
  border: 1px solid rgba(229, 83, 75, 0.25);
}
.audit-status-badge.pending {
  background: rgba(210, 153, 34, 0.12);
  color: var(--orange);
  border: 1px solid rgba(210, 153, 34, 0.25);
}

#audit-log-table td {
  white-space: normal;
}
#audit-log-table td:nth-child(4) {
  max-width: 400px;
  font-size: 0.8rem;
  line-height: 1.5;
}
#audit-log-table td:nth-child(1) {
  white-space: nowrap;
}

.audit-property-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface-3);
  color: var(--text);
  white-space: nowrap;
}

@media (max-width: 768px) {
  .audit-filter-bar {
    gap: 6px;
  }
  .audit-filter-chip {
    font-size: 0.7rem;
    padding: 4px 10px;
  }
  #audit-log-table td:nth-child(4) {
    max-width: 200px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   v4: 2-Page Split — Navigation, Audit Log Enhancement, Font Size
   ═══════════════════════════════════════════════════════════════ */

/* ── Bigger base font ── */
html { font-size: 19px !important; }

/* Tables & general content slightly larger */
.table-wrap table td,
.table-wrap table th {
  font-size: 0.88rem;
}
.section-card-summary,
.section-card-stat {
  font-size: 0.92rem;
}
.section-card-title {
  font-size: 1.15rem;
}
.tldr-list li {
  font-size: 1rem;
}
.macro-metric {
  font-size: 0.95rem;
}
.macro-detail {
  font-size: 0.88rem;
}
.health-name {
  font-size: 0.92rem;
}
.health-detail {
  font-size: 0.85rem;
}
.task-name {
  font-size: 0.9rem;
}

/* ── Sidebar Page Links ── */
.sidebar-nav a.nav-page-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  font-size: 0.88rem;
  color: var(--text-secondary);
  transition: all 0.2s var(--ease);
  border-left: 3px solid transparent;
  margin-top: 6px;
}
.sidebar-nav a.nav-page-link:first-child {
  margin-top: 0;
}
.sidebar-nav a.nav-page-link strong {
  font-weight: 700;
  letter-spacing: 0.02em;
}
.sidebar-nav a.nav-page-link:hover {
  color: var(--text);
  background: var(--gold-dim2);
}
.sidebar-nav a.nav-page-link.active {
  color: var(--gold);
  background: var(--gold-dim);
  border-left-color: var(--gold);
}

/* Indent sub-nav items under page links */
.sidebar-nav a.nav-sub {
  padding-left: 32px;
  font-size: 0.78rem;
}

/* ── Audit Log Enhanced Rows ── */
.audit-row-main.has-detail {
  cursor: pointer;
  transition: background 0.15s ease;
}
.audit-row-main.has-detail:hover {
  background: var(--gold-dim2);
}
.audit-row-main.expanded {
  background: var(--gold-dim);
}
.audit-expand-icon {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
  margin-left: 4px;
}
.audit-row-main.expanded .audit-expand-icon {
  transform: rotate(90deg);
}
.audit-action-cell {
  font-weight: 500;
}

/* Audit detail row (expandable) */
.audit-detail-row {
  display: none;
}
.audit-detail-row.open {
  display: table-row;
}
.audit-detail-inner {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface-2);
  border-left: 3px solid var(--gold);
  border-radius: 0 0 6px 6px;
}
.audit-detail-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.audit-detail-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  font-weight: 700;
}
.audit-detail-block p {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 0;
}

/* Flagged status badge */
.audit-status-badge.flagged {
  background: rgba(255, 152, 0, 0.15);
  color: #ff9800;
}

/* ── Mobile adjustments for 2-page nav ── */
@media (max-width: 768px) {
  .sidebar-nav a.nav-page-link {
    padding: 10px 16px;
    font-size: 0.84rem;
  }
  .sidebar-nav a.nav-sub {
    padding-left: 28px;
    font-size: 0.76rem;
  }
  .audit-detail-inner {
    padding: 12px 14px;
  }
  .audit-detail-block p {
    font-size: 0.82rem;
  }
}
