/* ============================================================
   CSS VARIABLES — Edit these to change the dashboard theme
   ============================================================ */
:root {
  /* Primary brand colors */
  --navy:        #1B2A4A;
  --blue:        #2563EB;
  --blue-light:  #DBEAFE;

  /* Semantic status colors */
  --green:       #059669;
  --green-light: #D1FAE5;
  --red:         #DC2626;
  --red-light:   #FEE2E2;
  --yellow:      #F59E0B;
  --yellow-light:#FEF3C7;

  /* Neutral grays */
  --gray-50:  #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-500: #6B7280;
  --gray-700: #374151;
  --gray-900: #111827;
}

/* ============================================================
   BASE STYLES
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
  background: var(--navy);
  color: white;
  padding: 20px 32px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}
.header h1 { font-size: 22px; font-weight: 600; }
.header .date { font-size: 13px; opacity: 0.7; }
.header > div:last-child { text-align: right; }

/* View switcher pill bar — desktop only */
.view-switcher {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}
.view-pill {
  background: transparent;
  color: rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 14px;
  padding: 4px 13px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.view-pill:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.6);
  color: white;
}
.view-pill.active {
  background: white;
  color: var(--navy);
  border-color: white;
  font-weight: 600;
}

/* ============================================================
   TAB NAVIGATION
   ============================================================ */
.tabs {
  display: flex;
  background: white;
  border-bottom: 2px solid var(--gray-200);
  padding: 0 32px;
}
.tab {
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  color: var(--gray-500);
  transition: all 0.2s;
}
.tab:hover { color: var(--gray-700); background: var(--gray-50); }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 6px; padding: 1px 6px; min-width: 18px; height: 18px;
  border-radius: 9px; font-size: 11px; font-weight: 700; line-height: 1;
  background: #EA580C; color: white; vertical-align: middle;
}

/* ============================================================
   CONTENT AREA & TAB PANELS
   ============================================================ */
.content { padding: 24px 32px; max-width: 1400px; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   GROWTH ACTIONS — Weekly operating rhythm tab
   ============================================================ */
.ga-banner {
  background: var(--navy);
  color: white;
  padding: 14px 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.5;
}
.ga-banner strong { font-weight: 600; }
.ga-banner.crisis { background: var(--red); }
.ga-banner.warning { background: var(--yellow); color: var(--gray-900); }
.ga-principle {
  background: var(--blue-light);
  border-left: 4px solid var(--blue);
  padding: 14px 20px;
  border-radius: 8px;
  margin-top: 24px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--gray-900);
}
.ga-principle strong { color: var(--navy); font-weight: 600; }

/* Status badges (OPEN / MISSED / DONE / TO BUILD / LIVE) */
.ga-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.ga-badge-missed   { background: var(--red-light);    color: var(--red); }
.ga-badge-open     { background: var(--yellow-light); color: #92400E; }
.ga-badge-done     { background: var(--green-light);  color: #065F46; }
.ga-badge-red      { background: var(--red-light);    color: var(--red); }
.ga-badge-amber    { background: var(--yellow-light); color: #92400E; }
.ga-badge-green    { background: var(--green-light);  color: #065F46; }
.ga-badge-tobuild  { background: var(--yellow-light); color: #92400E; }
.ga-badge-live     { background: var(--green-light);  color: #065F46; }
.ga-badge-beat     { background: var(--green-light);  color: #065F46; }
.ga-badge-ontrack  { background: var(--green-light);  color: #065F46; }
.ga-badge-warning  { background: var(--yellow-light); color: #92400E; }
.ga-badge-critical { background: var(--red-light);    color: var(--red); }

/* Missed action rows tinted */
tr.ga-row-missed td { background: #FEF2F2; }
tr.ga-row-missed td:first-child { border-left: 3px solid var(--red); }

/* Priority tags */
.ga-pri {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  margin-right: 6px;
}
.ga-pri-P0 { background: var(--red); color: white; }
.ga-pri-P1 { background: var(--yellow); color: var(--gray-900); }
.ga-pri-P2 { background: var(--gray-300); color: var(--gray-700); }

/* Owner chip */
.ga-owner {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  background: var(--gray-100);
  color: var(--gray-700);
  white-space: nowrap;
}
.ga-owner-peter   { background: #DBEAFE; color: #1E40AF; }
.ga-owner-farr    { background: #FEF3C7; color: #92400E; }
.ga-owner-david-e { background: #FCE7F3; color: #9D174D; }
.ga-owner-ryan    { background: #E0E7FF; color: #3730A3; }

/* Yellow input hint */
.ga-input-hint { background: #FEF3C7; }

/* Notes column styling */
.ga-notes { font-size: 12px; color: var(--gray-500); }

/* Days idle cell coloring is JS-driven */
.ga-idle-red   { background: var(--red-light);    color: var(--red);    font-weight: 600; }
.ga-idle-amber { background: var(--yellow-light); color: #92400E;       font-weight: 600; }
.ga-idle-green { background: var(--green-light);  color: #065F46; }

/* ============================================================
   KPI CARDS — Top-level metrics displayed as a row
   ============================================================ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border-left: 4px solid var(--blue);
}
.kpi-card.green  { border-left-color: var(--green); }
.kpi-card.red    { border-left-color: var(--red); }
.kpi-card.yellow { border-left-color: var(--yellow); }
.kpi-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  margin-bottom: 6px;
}
.kpi-value { font-size: 28px; font-weight: 700; }
.kpi-sub   { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.section-title {
  font-size: 16px;
  font-weight: 600;
  margin: 24px 0 12px;
  color: var(--navy);
}
.section-subtitle {
  font-size: 13px;
  color: var(--gray-500);
  margin: -8px 0 12px;
}

/* ============================================================
   DATA TABLES
   ============================================================ */
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 24px;
  font-size: 13px;
}
thead th {
  background: var(--navy);
  color: white;
  padding: 10px 14px;
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--gray-100);
}
tbody tr:hover { background: var(--blue-light); }

/* Special row types */
tr.subtotal td     { background: var(--gray-100); font-weight: 600; border-top: 2px solid var(--gray-300); }
tr.grand-total td  { background: var(--navy); color: white; font-weight: 700; font-size: 14px; }
tr.stage-header td { background: #EEF2FF; font-weight: 600; color: var(--navy); font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
tr.closed-won td   { background: var(--green-light); }
tr.closed-lost td  { background: var(--red-light); color: var(--gray-500); }

/* Alignment utilities */
.amount { text-align: right; font-variant-numeric: tabular-nums; }
.pct    { text-align: center; }

/* ============================================================
   TAGS — Inline labels for deal type and stage
   ============================================================ */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}
.tag-agency    { background: #FEF3C7; color: #92400E; }
.tag-direct    { background: #DBEAFE; color: #1E40AF; }
.tag-prospect  { background: #F3F4F6; color: #374151; }
.tag-discovery { background: #E0E7FF; color: #3730A3; }
.tag-develop   { background: #DBEAFE; color: #1E40AF; }
.tag-solution  { background: #C7D2FE; color: #4338CA; }
.tag-proposal  { background: #A5B4FC; color: #312E81; }
.tag-won       { background: var(--green-light); color: #065F46; }
.tag-lost      { background: var(--red-light); color: #991B1B; }

/* ============================================================
   CHART LAYOUT
   ============================================================ */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}
.chart-card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.chart-card h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--navy);
}
.chart-card canvas { max-height: 280px; }
@media (max-width: 900px) { .chart-grid { grid-template-columns: 1fr; } }

/* ============================================================
   PIPELINE ADDITIONS CARDS
   ============================================================ */
.additions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.additions-card {
  background: white;
  border-radius: 10px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  text-align: center;
}
.additions-card .q-label    { font-size: 13px; font-weight: 600; color: var(--navy); }
.additions-card .deals-count { font-size: 24px; font-weight: 700; color: var(--blue); margin: 4px 0; }
.additions-card .pipe-value  { font-size: 14px; color: var(--gray-700); }

/* ============================================================
   WARNING BANNER
   ============================================================ */
.warning-banner {
  background: #FEF3C7;
  border: 1px solid #F59E0B;
  border-radius: 8px;
  padding: 14px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #92400E;
}
.warning-banner strong { font-weight: 600; }

/* ============================================================
   SCENARIO CARDS
   ============================================================ */
.scenario-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.scenario-card {
  background: white;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  text-align: center;
}
.scenario-card .s-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray-500); }
.scenario-card .s-value { font-size: 26px; font-weight: 700; margin: 6px 0; }
.scenario-card .s-gap   { font-size: 12px; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 24px;
}
.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s;
}

/* ============================================================
   FILTER CONTROLS — Used on Accounts tab
   ============================================================ */
.filter-bar {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
  background: white;
  padding: 16px 20px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 16px;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; color: var(--gray-500); font-weight: 600; }
.filter-group select,
.filter-group .multi-select-btn {
  padding: 6px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13px;
  background: white;
  cursor: pointer;
  min-width: 130px;
}
.filter-group .multi-select-btn:hover { border-color: var(--blue); }
.filter-group .multi-select-btn.active { border-color: var(--blue); background: var(--blue-light); }
.multi-select-wrap { position: relative; }
.multi-select-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  z-index: 100;
  min-width: 180px;
  padding: 6px 0;
  margin-top: 4px;
}
.multi-select-dropdown.open { display: block; }
.multi-select-dropdown label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  color: var(--gray-900);
  font-weight: 400;
}
.multi-select-dropdown label:hover { background: var(--gray-50); }
.filter-reset {
  padding: 6px 14px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 12px;
  background: white;
  cursor: pointer;
  color: var(--gray-500);
  font-weight: 500;
  align-self: flex-end;
}
.filter-reset:hover { background: var(--gray-50); color: var(--gray-900); }
.quarter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.quarter-chip { padding: 5px 14px; border-radius: 16px; border: 1px solid var(--gray-300); background: white; font-size: 13px; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.quarter-chip:hover { border-color: var(--blue); color: var(--blue); }
.quarter-chip.active { background: var(--blue); color: white; border-color: var(--blue); }

/* ============================================================
   SORTABLE TABLE HEADERS
   ============================================================ */
thead th.sortable { cursor: pointer; user-select: none; position: relative; padding-right: 22px; }
thead th.sortable:hover { background: #243b5e; }
thead th.sortable::after { content: '⇅'; position: absolute; right: 6px; opacity: 0.4; font-size: 11px; }
thead th.sortable.sort-asc::after { content: '▲'; opacity: 0.9; }
thead th.sortable.sort-desc::after { content: '▼'; opacity: 0.9; }

/* ============================================================
   TOTALS ROW
   ============================================================ */
tr.totals-row td {
  background: var(--navy);
  color: white;
  font-weight: 700;
  font-size: 13px;
  border-top: 2px solid var(--gray-300);
}

/* ============================================================
   SALES CYCLE BAR CHART (CSS-only horizontal bars)
   ============================================================ */
.cycle-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.cycle-bar {
  height: 18px;
  border-radius: 3px;
  min-width: 2px;
  transition: width 0.3s;
}
.cycle-bar.won { background: var(--green); }
.cycle-bar.lost { background: var(--red); }
.cycle-bar.open { background: var(--blue); }
.cycle-bar-label { font-size: 12px; color: var(--gray-700); white-space: nowrap; }

/* ============================================================
   ASSUMPTIONS TAB — Editable inputs
   ============================================================ */
.assumption-card {
  background: white;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 16px;
}
.assumption-card h4 {
  font-size: 13px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 16px;
  font-weight: 600;
}
.assumption-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.assumption-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.assumption-field label {
  font-size: 12px;
  color: var(--gray-700);
  font-weight: 500;
}
.assumption-field input {
  padding: 8px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  transition: border-color 0.15s;
}
.assumption-field input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-light);
}
.assumption-field .hint { font-size: 11px; color: var(--gray-500); }
.assumption-reset {
  background: var(--gray-100);
  border: 1px solid var(--gray-300);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  margin-top: 8px;
}
.assumption-reset:hover { background: var(--gray-200); }
.assumption-totals {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--gray-50);
  border-radius: 6px;
  font-size: 13px;
}
.assumption-totals.mismatch {
  background: var(--yellow-light);
  border: 1px solid var(--yellow);
  color: #92400E;
}

/* ============================================================
   APPS SCRIPT ADDITIONS — data banner
   ============================================================ */
.data-banner {
  background: #FEF3C7; border: 1px solid var(--yellow); color: #92400E;
  border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px;
}
.data-banner.error { background: #FEE2E2; border-color: var(--red); color: #991B1B; }

/* Clean Up toolbar: data health pills (left) + refresh button (right) */
.cleanup-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0 2px;
}
.cleanup-refresh-group {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.cleanup-refresh-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; background: none; border: 1px solid var(--gray-300);
  border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 500;
  color: var(--gray-700); white-space: nowrap;
}
.cleanup-refresh-btn:hover { border-color: var(--navy); color: var(--navy); }
/* Data health signal pills */
#dataHealthBanner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500;
}
#dataHealthBanner .dh-label {
  color: var(--gray-600); font-weight: 600; margin-right: 2px; white-space: nowrap;
}
.dh-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600;
  cursor: default; white-space: nowrap;
}
.dh-pill.ok   { background: var(--green-light); color: #065F46; }
.dh-pill.warn { background: var(--yellow-light); color: #92400E; cursor: pointer; }
.dh-pill.bad  { background: var(--red-light);    color: #991B1B; cursor: pointer; }

/* ============================================================
   WEEKLY ACTIVITY — Phase 1/2 Pipeline Additions + MQL views
   ============================================================ */
/* Coverage banner (data attribution coverage, not pipeline coverage) */
.wa-coverage-banner {
  background: var(--blue-light); border: 1px solid var(--blue); color: #1E40AF;
  border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.wa-coverage-banner.warn { background: #FEF3C7; border-color: var(--yellow); color: #92400E; }
.wa-coverage-banner.bad  { background: var(--red-light); border-color: var(--red); color: #991B1B; }
.wa-coverage-banner .wa-cov-num { font-weight: 700; }

/* Sparkline chart cap — chart is orientation, not the answer */
.wa-chart-row { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }
.wa-chart-row .chart-card canvas { max-height: 160px; }
@media (max-width: 900px) { .wa-chart-row { grid-template-columns: 1fr; } }

/* Source bucket chips — each bucket gets a distinct muted color */
.src-chip {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px;
  font-weight: 600; white-space: nowrap;
}
.src-expansion    { background: #EDE9FE; color: #5B21B6; }
.src-warm-intro   { background: var(--green-light); color: #065F46; }
.src-conferences  { background: #FFEDD5; color: #9A3412; }
.src-content      { background: #DBEAFE; color: #1E40AF; }
.src-paid         { background: #FEE2E2; color: #991B1B; }
.src-organic      { background: #CCFBF1; color: #115E59; }
.src-outbound     { background: #FEF3C7; color: #92400E; }
.src-unknown      { background: var(--gray-200); color: var(--gray-700); }

/* HubSpot external link chip — used throughout clean-up + ledger rows */
.hs-link {
  display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px;
  font-weight: 600; background: var(--navy); color: white; text-decoration: none;
}
.hs-link:hover { background: var(--blue); }

/* MQL cohort grid — small-n muted rows look deliberate, not broken */
tr.wa-cohort-small td { color: var(--gray-500); font-style: italic; background: var(--gray-50); }
tr.wa-cohort-small td .wa-cohort-note { display: block; font-size: 11px; color: var(--yellow); font-style: normal; font-weight: 600; }
.wa-benchmark-note {
  background: var(--gray-50); border-left: 3px solid var(--gray-300);
  padding: 8px 14px; margin-bottom: 12px; font-size: 12px; color: var(--gray-700);
}

/* Clean Up tab — sub-tab navigation */
.cleanup-sub-tabs {
  display: flex; gap: 0; border-bottom: 2px solid var(--gray-200);
  margin: 16px 0 0;
}
.cleanup-sub-tab {
  padding: 8px 18px; font-size: 13px; font-weight: 500; cursor: pointer;
  border: none; background: none; color: var(--gray-600);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.cleanup-sub-tab:hover { color: var(--gray-900); }
.cleanup-sub-tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.cleanup-sub-panel { display: none; padding-top: 20px; }
.cleanup-sub-panel.active { display: block; }

/* Clean Up tab — action-row visual cue */
.cleanup-bucket-pill {
  display: inline-block; padding: 2px 6px; border-radius: 4px;
  background: var(--yellow-light); color: #92400E; font-size: 11px; font-weight: 600;
}
.cleanup-override-pill {
  display: inline-block; padding: 2px 6px; border-radius: 4px;
  background: var(--green-light); color: #065F46; font-size: 11px; font-weight: 600;
}

/* Evidence cell (Granola/note snippet) — italic, quoted */
td.wa-evidence { font-size: 12px; color: var(--gray-700); font-style: italic; max-width: 280px; }

/* Legacy sub-view label */
.wa-legacy-label {
  font-size: 11px; color: var(--gray-500); margin-left: 8px; font-weight: 400;
  text-transform: none; letter-spacing: 0;
}

/* ============================================================
   BOARD WEEKLY REVIEW — fully-automated, read-only artifact
   Design spec: board-weekly-review-system-design.md.
   Three bands: Pace → Matrix → Narrative.
   ============================================================ */
/* Status banner — stale data / task health / assumption diff */
.bw-status {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px;
  background: var(--green-light); border: 1px solid var(--green); color: #065F46;
}
.bw-status.stale { background: var(--yellow-light); border-color: var(--yellow); color: #92400E; }
.bw-status.broken { background: var(--red-light); border-color: var(--red); color: #991B1B; }
.bw-status .bw-status-right { font-size: 11px; opacity: 0.85; }

.bw-metric { padding: 8px 4px; }
.bw-metric-label { font-size: 11px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.04em; }
.bw-metric-value { font-size: 22px; font-weight: 700; color: var(--gray-900); margin-top: 4px; }
.bw-pace-chart { background: white; border: 1px solid var(--gray-200); border-radius: 10px; padding: 12px; }
.bw-pace-chart canvas { max-height: 220px; }
@media (max-width: 900px) { .bw-pace { grid-template-columns: 1fr; } }

/* Band 2 — Leading Indicators matrix */
.bw-matrix { font-size: 13px; border-collapse: separate; border-spacing: 0; width: 100%; }
.bw-matrix thead th {
  background: var(--gray-100); color: var(--gray-700);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 8px 6px; border-bottom: 1px solid var(--gray-300); text-align: center;
}
.bw-matrix thead th.bw-row-label-head { text-align: left; padding-left: 14px; }
.bw-matrix tbody td {
  padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--gray-100);
  font-variant-numeric: tabular-nums; font-weight: 500;
}
.bw-matrix tbody td.bw-row-label {
  text-align: left; padding-left: 14px; font-weight: 600; color: var(--gray-900);
  width: 260px; white-space: nowrap;
}
.bw-matrix tbody td.bw-row-label .bw-band-tag {
  display: inline-block; font-size: 10px; padding: 1px 6px; border-radius: 3px;
  margin-right: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  vertical-align: middle;
}
.bw-band-marketing { background: #DBEAFE; color: #1E40AF; }
.bw-band-handoff   { background: #FEF3C7; color: #92400E; }
.bw-band-sales     { background: #EDE9FE; color: #5B21B6; }
.bw-band-outcome   { background: var(--green-light); color: #065F46; }
.bw-matrix tbody td.bw-row-label-sub {
  text-align: left; padding-left: 32px; font-weight: 400; color: var(--gray-600);
  width: 260px; white-space: nowrap; font-size: 12px;
}

.bw-cell-thin {
  color: var(--gray-300); font-size: 18px; line-height: 1;
}
.bw-cell-thin[title]:hover { cursor: help; }
.bw-cell-empty { color: var(--gray-300); }
.bw-cell-ratio { font-variant-numeric: tabular-nums; }
.bw-cell-ratio .ratio-num { font-weight: 600; color: var(--gray-900); }
.bw-cell-ratio .ratio-sep { color: var(--gray-400); margin: 0 2px; font-size: 11px; }
.bw-cell-ratio .ratio-den { color: var(--gray-500); }
.bw-cell-ratio .ratio-sub { display: block; font-size: 10px; color: var(--gray-500); margin-top: 1px; }

/* Heat coloring — 5 steps, direction-aware (applied via data attributes) */
.bw-heat-1 { background: #F9FAFB; }
.bw-heat-2 { background: #ECFDF5; color: #065F46; }
.bw-heat-3 { background: #D1FAE5; color: #065F46; }
.bw-heat-4 { background: #A7F3D0; color: #064E3B; }
.bw-heat-5 { background: #6EE7B7; color: #064E3B; font-weight: 700; }
.bw-heat-cold-1 { background: #FEF2F2; color: #991B1B; }
.bw-heat-cold-2 { background: #FEE2E2; color: #991B1B; font-weight: 700; }

.bw-spark { display: inline-block; vertical-align: middle; }
.bw-spark path { fill: none; stroke: var(--blue); stroke-width: 1.5; }
.bw-spark-week-col { width: 70px; text-align: center; }
.bw-total-col { font-weight: 600; text-align: right; border-left: 2px solid #e0e0e0; padding-left: 10px; white-space: nowrap; }

/* Band 3 — Narrative */
.bw-narrative {
  background: white; border: 1px solid var(--gray-200); border-radius: 10px;
  padding: 20px 24px;
}
.bw-opener { font-size: 15px; color: var(--gray-900); line-height: 1.5; margin-bottom: 14px; font-weight: 500; }
.bw-opener.empty { color: var(--gray-500); font-style: italic; font-weight: 400; }
.bw-bullet {
  display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; align-items: start;
  padding: 10px 0; border-top: 1px solid var(--gray-100); font-size: 13px; line-height: 1.55;
}
.bw-bullet:first-child { border-top: none; }
.bw-bullet-marker { color: var(--blue); font-weight: 700; padding-top: 1px; }
.bw-bullet-text { color: var(--gray-900); }
.bw-bullet-source {
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 4px;
  background: var(--gray-100); color: var(--gray-700); text-decoration: none;
  white-space: nowrap; align-self: center;
}
.bw-bullet-source:hover { background: var(--blue-light); color: #1E40AF; }
.bw-bullet-source.none { background: var(--gray-100); color: var(--gray-500); font-style: italic; }
.bw-contradiction {
  margin-top: 14px; padding: 10px 14px; border-radius: 6px;
  background: var(--yellow-light); border-left: 3px solid var(--yellow); color: #92400E;
  font-size: 13px; line-height: 1.5;
}
.bw-contradiction strong { font-weight: 700; }
.bw-footer {
  margin-top: 18px; padding: 10px 14px; border-radius: 6px; background: var(--gray-50);
  color: var(--gray-500); font-size: 11px; line-height: 1.5; text-align: center;
}
.bw-footer strong { color: var(--gray-700); font-weight: 600; }

/* ============================================================
   DEAL ACTIVITY DRAWER — per-account inline timeline
   ============================================================ */
.account-row { cursor: pointer; }
.account-row:hover td { background: var(--gray-50); }
.account-row td:first-child::before {
  content: '▶';
  display: inline-block;
  font-size: 9px;
  margin-right: 6px;
  color: var(--gray-400);
  transition: transform 0.15s ease;
}
.account-row.drawer-open td:first-child::before {
  transform: rotate(90deg);
}
.account-drawer td { padding: 0; border-top: none !important; background: #F8FAFC; }
.drawer-body { padding: 16px 20px 20px 20px; }
.drawer-deal-section { margin-bottom: 20px; }
.drawer-deal-section:last-child { margin-bottom: 0; }
.drawer-deal-header {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 13px; font-weight: 600; color: var(--navy);
  margin-bottom: 8px; padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-200);
}
.drawer-deal-header .deal-meta { font-weight: 400; color: var(--gray-500); font-size: 12px; }
.drawer-deal-header a { color: var(--blue); font-size: 11px; margin-left: auto; }
.drawer-empty { color: var(--gray-400); font-style: italic; font-size: 12px; padding: 6px 0; }

/* ==================== DEAL INTELLIGENCE OVERLAY ==================== */
/* Clickable deal name: looks like a link, triggers the overlay */
.deal-intel-link {
  color: var(--blue); cursor: pointer; text-decoration: underline;
  text-decoration-style: dotted; text-underline-offset: 2px;
}
.deal-intel-link:hover { text-decoration-style: solid; color: #1d4ed8; }
/* Small external HubSpot arrow — visually secondary */
.hs-ext-link {
  font-size: 11px; color: var(--gray-400); text-decoration: none;
  margin-left: 3px; vertical-align: middle;
}
.hs-ext-link:hover { color: var(--blue); }

/* Overlay backdrop */
#dealIntelOverlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.5); z-index: 1000; overflow-y: auto;
}
/* Card container */
.di-card {
  background: white; border-radius: 12px; width: min(940px, 96vw);
  margin: 32px auto 60px; position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
/* Sticky header */
.di-header {
  position: sticky; top: 0; background: white; border-radius: 12px 12px 0 0;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--gray-200);
  z-index: 10;
}
.di-header-title { font-size: 18px; font-weight: 700; color: var(--navy); margin: 0 0 4px; }
.di-header-meta { font-size: 13px; color: var(--gray-500); display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.di-header-actions { position: absolute; top: 16px; right: 20px; display: flex; gap: 8px; align-items: center; }
.di-close-btn {
  background: none; border: none; cursor: pointer;
  font-size: 22px; color: var(--gray-400); line-height: 1; padding: 2px 6px;
}
.di-close-btn:hover { color: var(--navy); }
.di-hs-link { font-size: 12px; color: var(--blue); text-decoration: none; padding: 4px 10px; border: 1px solid var(--blue); border-radius: 5px; }
.di-hs-link:hover { background: var(--blue); color: white; }

/* Health strip */
.di-health-strip { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 24px; border-bottom: 1px solid var(--gray-100); }
.di-health-pill {
  padding: 4px 12px; border-radius: 16px; font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.di-health-pill.green  { background: #D1FAE5; color: #065F46; }
.di-health-pill.yellow { background: #FEF3C7; color: #92400E; }
.di-health-pill.red    { background: #FEE2E2; color: #991B1B; }
.di-health-pill.gray   { background: var(--gray-100); color: var(--gray-500); }

/* Two-column body */
.di-body { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
@media (max-width: 680px) { .di-body { grid-template-columns: 1fr; } }

/* Left / right panels — min-width:0 required to prevent CSS Grid children from overflowing track */
.di-left  { padding: 20px 20px 20px 24px; border-right: 1px solid var(--gray-100); min-width: 0; overflow-x: hidden; }
.di-right { padding: 20px 24px 20px 20px; min-width: 0; overflow-x: hidden; }

/* Section within a panel */
.di-section { margin-bottom: 20px; }
.di-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--gray-500); margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.di-ai-badge {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  background: #EDE9FE; color: #5B21B6; border-radius: 4px; padding: 1px 5px;
}
.di-refresh-btn {
  font-size: 11px; color: var(--blue); background: none; border: none;
  cursor: pointer; padding: 0; margin-left: auto;
}
.di-refresh-btn:hover { text-decoration: underline; }
.di-refresh-btn:disabled { color: var(--gray-400); cursor: default; }

/* Full-width exec narrative (Box 1) — replaces old .di-exec-summary in left column */
.di-exec-narrative {
  padding: 16px 24px; border-bottom: 1px solid var(--gray-100);
  font-size: 14px; line-height: 1.7; color: var(--navy);
  overflow-wrap: break-word; word-break: break-word;
}
/* Backward compat: legacy plain-text exec summary shown if new dealNarrative absent */
.di-exec-summary { font-size: 13px; line-height: 1.6; color: var(--gray-700); }
/* Inline highlight tags for dealNarrative */
.di-hl-status  { font-weight: 700; }
.di-hl-risk    { background: #FEE2E2; color: #991B1B; padding: 1px 6px; border-radius: 3px; }
.di-hl-next    { background: #DBEAFE; color: #1E40AF; padding: 1px 6px; border-radius: 3px; }
.di-hl-blocker { background: #FEF3C7; color: #92400E; padding: 1px 6px; border-radius: 3px; }

/* Buying committee (appears above AI narrative, renders immediately) */
.di-buying-committee {
  padding: 12px 24px; border-bottom: 1px solid var(--gray-100);
  background: #fff;
}
.di-bc-header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.di-bc-score { font-size: 11px; font-weight: 600; }
.di-bc-hs-link { font-size: 11px; color: var(--blue); text-decoration: none; margin-left: auto; }
.di-bc-hs-link:hover { text-decoration: underline; }
.di-bc-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.di-bc-table tr { border-bottom: 1px solid var(--gray-100); }
.di-bc-table tr:last-child { border-bottom: none; }
.di-bc-role { padding: 4px 12px 4px 0; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-500); white-space: nowrap; width: 140px; }
.di-bc-name { padding: 4px 12px 4px 0; font-weight: 600; color: var(--navy); }
.di-bc-title { padding: 4px 0; color: var(--gray-500); }
.di-bc-missing td { opacity: 0.7; }
.di-bc-unassigned { color: var(--gray-400); font-style: italic; }
.di-bc-empty { font-size: 12px; color: var(--gray-400); font-style: italic; }
.di-bc-unlabeled { font-size: 11px; color: var(--gray-400); margin-top: 6px; }

/* Role dots in pipeline table (buying committee completeness indicator) */
.role-dots { display: inline-flex; gap: 3px; margin-left: 8px; vertical-align: middle; }
.role-dot { font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 3px; cursor: default; }
.role-dot.filled { background: #D1FAE5; color: #065F46; }
.role-dot.empty  { background: var(--gray-100); color: var(--gray-400); }

/* Situational awareness (Box 2) */
.di-sit-awareness {
  padding: 14px 24px; border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50); display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px;
}
@media (max-width: 680px) { .di-sit-awareness { grid-template-columns: 1fr; } }
.di-sit-col { min-width: 0; }
.di-sit-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-500); margin: 8px 0 4px; }
.di-sit-label:first-child { margin-top: 0; }
.di-sit-row { font-size: 12px; line-height: 1.5; margin-bottom: 3px; overflow-wrap: break-word; word-break: break-word; }
.di-sit-name  { font-weight: 600; color: var(--navy); }
.di-sit-meta  { color: var(--gray-500); }
.di-sit-warn  { color: var(--red); font-weight: 600; }
.di-sit-tag   { display: inline-block; background: #FEF3C7; color: #92400E; padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; margin: 2px 3px 2px 0; }

/* BANT grid */
.di-bant-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.di-bant-cell { border: 1px solid var(--gray-200); border-radius: 8px; padding: 10px 12px; }
.di-bant-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-500); margin-bottom: 4px; }
.di-bant-status { font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.di-bant-status.Confirmed { color: var(--green); }
.di-bant-status.Signals   { color: #D97706; }
.di-bant-status.Unknown   { color: var(--gray-500); }
.di-bant-status.Blocked   { color: var(--red); }
/* Truncate BANT evidence to ~2 lines; expand on click */
.di-bant-evidence {
  font-size: 12px; color: var(--gray-500); line-height: 1.4;
  max-height: 2.8em; overflow: hidden; transition: max-height 0.2s ease; cursor: pointer;
}
.di-bant-evidence.expanded { max-height: none; }
.di-bant-evidence-toggle { font-size: 11px; color: var(--blue); cursor: pointer; margin-top: 2px; display: inline-block; }

/* Key insight highlight box */
.di-key-insight {
  background: #F0FDF4; border: 1px solid #BBF7D0; border-radius: 8px;
  padding: 12px 14px; font-size: 13px; line-height: 1.5; color: #14532D;
}

/* Risks list */
.di-risk-item {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 13px; color: var(--gray-700); margin-bottom: 6px; line-height: 1.4;
}
.di-risk-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.di-risk-icon.high   { color: var(--red); }
.di-risk-icon.medium { color: #D97706; }
.di-risk-icon.low    { color: var(--gray-400); }

/* Next actions */
.di-action-item {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 13px; color: var(--gray-700); margin-bottom: 6px; line-height: 1.4;
}
.di-action-arrow { color: var(--blue); font-weight: 700; flex-shrink: 0; }

/* Account plan context box */
.di-account-plan {
  background: var(--gray-50); border: 1px solid var(--gray-200); border-radius: 8px; padding: 12px 14px;
}
.di-account-plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; font-size: 12px; margin-bottom: 8px; }
.di-account-plan-label { color: var(--gray-500); }
.di-account-plan-value { font-weight: 600; color: var(--navy); }
.di-edit-plan-btn {
  font-size: 12px; color: var(--blue); background: none; border: none;
  cursor: pointer; padding: 0; text-decoration: underline;
}

/* Activity timeline */
.di-timeline { max-height: 520px; overflow-y: auto; }
/* Type filter pills */
.di-timeline-filters { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.di-tf-pill {
  padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--gray-200); background: white; color: var(--gray-500);
  white-space: nowrap;
}
.di-tf-pill.active { background: var(--navy); color: white; border-color: var(--navy); }
.di-activity-item {
  border-bottom: 1px solid var(--gray-100); padding: 12px 0;
  font-size: 13px;
}
.di-activity-item:last-child { border-bottom: none; }
.di-activity-header { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.di-activity-type {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 7px; border-radius: 4px; flex-shrink: 0;
}
.di-type-meeting { background: #DBEAFE; color: #1E40AF; }
.di-type-call    { background: #D1FAE5; color: #065F46; }
.di-type-email   { background: #FEF3C7; color: #92400E; }
.di-type-note    { background: var(--gray-100); color: var(--gray-600); }
.di-activity-date { font-size: 12px; color: var(--gray-400); }
/* word-wrap on all text content to prevent overflow past column edge */
.di-activity-subject { font-weight: 600; color: var(--navy); overflow-wrap: break-word; word-break: break-word; }
.di-activity-meta { font-size: 12px; color: var(--gray-500); margin-bottom: 4px; overflow-wrap: break-word; word-break: break-word; }
.di-activity-excerpt {
  font-size: 12px; color: var(--gray-600); line-height: 1.5;
  max-height: 2.8em; overflow: hidden; transition: max-height 0.2s ease;
  cursor: pointer; overflow-wrap: break-word; word-break: break-word;
}
.di-activity-excerpt.expanded { max-height: 600px; }
.di-activity-excerpt-toggle { font-size: 11px; color: var(--blue); cursor: pointer; margin-top: 2px; display: inline-block; }
.di-granola-link { font-size: 11px; color: var(--blue); text-decoration: none; margin-left: 8px; }
.di-granola-link:hover { text-decoration: underline; }
.di-email-dir { font-size: 11px; color: var(--gray-400); }

/* Loading skeleton */
.di-loading { padding: 20px 0; text-align: center; color: var(--gray-400); font-size: 13px; font-style: italic; }
.di-error { padding: 10px 14px; background: #FEE2E2; color: #991B1B; border-radius: 6px; font-size: 13px; }

/* Footer */
.di-footer {
  padding: 12px 24px; border-top: 1px solid var(--gray-100); border-radius: 0 0 12px 12px;
  font-size: 11px; color: var(--gray-400); display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
}
.di-footer-refresh { color: var(--blue); cursor: pointer; background: none; border: none; font-size: 11px; padding: 0; }
.di-footer-refresh:hover { text-decoration: underline; }
