:root {
  --red:      #B80000;
  --red-dk:   #9a0000;
  --blue:     #30638C;
  --green:    #00788C;
  --gold:     #EDAD4A;
  --gold-dk:  #D88B25;
  --night:    #08222D;
  --charcoal: #1a1a1a;
  --gray-75:  #B0AAA0;
  --page-bg:  #0d1e28;
  --gray-bg:  rgba(255,255,255,0.06);
  --gray-lt:  #F5F3EF;
  --gray-bd:  #E8E4DC;
  --text:     #1C1C1C;
  --muted:    #767676;
  --white:    #fff;
  --risk:     #C0392B;
  --risk-bg:  #FDF0EF;
  --risk-bd:  #F5C6C6;
  --watch:    #B7770D;
  --watch-bg: #FEFAED;
  --watch-bd: #F5E4A0;
  --opp:      #1A7A5E;
  --opp-bg:   #EDF7F4;
  --opp-bd:   #A8DDD0;

  /* Spacing scale */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-7:  28px;
  --space-8:  32px;

  /* Elevation */
  --shadow-sm:  0 1px 4px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.12);
  --shadow-lg:  0 8px 40px rgba(0,0,0,.22);
  --shadow-xl:  0 24px 80px rgba(0,0,0,.35);

  /* Motion */
  --ease-out:        cubic-bezier(0.4, 0, 0.2, 1);
  --transition-sm:   0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Manrope', sans-serif;
  background: var(--page-bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

@keyframes fadeIn  { from { opacity:0; transform:translateY(6px) } to { opacity:1; transform:translateY(0) } }
@keyframes slideUp { from { opacity:0; transform:translateY(12px) } to { opacity:1; transform:translateY(0) } }
@keyframes popIn   { 0% { opacity:0; transform:scale(.96) translateY(4px) } 100% { opacity:1; transform:scale(1) translateY(0) } }
@keyframes shimmer { 0% { background-position:-600px 0 } 100% { background-position:600px 0 } }
@keyframes badgePop { 0% { opacity:0; transform:scale(0.6) } 60% { transform:scale(1.12) } 100% { opacity:1; transform:scale(1) } }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 10px; }

button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 6px;
  box-shadow: 0 0 0 4px rgba(48,99,140,0.15);
}

/* ── Header ── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8,34,45,0.92);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
}
.header-main-row {
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 14px;
}

.logo { display: flex; align-items: center; }
.logo img { height: 28px; width: auto; display: block; }
.header-divider { width: 1px; height: 22px; background: rgba(255,255,255,0.12); }
.header-title { font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.55); letter-spacing: 0.3px; flex: 1; }

.user-pill {
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50px;
  padding: 5px 12px 5px 6px;
}

.user-pill img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }

.user-pill span {
  font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.8);
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.sign-out-btn {
  background: transparent; border: 1.5px solid rgba(255,255,255,0.2); border-radius: 50px;
  color: rgba(255,255,255,0.65); font-family: 'Manrope', sans-serif; font-size: 11px; font-weight: 700;
  padding: 4px 12px; cursor: pointer; transition: all 0.15s;
  margin-left: 6px; text-transform: uppercase; letter-spacing: 0.4px;
}
.sign-out-btn:hover { border-color: var(--red); color: var(--red); }

/* Digest button in header */
.digest-btn {
  background: transparent; border: 1.5px solid rgba(255,255,255,0.2); border-radius: 50px;
  color: rgba(255,255,255,0.65); font-family: 'Manrope', sans-serif; font-size: 11px; font-weight: 700;
  padding: 4px 12px; cursor: pointer; transition: all 0.15s;
  text-transform: uppercase; letter-spacing: 0.4px;
}
.digest-btn:hover { border-color: var(--gold-dk); color: var(--gold); }
.digest-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.manage-agencies-btn {
  background: var(--gold); border: none; border-radius: 50px;
  color: var(--night); font-family: 'Manrope', sans-serif; font-size: 11px; font-weight: 800;
  padding: 5px 14px; cursor: pointer; transition: background 0.15s;
  text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap;
}
.manage-agencies-btn:hover { background: var(--gold-dk); }
.manage-agencies-btn.active { background: var(--night); color: var(--gold); outline: 2px solid var(--gold); }

/* ── Login Screen ── */
#loginScreen {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - 56px); padding: 40px 20px;
}

.login-card {
  background: var(--white); border-radius: 20px;
  box-shadow: var(--shadow-xl); padding: 48px 44px;
  width: 100%; max-width: 420px; text-align: center;
  animation: popIn var(--transition-base) ease forwards;
}

.login-logo { margin-bottom: 12px; }
.login-logo img { height: 40px; width: auto; }
.login-card h1 { font-size: 17px; font-weight: 700; color: #08222D; margin-bottom: 6px; }
.login-card p { font-size: 13px; color: var(--muted); margin-bottom: 32px; line-height: 1.6; }
.google-btn-wrap { display: flex; justify-content: center; }
.login-note { margin-top: 20px; font-size: 12px; color: var(--gray-75); }

/* ── App ── */
#appScreen { display: none; }

/* ── Tab Nav ── */
.tab-nav {
  display: flex; gap: 2px; max-width: 960px;
  margin: 24px auto 0; padding: 0 20px;
}

.tab-btn {
  padding: 9px 20px; border: none; border-radius: 6px 6px 0 0;
  font-family: 'Manrope', sans-serif; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px; cursor: pointer;
  background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.4);
  border: 1px solid rgba(255,255,255,0.06); border-bottom: none;
  transition: background var(--transition-sm), color var(--transition-sm);
}

.tab-btn:hover { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.7); }
.tab-btn.active { background: var(--white); color: var(--night); border-color: transparent; }

/* ── Layout ── */
main {
  max-width: 960px; margin: 0 auto; padding: 0 20px 40px;
  background: var(--white); border-radius: 0 0 12px 12px;
  box-shadow: var(--shadow-lg);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; padding-top: 20px; animation: fadeIn .25s ease; }

/* ── Card ── */
.card {
  background: var(--white); border: 1px solid var(--gray-bd);
  border-radius: 8px; box-shadow: var(--shadow-sm);
  padding: var(--space-7) 30px; margin-bottom: var(--space-5);
}

.card-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--muted); margin-bottom: 20px;
}

/* ── Form ── */
label {
  display: block; font-size: 12px; font-weight: 600; color: var(--muted);
  margin-bottom: 5px; margin-top: 16px; text-transform: uppercase; letter-spacing: 0.4px;
}

label:first-of-type { margin-top: 0; }

input[type="text"] {
  width: 100%; padding: 10px 13px; background: var(--gray-lt);
  border: 1px solid var(--gray-bd); border-radius: 6px;
  font-family: 'Manrope', sans-serif; font-size: 14px; color: var(--text);
  transition: border-color 0.18s;
}

input[type="text"]:focus { outline: none; border-color: var(--gold-dk); background: var(--white); }

/* ── Buttons ── */
#runBtn {
  margin-top: 22px; width: 100%; padding: 12px 24px;
  background: var(--red); color: var(--white); border: none; border-radius: 50px;
  font-family: 'Manrope', sans-serif; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px; cursor: pointer; transition: background 0.18s;
}

#runBtn:hover:not(:disabled) { background: var(--red-dk); }
#runBtn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Progress ── */
#progressCard { display: none; }

.step-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }

.step {
  display: flex; align-items: center; gap: 12px;
  font-size: 14px; font-weight: 500; color: var(--gray-75);
}

.step .badge {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--gray-bd);
  background: var(--white); display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0; color: var(--gray-75); transition: all 0.25s;
}

.step.active .badge { border-color: var(--red); background: var(--red); color: var(--white); animation: pulse 1.1s infinite; }
.step.active { color: var(--text); font-weight: 600; }
.step.done .badge { border-color: var(--green); background: var(--green); color: var(--white); }
.step.done { color: var(--green); }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184,0,0,.35); }
  50%       { box-shadow: 0 0 0 6px rgba(184,0,0,.0); }
}

/* ── Error ── */
#errorBox {
  display: none; background: #fff5f5; border: 1px solid #f5c6cb;
  color: var(--red-dk); border-radius: 7px; padding: 13px 16px;
  font-size: 13px; margin-bottom: 20px; font-weight: 500;
}

/* ── Results (Generate tab) ── */
#resultsCard { display: none; }

.briefing-meta { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--gray-bg); }
.briefing-meta h1 { font-size: 22px; font-weight: 800; color: var(--night); }
.briefing-meta .date { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 500; }

.section-block { margin-bottom: 22px; padding-bottom: 22px; border-bottom: 1px solid var(--gray-lt); }
.section-block:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.section-block h3 {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--muted); margin-bottom: 9px;
}

.section-block p, .section-block li { font-size: 14px; line-height: 1.75; color: var(--text); font-weight: 400; }
.section-block ul { padding-left: 18px; }
.section-block li { margin-bottom: 4px; }

.talking-points { list-style: none; padding: 0; }
.talking-points li {
  background: var(--gray-lt); border-left: 3px solid var(--red);
  border-radius: 0 5px 5px 0; padding: 9px 13px; margin-bottom: 8px;
  font-size: 14px; font-weight: 500; line-height: 1.6; color: var(--text);
}

.sources-list { list-style: none; padding: 0; }
.sources-list li { margin-bottom: 6px; }
.sources-list a { color: var(--blue); font-size: 13px; font-weight: 500; text-decoration: none; word-break: break-all; }
.sources-list a:hover { text-decoration: underline; }

/* ── News item list ── */
.news-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.news-item {
  display: flex; gap: 12px; align-items: baseline;
  padding: 9px 12px; background: var(--gray-lt);
  border-radius: 6px; border-left: 3px solid var(--blue);
}
.news-item.news-positive { border-left-color: #27AE60; background: #f0faf4; }
.news-item.news-negative { border-left-color: #E74C3C; background: #fff5f5; }
.news-item.news-neutral  { border-left-color: var(--muted); }
.news-sentiment-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  flex-shrink: 0; align-self: center; margin-top: -1px;
}
.news-positive .news-sentiment-dot { background: #27AE60; }
.news-negative .news-sentiment-dot { background: #E74C3C; }
.news-neutral  .news-sentiment-dot { background: var(--muted); }

.news-date {
  font-size: 11px; font-weight: 700; color: var(--muted);
  white-space: nowrap; text-transform: uppercase; letter-spacing: .3px;
  flex-shrink: 0; min-width: 90px;
}

.news-text { font-size: 13px; color: var(--text); line-height: 1.55; font-weight: 400; }

.news-source-link {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--blue);
  text-decoration: none; margin-left: 6px;
  padding: 1px 6px; border-radius: 4px; border: 1px solid var(--blue);
  vertical-align: middle; white-space: nowrap;
}

.news-outreach-hint {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--muted); margin-bottom: 8px;
}
.news-item-checkable {
  display: flex; align-items: flex-start; gap: 10px; cursor: pointer;
  transition: opacity 0.15s;
}
.news-item-checkable:has(.news-cb:not(:checked)) { opacity: 0.4; }
.news-cb {
  width: 16px; height: 16px; flex-shrink: 0; margin-top: 3px;
  cursor: pointer; accent-color: var(--gold-dk);
}
.news-cb-label { cursor: pointer; flex: 1; display: flex; gap: 12px; align-items: baseline; }

.news-source-link:hover { background: var(--blue); color: #fff; text-decoration: none; }
.news-empty { font-size: 13px; color: var(--muted); font-style: italic; }

/* ── Agency List tab ── */
.agency-list { list-style: none; padding: 0; margin: 0; }

.agency-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--gray-lt);
}

.agency-row:last-child { border-bottom: none; }

.agency-row-info { flex: 1; min-width: 0; }
.agency-name { font-size: 14px; font-weight: 600; color: var(--text); }

.agency-meta-row {
  display: flex; align-items: center; gap: 8px; margin-top: 3px; flex-wrap: wrap;
}

.agency-last-briefed { font-size: 11px; color: var(--gray-75); font-weight: 500; }

.agency-last-score {
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 50px;
}

.agency-last-score.risk  { background: var(--risk-bg);  color: var(--risk);  }
.agency-last-score.opp   { background: var(--opp-bg);   color: var(--opp);   }
.agency-last-score.watch { background: var(--watch-bg); color: var(--watch); }
.agency-last-score.neutral { background: var(--gray-lt); color: var(--muted); }

.agency-btn {
  border: none; border-radius: 50px; font-family: 'Manrope', sans-serif;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  padding: 0 12px; height: 28px; box-sizing: border-box;
  cursor: pointer; transition: background 0.18s, color 0.18s;
  white-space: nowrap;
}

.agency-btn.generate { background: var(--red); color: var(--white); }
.agency-btn.generate:hover { background: var(--red-dk); }
.agency-btn.remove { background: var(--gray-lt); color: var(--muted); }
.agency-btn.remove:hover { background: #f5c6cb; color: var(--red-dk); }
.agency-btn.edit { height: 20px; font-size: 10px; padding: 0 6px; text-transform: none; letter-spacing: 0; background: var(--gray-lt); color: var(--muted); border: 1px solid var(--gray-bd); }

select.agency-select {
  padding: 0 8px; height: 28px; box-sizing: border-box;
  border: 1px solid var(--gray-bd); border-radius: 6px;
  font-family: 'Manrope', sans-serif; font-size: 11px; font-weight: 600;
  color: var(--muted); background: var(--gray-lt); cursor: pointer;
  transition: border-color 0.18s;
}

select.agency-select:focus { outline: none; border-color: var(--blue); }

.add-agency-row { display: flex; gap: 10px; margin-top: 16px; align-items: center; }
.add-agency-row input { flex: 1; margin: 0; }

.track-agency-row { display: flex; gap: 10px; align-items: center; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--gray-bd); }
.track-agency-btn {
  flex: 1; padding: 11px 20px; background: var(--gold); color: var(--night);
  border: none; border-radius: 50px; font-family: 'Manrope', sans-serif;
  font-size: 13px; font-weight: 800; cursor: pointer; transition: background 0.18s;
  letter-spacing: .3px;
}
.track-agency-btn:hover { background: var(--gold-dk); }
.track-agency-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.track-agency-btn.already-tracked {
  background: var(--gray-lt); color: var(--muted); cursor: default;
}

/* ── Watchlist toggle button ── */
.watchlist-btn {
  border: 1.5px solid var(--gray-bd); border-radius: 50px; background: transparent;
  font-family: 'Manrope', sans-serif; font-size: 11px; font-weight: 700;
  padding: 0 11px; height: 28px; box-sizing: border-box;
  cursor: pointer; color: var(--muted);
  transition: all 0.15s; white-space: nowrap; letter-spacing: .3px;
}
.watchlist-btn:hover { border-color: var(--gold-dk); color: var(--gold-dk); }
.watchlist-btn.on {
  background: var(--gold); border-color: var(--gold); color: var(--night);
}
.watchlist-btn.on:hover { background: var(--gold-dk); border-color: var(--gold-dk); }

.add-agency-btn {
  padding: 10px 18px; background: var(--red); border: none;
  border-radius: 50px; font-family: 'Manrope', sans-serif; font-size: 12px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--white); cursor: pointer; white-space: nowrap;
  transition: background 0.18s;
}

.add-agency-btn:hover { background: var(--red-dk); }
.agencies-empty { font-size: 13px; color: var(--muted); text-align: center; padding: 16px 0; }

/* ── Agency inline edit ── */
.agency-edit-wrap { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.agency-edit-input {
  font-family: 'Manrope', sans-serif; font-size: 14px; font-weight: 600;
  border: 1.5px solid var(--blue); border-radius: 6px; padding: 3px 8px;
  color: var(--text); background: var(--white); min-width: 0; width: 180px;
}
.agency-btn.edit {
  background: transparent; color: var(--muted);
  border: 1px solid var(--gray-bd); font-size: 13px; padding: 3px 7px;
}
.agency-btn.edit:hover { color: var(--blue); border-color: var(--blue); }

/* ── Validation confirm banner ── */
.validate-confirm {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: rgba(237,173,74,0.1); border: 1px solid var(--gold-dk);
  border-radius: 10px; padding: 11px 16px; margin-top: 10px;
  animation: fadeIn 0.2s ease;
}
.validate-confirm-text { flex: 1; font-size: 13px; font-weight: 500; color: var(--text); min-width: 180px; }
.validate-confirm-text strong { font-weight: 700; }
.validate-confirm-text a { color: var(--blue); text-decoration: none; }
.validate-confirm-text a:hover { text-decoration: underline; }
.validate-confirm-actions { display: flex; gap: 8px; }
.validate-yes-btn {
  padding: 6px 14px; background: var(--opp); color: var(--white);
  border: none; border-radius: 50px; font-family: 'Manrope', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: .4px; cursor: pointer;
  transition: background 0.18s;
}
.validate-yes-btn:hover { background: #15664e; }
.validate-no-btn {
  padding: 6px 14px; background: var(--gray-lt); color: var(--muted);
  border: none; border-radius: 50px; font-family: 'Manrope', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: .4px; cursor: pointer;
  transition: background 0.18s;
}
.validate-no-btn:hover { background: #e8e4dc; }

/* ── Network & Client roster ── */
.network-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  background: rgba(48,99,140,0.1); color: var(--blue); border: 1px solid rgba(48,99,140,0.25);
  border-radius: 50px; padding: 2px 9px; cursor: default;
}
.network-badge.independent { background: rgba(118,118,118,0.1); color: var(--muted); border-color: var(--gray-bd); }
.client-roster { display: flex; flex-wrap: wrap; gap: 6px; }
.client-chip {
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 50px;
  background: var(--gray-lt); color: var(--text); border: 1px solid var(--gray-bd);
  display: inline-flex; align-items: center; gap: 4px;
}
.client-chip.aor {
  background: rgba(8,34,45,0.06); border-color: rgba(8,34,45,0.2); color: var(--night); font-weight: 700;
}
.client-chip .aor-dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--blue); flex-shrink: 0;
}
.client-chip-sub {
  font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px;
  color: var(--muted); margin-left: 4px; opacity: 0.8;
}
.client-chip.aor .client-chip-sub { color: var(--blue); opacity: 0.9; }
.client-chip-year {
  font-size: 9px; font-weight: 700; margin-left: 5px;
  padding: 1px 5px; border-radius: 50px;
}
.client-chip-year.fresh  { background: var(--opp-bg);  color: var(--opp);  border: 1px solid var(--opp-bd); }
.client-chip-year.recent { background: var(--gray-lt); color: var(--muted); border: 1px solid var(--gray-bd); }
.client-chip-year.stale  { background: var(--watch-bg); color: var(--watch); border: 1px solid var(--watch-bd); }
.client-chip.clickable { cursor: pointer; }
.client-chip.clickable:hover { background: rgba(48,99,140,0.1); border-color: rgba(48,99,140,0.3); }
.client-empty { font-size: 13px; color: var(--muted); font-style: italic; }

/* ── Client Health Modal ── */
.ch-overlay {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8,34,45,0.55); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.ch-overlay.open { opacity: 1; pointer-events: all; }
.ch-modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 480px;
  max-height: 85vh; overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  transform: translateY(12px) scale(0.98); transition: transform 0.2s;
}
.ch-overlay.open .ch-modal { transform: none; }
.ch-modal-head {
  padding: 20px 22px 16px; border-bottom: 1px solid var(--gray-bd);
  display: flex; align-items: flex-start; gap: 14px;
}
.ch-score-badge {
  width: 44px; height: 44px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 800;
}
.ch-score-badge.risk    { background: var(--risk-bg);  color: var(--risk);  border: 1.5px solid var(--risk-bd); }
.ch-score-badge.watch   { background: var(--watch-bg); color: var(--watch); border: 1.5px solid var(--watch-bd); }
.ch-score-badge.opp     { background: var(--opp-bg);   color: var(--opp);   border: 1.5px solid var(--opp-bd); }
.ch-score-badge.neutral { background: var(--gray-lt);  color: var(--muted); border: 1.5px solid var(--gray-bd); }
.ch-head-info { flex: 1; min-width: 0; }
.ch-brand-name { font-size: 17px; font-weight: 800; color: var(--night); margin-bottom: 2px; }
.ch-score-reason { font-size: 12px; color: var(--muted); line-height: 1.4; }
.ch-close { background: none; border: none; font-size: 18px; color: var(--muted);
  cursor: pointer; padding: 0; line-height: 1; flex-shrink: 0; }
.ch-close:hover { color: var(--night); }
.ch-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.ch-agency-risk {
  background: rgba(237,173,74,0.1); border: 1px solid rgba(237,173,74,0.35);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 16px;
  font-size: 12px; font-weight: 600; color: var(--charcoal); line-height: 1.5;
}
.ch-agency-risk::before { content: "⚡ Agency impact: "; font-weight: 800; color: var(--watch); }
.ch-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); margin-bottom: 8px;
}
.ch-news-item {
  display: flex; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--gray-bd); font-size: 12px; line-height: 1.5;
}
.ch-news-item:last-child { border-bottom: none; }
.ch-news-date { color: var(--muted); white-space: nowrap; flex-shrink: 0; font-size: 11px; }
.ch-news-text { color: var(--charcoal); }
.ch-news-text a { color: var(--blue); text-decoration: none; }
.ch-news-text a:hover { text-decoration: underline; }
.ch-flags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 14px; }
.ch-flag {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  padding: 3px 9px; border-radius: 50px;
}
.ch-flag.positive { background: var(--opp-bg);  color: var(--opp);  border: 1px solid var(--opp-bd); }
.ch-flag.negative { background: var(--risk-bg); color: var(--risk); border: 1px solid var(--risk-bd); }
.ch-flag.neutral  { background: var(--gray-lt); color: var(--muted); border: 1px solid var(--gray-bd); }
.ch-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 0; gap: 12px; color: var(--muted); font-size: 13px;
}
.ch-spinner {
  width: 28px; height: 28px; border: 3px solid var(--gray-bd);
  border-top-color: var(--blue); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Network filter bar ── */
.network-filter-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 0 4px; margin-bottom: 4px;
}
.network-filter-bar-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); margin-right: 2px; white-space: nowrap;
}
.network-pill {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  padding: 4px 11px; border-radius: 50px; border: 1px solid rgba(48,99,140,0.25);
  background: rgba(48,99,140,0.07); color: var(--blue); cursor: pointer;
  transition: all 0.15s; white-space: nowrap; user-select: none;
}
.network-pill:hover { background: rgba(48,99,140,0.14); }
.network-pill.active {
  background: var(--blue); color: #fff; border-color: var(--blue);
}
.network-pill.independent {
  background: rgba(118,118,118,0.07); color: var(--muted); border-color: var(--gray-bd);
}
.network-pill.independent.active {
  background: var(--muted); color: #fff; border-color: var(--muted);
}
.network-pill-count {
  display: inline-block; margin-left: 4px; font-size: 10px; opacity: 0.75;
}

/* ── This Week / Diff view ── */
.diff-section { margin-bottom: 28px; }
.diff-section-header {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.diff-section-header .diff-count {
  background: var(--night); color: var(--white); border-radius: 50px;
  font-size: 10px; padding: 1px 7px; font-weight: 700;
}
.diff-row {
  background: var(--white); border: 1px solid var(--gray-bd); border-radius: 10px;
  padding: 14px 18px; margin-bottom: 8px; display: flex; align-items: center;
  gap: 14px; cursor: pointer; transition: box-shadow 0.15s;
  animation: fadeIn 0.25s ease backwards;
}
.diff-row:hover { box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.diff-score-change {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.diff-arrow { font-size: 14px; color: var(--muted); }
.diff-arrow.up   { color: var(--opp); }
.diff-arrow.down { color: var(--risk); }
.diff-delta {
  font-size: 12px; font-weight: 800; padding: 3px 8px;
  border-radius: 50px; flex-shrink: 0;
}
.diff-delta.up   { background: var(--opp-bg);  color: var(--opp);  border: 1px solid var(--opp-bd); }
.diff-delta.down { background: var(--risk-bg); color: var(--risk); border: 1px solid var(--risk-bd); }
.diff-delta.none { background: var(--gray-lt); color: var(--muted); border: 1px solid var(--gray-bd); }
.diff-info { flex: 1; min-width: 0; }
.diff-agency-name { font-size: 14px; font-weight: 700; color: var(--night); margin-bottom: 3px; }
.diff-reason { font-size: 12px; color: var(--muted); line-height: 1.4; }
.diff-flags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.diff-flag-new {
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 50px;
  background: #FFF3CD; color: #856404; border: 1px solid #FFDDA0;
}
.diff-flag-gone {
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 50px;
  background: var(--gray-lt); color: var(--muted); border: 1px solid var(--gray-bd);
  text-decoration: line-through;
}
.diff-updated { font-size: 11px; color: var(--gray-75); flex-shrink: 0; }
.diff-no-change { color: var(--muted); font-size: 13px; text-align: center; padding: 20px; }
.diff-new-badge {
  font-size: 10px; font-weight: 700; background: var(--blue); color: var(--white);
  border-radius: 50px; padding: 2px 8px; flex-shrink: 0;
}

/* ── Skeleton loaders ── */
.skeleton-shimmer {
  background: linear-gradient(90deg, #eee 25%, #e0e0e0 50%, #eee 75%);
  background-size: 600px 100%; animation: shimmer 1.4s infinite; border-radius: 6px;
}
.skeleton-cards { display: flex; flex-direction: column; gap: 10px; }
.skeleton-card {
  background: var(--white); border: 1px solid var(--gray-bd); border-radius: 12px;
  padding: 18px 20px; display: flex; align-items: center; gap: 14px;
  animation: fadeIn 0.3s ease backwards;
}
.skeleton-badge { width: 44px; height: 44px; border-radius: 8px; flex-shrink: 0; }
.skeleton-lines { flex: 1; display: flex; flex-direction: column; gap: 9px; }
.skeleton-line { height: 10px; border-radius: 4px; }
.skeleton-line.w-55 { width: 55%; }
.skeleton-line.w-35 { width: 35%; }
.skeleton-line.w-70 { width: 70%; }
.skeleton-sparkline { width: 80px; height: 32px; border-radius: 4px; flex-shrink: 0; }

/* ── Portfolio health bar ── */
.health-bar {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 20px;
}
.health-stat {
  background: var(--white); border: 1px solid var(--gray-bd); border-radius: 10px;
  padding: 14px 16px; text-align: center; animation: fadeIn 0.3s ease backwards;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: box-shadow 0.18s, transform 0.18s, border-color 0.18s;
}
.health-stat::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--gray-bd); border-radius: 10px 10px 0 0;
  transition: background 0.18s;
}
.health-stat.clickable { cursor: pointer; }
.health-stat.clickable:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.health-stat.clickable:hover::before { background: var(--blue); }
.health-stat.stat-risk::before  { background: var(--risk); }
.health-stat.stat-opp::before   { background: var(--opp); }
.health-stat.stat-watch::before { background: var(--gold-dk); }
.health-stat.active { border-color: transparent; box-shadow: var(--shadow-md); }
.health-stat.stat-risk.active  { background: var(--risk-bg);  border-color: var(--risk-bd); }
.health-stat.stat-opp.active   { background: var(--opp-bg);   border-color: var(--opp-bd); }
.health-stat.stat-watch.active { background: var(--watch-bg); border-color: var(--watch-bd); }
.health-stat-value {
  font-size: 28px; font-weight: 800; color: var(--night); line-height: 1; margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}
.health-stat-value.risk { color: var(--risk); }
.health-stat-value.opp  { color: var(--opp); }
.health-stat-value.gold { color: var(--gold-dk); }
.health-stat-label {
  font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px;
}
.health-stat-hint {
  font-size: 9px; color: var(--blue); font-weight: 600; margin-top: 4px;
  opacity: 0; transition: opacity 0.15s;
}
.health-stat.clickable:hover .health-stat-hint { opacity: 1; }
.health-stat.active .health-stat-hint { opacity: 1; color: var(--muted); }

/* ── Freshness indicator ── */
.freshness-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  margin-right: 4px; flex-shrink: 0; vertical-align: middle;
}
.freshness-dot.fresh  { background: var(--opp); }
.freshness-dot.recent { background: var(--gold-dk); }
.freshness-dot.stale  { background: #E67E22; }
.freshness-dot.old    { background: var(--risk); }

/* ── Sparkline ── */
.dash-sparkline { flex-shrink: 0; display: block; }

/* ── Score badge pop animation ── */
.score-badge.animated { animation: badgePop 0.5s ease backwards; }

/* ── First-time empty state hero ── */
.dash-empty-hero {
  text-align: center; padding: 64px 32px;
  background: var(--white); border-radius: 14px; border: 1px solid var(--gray-bd);
  animation: fadeIn 0.3s ease;
}
.dash-empty-hero-icon { font-size: 52px; margin-bottom: 18px; line-height: 1; }
.dash-empty-hero h2 { font-size: 20px; font-weight: 800; color: var(--night); margin-bottom: 10px; }
.dash-empty-hero p { font-size: 14px; color: var(--muted); margin-bottom: 28px; line-height: 1.7; max-width: 440px; margin-left: auto; margin-right: auto; }
.dash-empty-hero-btn {
  padding: 11px 28px; background: var(--red); color: var(--white);
  border: none; border-radius: 50px; font-family: 'Manrope', sans-serif;
  font-size: 13px; font-weight: 700; cursor: pointer; transition: background 0.18s;
  letter-spacing: .3px; display: inline-block; margin-bottom: 24px;
}
.dash-empty-hero-btn:hover { background: var(--red-dk); }
.dash-empty-shortcuts {
  display: flex; justify-content: center; gap: 16px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted);
}
.kbd {
  display: inline-block; font-family: monospace; font-size: 10px;
  background: var(--gray-lt); border: 1px solid var(--gray-bd);
  border-radius: 4px; padding: 1px 5px; color: var(--muted); font-weight: 600;
}

/* ── Dashboard ── */
.dash-category-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 20px; flex-wrap: wrap;
}

.cat-tabs {
  display: flex; gap: 4px; background: var(--gray-lt);
  border: 1px solid var(--gray-bd); border-radius: 8px; padding: 3px;
}

.cat-tab-btn {
  padding: 6px 14px; border: none; border-radius: 6px;
  font-family: 'Manrope', sans-serif; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; cursor: pointer;
  background: transparent; color: var(--muted); transition: all 0.18s;
}

.cat-tab-btn.active { background: var(--night); color: var(--white); box-shadow: 0 1px 3px rgba(0,0,0,.15); }


/* Bulk refresh */
.bulk-refresh-btn {
  border: 1.5px solid rgba(8,34,45,0.25); border-radius: 6px; background: var(--white);
  font-family: 'Manrope', sans-serif; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; padding: 6px 14px;
  cursor: pointer; color: var(--night); transition: all 0.18s; white-space: nowrap;
}
.bulk-refresh-btn:hover:not(:disabled) { background: var(--night); color: var(--white); border-color: var(--night); }
.bulk-refresh-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.bulk-cancel-btn {
  font-family: 'Manrope', sans-serif; font-size: 11px; font-weight: 700;
  padding: 2px 10px; border-radius: 4px; cursor: pointer;
  background: transparent; border: 1.5px solid var(--risk);
  color: var(--risk); transition: all 0.15s;
}
.bulk-cancel-btn:hover { background: var(--risk); color: #fff; }

.bulk-progress {
  background: var(--white); border: 1px solid var(--gray-bd); border-radius: 8px;
  padding: 16px 20px; margin-bottom: 16px; display: none;
}
.bulk-progress-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .5px; }
.bulk-progress-bar-wrap { background: var(--gray-lt); border-radius: 50px; height: 8px; overflow: hidden; margin-bottom: 8px; }
.bulk-progress-bar { background: var(--red); height: 8px; border-radius: 50px; transition: width 0.3s; width: 0; }
.bulk-progress-status { font-size: 12px; color: var(--muted); }

.dash-buckets {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px;
}

.bucket { border-radius: 8px; padding: 16px 20px; border: 1px solid; }
.bucket.risk  { background: var(--risk-bg);  border-color: var(--risk-bd); }
.bucket.opp   { background: var(--opp-bg);   border-color: var(--opp-bd); }

.bucket-label {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1px; margin-bottom: 10px;
}

.bucket.risk .bucket-label { color: var(--risk); }
.bucket.opp  .bucket-label { color: var(--opp); }

.bucket-agencies { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.8; }
.bucket-empty { font-size: 13px; color: var(--muted); font-style: italic; }

.dash-card {
  background: var(--white); border: 1px solid var(--gray-bd);
  border-radius: 8px; box-shadow: 0 1px 4px rgba(0,0,0,.06);
  margin-bottom: 10px; overflow: hidden; transition: box-shadow 0.18s;
}

.dash-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,.1); }

.dash-card-header {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; cursor: pointer; user-select: none;
}

.dash-card-header:hover { background: var(--gray-lt); }

.score-badge {
  width: 44px; height: 44px; border-radius: 8px; display: flex;
  align-items: center; justify-content: center; font-size: 17px;
  font-weight: 800; flex-shrink: 0;
}

.score-badge.risk    { background: var(--risk-bg);  color: var(--risk);  border: 1.5px solid var(--risk-bd); }
.score-badge.watch   { background: var(--watch-bg); color: var(--watch); border: 1.5px solid var(--watch-bd); }
.score-badge.opp     { background: var(--opp-bg);   color: var(--opp);   border: 1.5px solid var(--opp-bd); }
.score-badge.neutral { background: var(--gray-lt);  color: var(--muted); border: 1.5px solid var(--gray-bd); }

.dash-agency-info { flex: 1; min-width: 0; }

.dash-agency-name {
  font-size: 15px; font-weight: 700; color: var(--night); margin-bottom: 2px;
}

.dash-agency-meta {
  display: flex; align-items: center; gap: 6px; margin-bottom: 4px; flex-wrap: wrap;
}

.cat-pill {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  padding: 2px 8px; border-radius: 50px; background: var(--gray-lt);
  color: var(--muted); border: 1px solid var(--gray-bd);
}

.card-network-pill {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  padding: 2px 8px; border-radius: 50px; border: 1px solid rgba(48,99,140,0.25);
  background: rgba(48,99,140,0.07); color: var(--blue); cursor: pointer;
  transition: background 0.15s;
}
.card-network-pill:hover { background: rgba(48,99,140,0.16); }
.card-network-pill.independent {
  background: rgba(118,118,118,0.07); color: var(--muted); border-color: var(--gray-bd);
}
.card-network-pill.active-filter {
  background: var(--blue); color: #fff; border-color: var(--blue);
}
.card-network-pill.independent.active-filter {
  background: var(--muted); color: #fff;
}

.dash-score-reason { font-size: 12px; color: var(--muted); line-height: 1.4; }

.dash-right {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 6px; flex-shrink: 0;
}

.dash-top-row { display: flex; align-items: center; gap: 8px; }

.trend-badge {
  font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 50px;
  display: flex; align-items: center; gap: 3px;
}

.trend-badge.up   { background: var(--opp-bg);  color: var(--opp);  border: 1px solid var(--opp-bd); }
.trend-badge.down { background: var(--risk-bg); color: var(--risk); border: 1px solid var(--risk-bd); }
.trend-badge.flat { background: var(--gray-lt); color: var(--muted); border: 1px solid var(--gray-bd); }

.status-pill {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  padding: 2px 8px; border-radius: 50px;
}

.status-pill.monitoring     { background: var(--gray-lt);  color: var(--muted); border: 1px solid var(--gray-bd); }
.status-pill.in_contact     { background: #E8F0F8;          color: var(--blue);  border: 1px solid #B8CDE0; }
.status-pill.needs_attention{ background: var(--watch-bg); color: var(--watch); border: 1px solid var(--watch-bd); }
.status-pill.escalated      { background: var(--risk-bg);  color: var(--risk);  border: 1px solid var(--risk-bd); }

.dash-updated { font-size: 11px; color: var(--gray-75); font-weight: 500; }

.dash-flags {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 8px 18px 10px 76px;
  border-top: 1px solid var(--gray-lt);
}

.flag-chip {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  padding: 2px 8px; border-radius: 50px;
}

.flag-chip.positive { background: var(--opp-bg);  color: var(--opp);  border: 1px solid var(--opp-bd); }
.flag-chip.negative { background: var(--risk-bg); color: var(--risk); border: 1px solid var(--risk-bd); }
.flag-chip.neutral  { background: var(--gray-lt); color: var(--muted); border: 1px solid var(--gray-bd); }

.dash-empty {
  text-align: center; padding: 48px 20px; color: var(--muted); font-size: 14px;
  background: var(--white); border: 1px solid var(--gray-bd); border-radius: 8px;
}

.dash-empty strong { display: block; font-size: 16px; color: var(--text); margin-bottom: 6px; }
.dash-loading { text-align: center; padding: 32px; color: var(--muted); font-size: 13px; }

/* Alert banner */
.alerts-banner { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.alert-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--risk-bg); border: 1px solid var(--risk-bd);
  border-radius: 8px; padding: 12px 16px; font-size: 13px;
  max-height: 80px; overflow: hidden;
}
.alert-icon { font-size: 16px; flex-shrink: 0; }
.alert-text { flex: 1; color: var(--text); font-weight: 500; }
.alert-text strong { color: var(--risk); }
.alert-dismiss { background: none; border: none; font-size: 18px; color: var(--muted); cursor: pointer; padding: 0 4px; }
.alert-dismiss:hover { color: var(--risk); }

/* ── Slide-out Panel ── */
.panel-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-base), visibility 0s linear var(--transition-base);
}

.panel-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity var(--transition-base), visibility 0s linear 0s;
}

.panel-drawer {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(860px, 100vw);
  background: var(--white); box-shadow: -4px 0 24px rgba(0,0,0,.18);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.panel-overlay.open .panel-drawer { transform: translateX(0); }

.panel-head {
  flex-shrink: 0; padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: rgba(8,34,45,0.95);
  backdrop-filter: blur(12px);
}

.panel-head-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}

.panel-agency-name { font-size: 20px; font-weight: 800; color: var(--white); }

.panel-close-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.7); font-size: 16px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.panel-close-btn:hover { background: rgba(255,255,255,0.15); color: var(--white); }

.panel-meta-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}

.panel-score-badge {
  font-size: 15px; font-weight: 800; padding: 6px 14px; border-radius: 8px;
}

.panel-score-badge.risk    { background: var(--risk-bg);  color: var(--risk);  border: 1.5px solid var(--risk-bd); }
.panel-score-badge.watch   { background: var(--watch-bg); color: var(--watch); border: 1.5px solid var(--watch-bd); }
.panel-score-badge.opp     { background: var(--opp-bg);   color: var(--opp);   border: 1.5px solid var(--opp-bd); }
.panel-score-badge.neutral { background: var(--gray-lt);  color: var(--muted); border: 1.5px solid var(--gray-bd); }

.panel-score-reason { font-size: 13px; color: rgba(255,255,255,0.55); line-height: 1.4; flex: 1; }

.panel-controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 24px; border-bottom: 1px solid var(--gray-lt);
}

.panel-select {
  padding: 6px 10px; border: 1.5px solid rgba(255,255,255,0.2); border-radius: 6px;
  font-family: 'Manrope', sans-serif; font-size: 12px; font-weight: 600;
  color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.08); cursor: pointer;
}

.panel-select:focus { outline: none; border-color: var(--gold-dk); }
.panel-select option { background: #08222D; color: white; }

.panel-refresh-btn {
  border: 1.5px solid rgba(255,255,255,0.2); border-radius: 50px; background: rgba(255,255,255,0.08);
  font-family: 'Manrope', sans-serif; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px; color: rgba(255,255,255,0.75);
  cursor: pointer; padding: 5px 13px; transition: all 0.15s; white-space: nowrap;
}

.panel-refresh-btn:hover:not(:disabled) { background: rgba(255,255,255,0.15); color: var(--white); border-color: rgba(255,255,255,0.35); }
.panel-refresh-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.panel-updated { font-size: 11px; color: rgba(255,255,255,0.4); font-weight: 500; margin-left: auto; }

/* Score chart */
.chart-section { padding: 16px 24px; border-bottom: 1px solid var(--gray-lt); }
.chart-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-bottom: 10px; }
.chart-loading { font-size: 12px; color: var(--muted); font-style: italic; }

/* Peer comparison */
.peer-comparison {
  padding: 10px 24px; border-bottom: 1px solid var(--gray-lt);
  font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px;
}
.peer-rank { font-weight: 700; color: var(--night); }

/* Notes area */
.panel-notes { padding: 14px 24px; border-bottom: 1px solid var(--gray-lt); }

.panel-notes-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); margin-bottom: 6px;
}

.panel-notes-row { display: flex; gap: 8px; align-items: flex-end; }

.notes-textarea {
  flex: 1; padding: 9px 12px; background: var(--gray-lt); border: 1px solid var(--gray-bd);
  border-radius: 6px; font-family: 'Manrope', sans-serif; font-size: 13px;
  color: var(--text); resize: vertical; min-height: 56px; max-height: 140px;
  line-height: 1.5; transition: border-color 0.18s;
}

.notes-textarea:focus { outline: none; border-color: var(--blue); background: var(--white); }

.notes-save-btn {
  padding: 9px 16px; background: var(--night); color: var(--white); border: none;
  border-radius: 6px; font-family: 'Manrope', sans-serif; font-size: 12px;
  font-weight: 700; cursor: pointer; white-space: nowrap; transition: background 0.18s;
}

.notes-save-btn:hover { background: var(--blue); }

.notes-saved-msg { font-size: 11px; color: var(--opp); font-weight: 600; display: none; margin-top: 4px; }

/* Contact log */
.contact-log-section { padding: 14px 24px; border-bottom: 1px solid var(--gray-lt); flex-shrink: 0; }
.contact-log-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-bottom: 10px; }
.contact-add-row { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 12px; }
.contact-date-input {
  padding: 7px 10px; border: 1px solid var(--gray-bd); border-radius: 6px;
  font-family: 'Manrope', sans-serif; font-size: 12px; color: var(--text);
  background: var(--gray-lt); width: 130px; flex-shrink: 0;
}
.contact-date-input:focus { outline: none; border-color: var(--blue); }
.contact-note-input {
  flex: 1; padding: 7px 10px; border: 1px solid var(--gray-bd); border-radius: 6px;
  font-family: 'Manrope', sans-serif; font-size: 13px; color: var(--text);
  background: var(--gray-lt); resize: none; min-height: 36px;
}
.contact-note-input:focus { outline: none; border-color: var(--blue); background: var(--white); }
.contact-log-btn {
  padding: 7px 14px; background: var(--night); color: var(--white); border: none;
  border-radius: 6px; font-family: 'Manrope', sans-serif; font-size: 12px;
  font-weight: 700; cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: background 0.18s;
}
.contact-log-btn:hover { background: var(--blue); }
.contact-timeline { display: flex; flex-direction: column; gap: 8px; }
.contact-entry {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 10px; background: var(--gray-lt); border-radius: 6px;
  font-size: 12px;
}
.contact-entry-date { font-weight: 700; color: var(--muted); white-space: nowrap; min-width: 80px; }
.contact-entry-note { flex: 1; color: var(--text); line-height: 1.5; }
.contact-entry-del { background: none; border: none; color: var(--gray-bd); cursor: pointer; font-size: 14px; padding: 0; transition: color 0.15s; }
.contact-entry-del:hover { color: var(--risk); }
.contact-empty { font-size: 12px; color: var(--muted); font-style: italic; }

/* Panel scroll body */
.panel-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.panel-body { padding: 24px; }

/* ── View toggle ── */
.view-toggle { display: flex; border: 1.5px solid rgba(8,34,45,0.25); border-radius: 6px; overflow: hidden; background: var(--white); }
.view-btn {
  padding: 6px 14px; border: none; background: transparent; cursor: pointer;
  font-family: 'Manrope', sans-serif; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; color: var(--night); transition: all 0.18s;
}
.view-btn.active { background: var(--night); color: var(--white); }

/* ── Flag filter bar ── */
/* ── Filter toolbar ── */
.filter-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.filter-search {
  padding: 7px 12px; border: 1px solid var(--gray-bd); border-radius: 8px;
  font-family: 'Manrope', sans-serif; font-size: 13px; color: var(--text);
  background: var(--white); width: 220px;
}
.filter-search:focus { outline: none; border-color: var(--blue); }

.multiselect-wrap { position: relative; }
.multiselect-trigger {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border: 1px solid var(--gray-bd); border-radius: 8px;
  background: var(--white); font-family: 'Manrope', sans-serif;
  font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer;
  white-space: nowrap; transition: border-color 0.15s;
}
.multiselect-trigger:hover { border-color: var(--blue); }
.multiselect-trigger.has-selection { border-color: var(--blue); color: var(--blue); background: #EEF4FF; }
.multiselect-caret { font-size: 10px; color: var(--muted); }
.multiselect-dropdown {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 100;
  background: var(--white); border: 1px solid var(--gray-bd);
  border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.12);
  min-width: 220px; overflow: hidden;
}
.multiselect-dropdown.open { display: block; }
.multiselect-search {
  display: block; width: 100%; padding: 10px 14px;
  border: none; border-bottom: 1px solid var(--gray-lt);
  font-family: 'Manrope', sans-serif; font-size: 13px; color: var(--text);
}
.multiselect-search:focus { outline: none; }
.multiselect-options { max-height: 240px; overflow-y: auto; padding: 6px 0; }
.multiselect-option {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; cursor: pointer; font-size: 13px; font-weight: 500;
  transition: background 0.1s;
}
.multiselect-option:hover { background: var(--gray-lt); }
.multiselect-option input[type="checkbox"] { accent-color: var(--blue); width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }
.multiselect-no-results { padding: 12px 14px; font-size: 12px; color: var(--muted); }

.active-filter-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.flag-filter-chip {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  padding: 3px 10px; border-radius: 50px; cursor: pointer; transition: all 0.15s;
}
.flag-filter-chip.positive { background: var(--opp-bg); color: var(--opp); border: 1.5px solid var(--opp); }
.flag-filter-chip.negative { background: var(--risk-bg); color: var(--risk); border: 1.5px solid var(--risk); }
.flag-filter-chip.neutral  { background: var(--gray-bg); color: var(--muted); border: 1.5px solid var(--gray-75); }
.clear-filters-btn {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: var(--muted); background: none; border: none;
  cursor: pointer; padding: 2px 6px; border-radius: 4px; transition: color 0.15s;
}
.clear-filters-btn:hover { color: var(--risk); }

/* Flag chips on cards */
.flag-chip { cursor: pointer; }
.flag-chip:hover { filter: brightness(0.9); }
.flag-chip.filter-active { box-shadow: 0 0 0 2px currentColor; }

/* ── Scatter plot ── */
.scatter-wrap {
  background: var(--white); border: 1px solid var(--gray-bd);
  border-radius: 8px; padding: 20px; margin-bottom: 16px;
  display: none;
}
.scatter-wrap.active { display: block; }
.scatter-empty { text-align: center; padding: 40px; color: var(--muted); font-size: 13px; }
.scatter-dot { transition: r 0.15s, opacity 0.15s; }
.scatter-dot:hover { opacity: 0.85; }

/* Scatter tooltip */
#scatterTooltip {
  position: fixed; display: none; z-index: 300;
  background: var(--white); border: 1px solid var(--gray-bd);
  border-radius: 8px; padding: 12px 16px; max-width: 260px;
  box-shadow: 0 4px 20px rgba(0,0,0,.15); pointer-events: none;
}
.stt-name { font-size: 14px; font-weight: 800; color: var(--night); margin-bottom: 4px; }
.stt-reason { font-size: 12px; color: var(--muted); line-height: 1.4; margin-bottom: 8px; }
.stt-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.stt-hint { font-size: 10px; color: var(--gray-75); text-align: right; }

/* ── Ticker Bar ── */
#tickerBar {
  height: 30px; overflow: hidden;
  border-top: 1px solid rgba(255,255,255,0.07);
  background: #040f16;
  display: flex; align-items: center;
}
.ticker-ani-badge {
  flex-shrink: 0;
  display: flex; align-items: center; gap: 6px;
  padding: 0 14px;
  border-right: 1px solid rgba(255,255,255,0.1);
  height: 100%;
  font-size: 9px; font-weight: 800; letter-spacing: 1px;
  text-transform: uppercase; white-space: nowrap;
}
.ticker-ani-label { color: rgba(255,255,255,0.35); }
.ticker-ani-value { font-size: 11px; font-weight: 800; }
.ticker-ani-value.up   { color: #27AE60; }
.ticker-ani-value.down { color: #E74C3C; }
.ticker-ani-value.flat { color: rgba(255,255,255,0.4); }
.ticker-track {
  display: inline-flex; align-items: center; height: 100%;
  white-space: nowrap;
  animation: tickerScroll 80s linear infinite;
}
.ticker-track:hover { animation-play-state: paused; }
@keyframes tickerScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-16.666%); }
}
.ticker-item {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0 18px; height: 100%;
  border-right: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
  transition: background 0.15s;
}
.ticker-item:hover { background: rgba(255,255,255,0.05); }
.ticker-name { font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.6px; }
.ticker-score { font-size: 12px; font-weight: 800; }
.ticker-score.opp  { color: #27AE60; }
.ticker-score.risk { color: #E74C3C; }
.ticker-score.watch { color: #E8A020; }
.ticker-score.neutral { color: rgba(255,255,255,0.45); }
.ticker-delta { font-size: 10px; font-weight: 600; }
.ticker-delta.up   { color: #27AE60; }
.ticker-delta.down { color: #E74C3C; }
.ticker-delta.flat { color: rgba(255,255,255,0.3); }
.ticker-sep { color: rgba(255,255,255,0.1); font-size: 10px; user-select: none; }

/* ── Holding Company Stock Strip ── */
.stock-strip-wrap {
  margin-bottom: 20px;
}
.stock-strip-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.stock-strip-title {
  font-size: 10px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1px; color: var(--muted);
}
.stock-strip-powered {
  font-size: 9px; color: var(--muted); font-weight: 500;
}
.stock-strip {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.stock-card {
  flex: 1; min-width: 110px;
  background: var(--white);
  border: 1px solid var(--gray-bd);
  border-radius: 8px; padding: 10px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.stock-card:hover { border-color: var(--blue); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.stock-card.in-portfolio {
  border-color: var(--gold-dk);
  background: var(--watch-bg);
}
.stock-card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 4px; }
.stock-symbol { font-size: 11px; font-weight: 800; color: var(--night); letter-spacing: 0.8px; }
.stock-exchange { font-size: 8px; font-weight: 600; color: var(--muted); letter-spacing: 0.5px; margin-top: 1px; }
.stock-price { font-size: 18px; font-weight: 800; color: var(--night); line-height: 1; margin-bottom: 3px; }
.stock-change { font-size: 11px; font-weight: 700; display: flex; align-items: center; gap: 4px; }
.stock-change.up   { color: var(--opp); }
.stock-change.down { color: var(--risk); }
.stock-change.flat { color: var(--muted); }
.stock-name { font-size: 9px; color: var(--muted); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stock-portfolio-tag {
  font-size: 8px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--gold-dk);
  background: var(--watch-bg); border: 1px solid var(--watch-bd);
  border-radius: 3px; padding: 1px 4px; margin-top: 4px; display: inline-block;
}
.stock-stale { font-size: 9px; color: var(--muted); font-style: italic; }
.stock-loading { color: var(--muted); font-size: 11px; padding: 12px 0; }

/* ── Panel stock widget ── */
#panelStockWidget {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 24px; background: rgba(8,34,45,0.97);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 11px;
}
.psw-parent { color: rgba(255,255,255,0.5); font-weight: 500; }
.psw-symbol { font-weight: 800; color: rgba(255,255,255,0.85); letter-spacing: 0.5px; }
.psw-price  { color: #fff; font-weight: 700; font-size: 13px; }
.psw-change { font-weight: 700; }
.psw-change.up   { color: #27AE60; }
.psw-change.down { color: #E74C3C; }
.psw-change.flat { color: rgba(255,255,255,0.5); }
.psw-hl { color: rgba(255,255,255,0.55); font-size: 10px; }

/* ── ANI Chart ── */
.ani-chart-wrap {
  background: var(--white); border: 1px solid var(--gray-bd);
  border-radius: 10px; padding: 20px 20px 12px; margin-bottom: 20px;
}
.ani-chart-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 14px; gap: 12px;
}
.ani-chart-title {
  font-size: 14px; font-weight: 800; color: var(--night);
  letter-spacing: -.2px; display: flex; align-items: center; gap: 8px;
}
.ani-chart-ytd-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--white); background: var(--blue);
  padding: 2px 7px; border-radius: 50px;
}
.ani-chart-subtitle {
  font-size: 11px; color: var(--muted); margin-top: 3px; font-weight: 500;
}
.ani-chart-badge {
  font-size: 13px; font-weight: 800; white-space: nowrap;
  padding: 4px 12px; border-radius: 6px;
}
.ani-chart-badge.up   { background: #EBF7EF; color: #1A7A5E; }
.ani-chart-badge.down { background: #FDECEC; color: #C0392B; }
.ani-chart-badge.flat { background: var(--gray-lt); color: var(--muted); }
.ani-chart-loading { text-align: center; padding: 48px 0; color: var(--muted); font-size: 13px; }
.ani-chart-line { transition: opacity 0.15s; }
.ani-chart-line:hover { opacity: 0.8; }
#aniSvg { display: block; width: 100%; overflow: visible; }

/* ── Industry Pulse tab ── */
.pulse-breakout-bar {
  display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px;
}
.pulse-breakout-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--watch-bg); border: 1px solid var(--watch-bd);
  border-radius: 8px; padding: 12px 16px; font-size: 13px;
}
.pulse-breakout-item.isnew {
  background: #EEF4FF; border-color: #B8CDE0;
}
.pulse-breakout-text { flex: 1; font-weight: 500; color: var(--text); }
.pulse-breakout-text strong { color: var(--watch); }
.pulse-breakout-item.isnew .pulse-breakout-text strong { color: var(--blue); }
.pulse-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
@media (max-width: 700px) { .pulse-grid { grid-template-columns: repeat(2, 1fr); } }
.pulse-card {
  background: var(--white); border: 1px solid var(--gray-bd);
  border-radius: 8px; padding: 16px; position: relative;
}
.pulse-card.breakout { border-color: var(--watch-bd); background: var(--watch-bg); }
.pulse-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.pulse-flag-name { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.pulse-breakout-badge {
  font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  background: var(--watch); color: white; padding: 2px 7px; border-radius: 50px;
}
.pulse-count { font-size: 28px; font-weight: 800; color: var(--night); line-height: 1; margin-bottom: 10px; }
.pulse-trend-arrow { font-size: 18px; }
.pulse-sparkline { display: block; width: 100%; overflow: visible; margin-bottom: 4px; }
.pulse-spark-axis { display: flex; justify-content: space-between; }
.pulse-spark-axis span { font-size: 9px; color: var(--gray-75); }
.pulse-no-data { text-align: center; padding: 48px; background: var(--white); border: 1px solid var(--gray-bd); border-radius: 8px; }
.pulse-no-data strong { display: block; font-size: 16px; color: var(--text); margin-bottom: 6px; }

/* ── Pulse benchmark strip ── */
.pulse-benchmarks { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.pulse-benchmark-card {
  flex: 1; min-width: 160px; background: rgba(255,255,255,0.9);
  border: 1px solid var(--gray-bd); border-radius: 12px; padding: 14px 18px;
}
.pulse-benchmark-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); margin-bottom: 4px;
}
.pulse-benchmark-value { font-size: 28px; font-weight: 800; line-height: 1; color: var(--night); }
.pulse-benchmark-value.pos { color: var(--opp); }
.pulse-benchmark-value.neg { color: var(--risk); }
.pulse-benchmark-sub { font-size: 11px; color: var(--muted); margin-top: 5px; }
.pulse-benchmark-delta { font-size: 12px; font-weight: 700; }
.pulse-benchmark-delta.better { color: var(--opp); }
.pulse-benchmark-delta.worse  { color: var(--risk); }

/* ── Outreach draft section in panel ── */
.outreach-trigger-row { padding: 16px 24px 0; }
.outreach-trigger-btn {
  display: block; width: 100%; padding: 12px 20px;
  background: var(--gold); color: var(--night);
  border: none; border-radius: 10px; font-family: 'Manrope', sans-serif;
  font-size: 13px; font-weight: 800; letter-spacing: .3px;
  cursor: pointer; text-align: center; transition: background 0.18s;
}
.outreach-trigger-btn:hover { background: var(--gold-dk); }
.outreach-trigger-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.outreach-section { border-top: 1px solid var(--gray-lt); padding: 16px 24px; display: none; }
.outreach-section.visible { display: block; }
.outreach-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); margin-bottom: 12px;
}
.outreach-tabs { display: flex; margin-bottom: 12px; border-radius: 8px; overflow: hidden; border: 1px solid var(--gray-bd); }
.outreach-tab {
  flex: 1; padding: 8px; font-family: 'Manrope', sans-serif; font-size: 12px;
  font-weight: 700; background: var(--gray-lt); border: none; cursor: pointer; color: var(--muted);
  transition: background 0.18s, color 0.18s;
}
.outreach-tab + .outreach-tab { border-left: 1px solid var(--gray-bd); }
.outreach-tab.active { background: var(--night); color: var(--white); }
.outreach-subject { font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .5px; }
.outreach-subject-line { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.outreach-body {
  font-size: 13px; color: var(--text); line-height: 1.75; white-space: pre-wrap;
  background: var(--gray-lt); border-radius: 8px; padding: 14px 16px; margin-bottom: 10px;
}
.outreach-call-list { list-style: none; padding: 0; margin: 0 0 10px; }
.outreach-call-list li {
  padding: 8px 12px 8px 0; border-bottom: 1px solid var(--gray-lt);
  font-size: 13px; color: var(--text); line-height: 1.5;
  display: flex; gap: 10px; align-items: flex-start;
}
.outreach-call-list li::before { content: "→"; color: var(--muted); flex-shrink: 0; padding-top: 1px; }
.outreach-call-list li:last-child { border-bottom: none; }
.outreach-copy-btn {
  padding: 6px 14px; background: transparent; border: 1px solid var(--gray-bd);
  border-radius: 50px; font-family: 'Manrope', sans-serif; font-size: 11px;
  font-weight: 700; color: var(--muted); cursor: pointer; letter-spacing: .4px;
  transition: border-color 0.18s, color 0.18s;
}
.outreach-copy-btn:hover { border-color: var(--blue); color: var(--blue); }
.outreach-loading { font-size: 13px; color: var(--muted); text-align: center; padding: 20px 0; }

/* ── Compare tab ── */
.compare-header { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.compare-selects { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.compare-select-wrap { flex: 1; min-width: 200px; }
.compare-select-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); margin-bottom: 6px; display: block;
}
.compare-select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--gray-bd); border-radius: 8px;
  font-family: 'Manrope', sans-serif; font-size: 14px; font-weight: 600;
  background: var(--white); color: var(--text); cursor: pointer;
}
.compare-winner-banner {
  background: rgba(26,122,94,0.08); border: 1px solid var(--opp-bd);
  border-radius: 10px; padding: 10px 18px; text-align: center;
  font-size: 13px; font-weight: 700; color: var(--opp); margin-bottom: 16px;
}
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 620px) { .compare-grid { grid-template-columns: 1fr; } }
.compare-card {
  background: var(--white); border: 2px solid var(--gray-bd);
  border-radius: 14px; padding: 20px;
}
.compare-card.winner { border-color: var(--opp-bd); }
.compare-card-name { font-size: 17px; font-weight: 800; color: var(--night); margin-bottom: 10px; }
.compare-score-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.compare-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px;
  color: var(--muted); margin: 14px 0 6px;
}
.compare-overview { font-size: 13px; color: var(--text); line-height: 1.6; }
.compare-news-item {
  font-size: 12px; color: var(--text); padding: 5px 0; line-height: 1.5;
  border-bottom: 1px solid var(--gray-lt);
}
.compare-news-item:last-child { border-bottom: none; }
.compare-news-date { font-size: 10px; color: var(--muted); font-weight: 600; display: block; }
.compare-flags { display: flex; flex-wrap: wrap; gap: 5px; }
.compare-empty { font-size: 13px; color: var(--muted); text-align: center; padding: 40px 0; }

/* ── Tooltip ── */
[data-tooltip] {
  position: relative; cursor: help;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--night); color: var(--white);
  font-family: 'Manrope', sans-serif; font-size: 11px; font-weight: 500; line-height: 1.4;
  white-space: nowrap; max-width: 220px; white-space: normal;
  padding: 6px 10px; border-radius: 6px;
  pointer-events: none; opacity: 0;
  transition: opacity var(--transition-sm);
  z-index: 500; text-align: center;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── Toast notification ── */
#toastContainer {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--night); color: var(--white);
  font-family: 'Manrope', sans-serif; font-size: 13px; font-weight: 600;
  padding: 10px 20px; border-radius: 50px;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.2s var(--ease-out) forwards;
}
.toast.out { animation: toastOut 0.2s var(--ease-out) forwards; }
@keyframes toastIn  { from { opacity:0; transform:translateY(8px) } to { opacity:1; transform:translateY(0) } }
@keyframes toastOut { from { opacity:1; transform:translateY(0) } to { opacity:0; transform:translateY(4px) } }

/* ── Keyboard shortcuts modal ── */
#kbdModal {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--transition-base), visibility 0s linear var(--transition-base);
}
#kbdModal.open {
  opacity: 1; visibility: visible; pointer-events: auto;
  transition: opacity var(--transition-base), visibility 0s linear 0s;
}
.kbd-modal-box {
  background: var(--white); border-radius: 16px;
  padding: 28px 32px; width: 380px; max-width: 90vw;
  box-shadow: var(--shadow-xl);
  animation: popIn var(--transition-base) ease forwards;
}
.kbd-modal-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 16px; }
.kbd-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--gray-lt); }
.kbd-row:last-child { border-bottom: none; }
.kbd-desc { font-size: 13px; color: var(--text); font-weight: 500; }
.kbd-keys { display: flex; gap: 4px; }

/* ── Mobile responsive ── */
@media (max-width: 768px) {
  .header-main-row { padding: 0 16px; gap: 8px; }
  .header-title { display: none; }
  .tab-nav { gap: 1px; padding: 0 12px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .tab-nav::-webkit-scrollbar { display: none; }
  .tab-btn { white-space: nowrap; padding: 9px 14px; font-size: 11px; }
  main { padding: 0 12px 32px; border-radius: 0; }
  .card { padding: 20px 16px; }
  .dash-buckets { grid-template-columns: 1fr 1fr !important; }
  .dash-card { min-width: 0; }
  .health-bar-row { flex-wrap: wrap; gap: 8px; }
  .panel-drawer { width: 100vw; }
  .stock-strip { gap: 6px; }
  .stock-card { min-width: 90px; padding: 8px 10px; }
  .stock-price { font-size: 15px; }
  .compare-grid { grid-template-columns: 1fr !important; }
  .pulse-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .scatter-wrap { overflow-x: auto; }
  .user-pill span { display: none; }
}

@media (max-width: 480px) {
  .tab-btn { padding: 8px 10px; font-size: 10px; }
  .dash-buckets { grid-template-columns: 1fr !important; }
  .dash-card-name { font-size: 13px; }
  .score-badge { width: 34px; height: 34px; font-size: 13px; }
  .health-bar-segments { display: none; }
  .pulse-grid { grid-template-columns: 1fr !important; }
  .manage-agencies-btn { padding: 5px 10px; font-size: 10px; }
}

/* ── Print styles ── */
@media print {
  header, #tickerBar, .tab-nav, .panel-overlay,
  #runBtn, .watchlist-btn, .agency-btn,
  .panel-close-btn, .panel-refresh-btn, .notes-save-btn,
  .outreach-btn, .dash-controls, .network-filter-bar,
  .flag-filter-row, .bulk-refresh-bar, #sun-bg { display: none !important; }

  body { background: white; color: black; font-size: 12px; }
  main { box-shadow: none; padding: 0; max-width: 100%; }
  .tab-panel { display: block !important; }
  .tab-panel:not(.active) { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .dash-card { break-inside: avoid; }
  .score-badge { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 10px; color: #666; }
  .sources-list a::after { content: none; }
}

/* ── Visual Enhancement: Card left-border color stripe ── */
.dash-card { border-left: 4px solid var(--gray-bd); }
.dash-card.card-risk  { border-left-color: var(--risk); }
.dash-card.card-opp   { border-left-color: var(--opp); }
.dash-card.card-watch { border-left-color: var(--gold-dk); }

/* ── Score drop pulse ── */
@keyframes scoreDropPulse {
  0%   { box-shadow: 0 0 0 0 rgba(192,57,43,0.55); }
  65%  { box-shadow: 0 0 0 9px rgba(192,57,43,0); }
  100% { box-shadow: 0 0 0 0 rgba(192,57,43,0); }
}
.score-badge.score-dropped { animation: scoreDropPulse 1.2s ease-out 0.3s; }

/* ── Watchlist star pop ── */
@keyframes starPop {
  0%   { transform: scale(1) rotate(0deg); }
  35%  { transform: scale(1.45) rotate(-12deg); }
  65%  { transform: scale(0.88); }
  100% { transform: scale(1) rotate(0deg); }
}
.watchlist-btn.star-pop { animation: starPop 0.38s ease; }

/* ── Flag chip ripple ── */
.flag-chip { position: relative; overflow: hidden; }
.flag-chip::after {
  content: ''; position: absolute; inset: 0;
  background: currentColor; opacity: 0; border-radius: inherit;
  pointer-events: none;
}
.flag-chip.chip-ripple::after { opacity: 0.18; transition: opacity 0.25s; }

/* ── Score heatmap strip ── */
.score-heatmap {
  display: flex; align-items: center; gap: 3px; flex-wrap: wrap;
  padding: 8px 0 14px; margin-bottom: 2px;
}
.heatmap-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--muted); margin-right: 4px;
  white-space: nowrap; flex-shrink: 0;
}
.heatmap-dot {
  width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0;
  cursor: pointer; transition: transform 0.15s;
  position: relative;
}
.heatmap-dot:hover { transform: scale(1.5); z-index: 2; }
.heatmap-dot[title]:hover::after {
  content: attr(title); position: absolute; bottom: calc(100% + 5px); left: 50%;
  transform: translateX(-50%); background: var(--night); color: #fff;
  font-size: 10px; font-family: 'Manrope',sans-serif; font-weight: 600;
  white-space: nowrap; padding: 3px 7px; border-radius: 4px; pointer-events: none;
  z-index: 10;
}
.heatmap-dot.hm-risk  { background: var(--risk); }
.heatmap-dot.hm-opp   { background: var(--opp); }
.heatmap-dot.hm-watch { background: var(--gold-dk); }
.heatmap-dot.hm-neutral { background: var(--gray-bd); }

/* ── Density toggle ── */
.density-toggle {
  display: flex; border: 1.5px solid rgba(8,34,45,0.25);
  border-radius: 6px; overflow: hidden; background: var(--white);
}
.density-btn {
  padding: 6px 10px; border: none; background: transparent; cursor: pointer;
  font-size: 14px; color: var(--night); transition: all 0.15s;
  line-height: 1;
}
.density-btn.active { background: var(--night); color: var(--white); }

/* ── Compact density mode ── */
.dash-cards-compact .dash-card { margin-bottom: 5px; }
.dash-cards-compact .dash-card-header { padding: 9px 14px; gap: 10px; }
.dash-cards-compact .score-badge { width: 36px; height: 36px; font-size: 14px; }
.dash-cards-compact .dash-agency-name { font-size: 13px; }
.dash-cards-compact .dash-agency-meta { margin-bottom: 0; }
.dash-cards-compact .dash-score-reason { display: none; }
.dash-cards-compact .dash-sparkline { display: none; }

/* ── Card expand/collapse ── */
.card-expand-btn {
  width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--gray-bd);
  background: var(--white); font-size: 10px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); transition: all 0.15s; line-height: 1;
  margin-left: 2px;
}
.card-expand-btn:hover { background: var(--gray-lt); color: var(--night); border-color: var(--blue); }
.dash-card.expanded .card-expand-btn { background: var(--night); color: var(--white); border-color: var(--night); }
.dash-card-inline {
  display: none; padding: 0 18px 14px 76px;
  border-top: 1px solid var(--gray-lt);
  animation: fadeIn 0.2s ease;
}
.dash-card.expanded .dash-card-inline { display: block; }
.dash-inline-news { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.dash-inline-news-item {
  font-size: 12px; color: var(--text); line-height: 1.45;
  padding: 6px 10px; border-radius: 6px; border-left: 3px solid var(--gray-bd);
  background: var(--gray-lt);
}
.dash-inline-news-item.pos { border-left-color: var(--opp); background: var(--opp-bg); }
.dash-inline-news-item.neg { border-left-color: var(--risk); background: var(--risk-bg); }
.dash-inline-talking { display: flex; flex-direction: column; gap: 4px; }
.dash-inline-talking li {
  font-size: 12px; color: var(--muted); line-height: 1.4;
  list-style: none; padding-left: 12px; position: relative;
}
.dash-inline-talking li::before { content: '·'; position: absolute; left: 0; color: var(--blue); font-weight: 700; }

/* ── Panel tab bar ── */
.panel-tabs {
  display: flex; gap: 0; flex-shrink: 0;
  border-bottom: 2px solid var(--gray-lt);
  padding: 0 24px; background: var(--white);
}
.panel-tab-btn {
  padding: 10px 16px; border: none; background: transparent;
  font-family: 'Manrope', sans-serif; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s; white-space: nowrap;
}
.panel-tab-btn:hover { color: var(--night); }
.panel-tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.panel-tab-section { display: none; }
.panel-tab-section.active { display: block; }

/* ── Panel sticky quick actions ── */
.panel-quick-actions {
  flex-shrink: 0; display: flex; align-items: center; gap: 8px;
  justify-content: flex-end; padding: 10px 20px 14px;
  border-top: 1px solid var(--gray-lt); background: var(--white);
}
.panel-quick-btn {
  padding: 7px 15px; border-radius: 50px;
  font-family: 'Manrope', sans-serif; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px; cursor: pointer; white-space: nowrap;
  transition: all 0.15s;
}
.panel-quick-btn.outline {
  background: transparent; color: var(--night);
  border: 1.5px solid rgba(8,34,45,0.25);
}
.panel-quick-btn.outline:hover { background: var(--night); color: var(--white); border-color: var(--night); }
.panel-quick-btn.primary {
  background: var(--red); color: #fff; border: none;
}
.panel-quick-btn.primary:hover { background: var(--red-dk); }
.panel-quick-btn.gold {
  background: var(--gold); color: var(--night); border: none;
}
.panel-quick-btn.gold:hover { background: var(--gold-dk); }

/* ── ANI chart line draw animation ── */
@keyframes drawLine { from { stroke-dashoffset: var(--path-len); } to { stroke-dashoffset: 0; } }
.ani-line-animated { animation: drawLine 1.4s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
