/* ─── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f2f1ef;
  color: #1a1a1a;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Header ─────────────────────────────────────────── */
#app-header {
  flex-shrink: 0;
  background: #282828;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 58px;
  z-index: 10;
}
.header-left { display: flex; align-items: baseline; gap: 12px; }
.brand-eye { font-size: 10px; letter-spacing: .14em; color: #6498CE; font-weight: 600; }
.brand-name { font-size: 17px; font-weight: 500; color: white; }
.header-right { display: flex; align-items: center; gap: 18px; }
.header-date { font-size: 12px; color: rgba(255,255,255,.6); }

/* Lookback toggle */
.lookback-group { display: flex; align-items: center; gap: 5px; }
.lookback-label { font-size: 10px; letter-spacing: .1em; color: rgba(255,255,255,.6); font-weight: 500; margin-right: 3px; }
.lk-btn {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.85);
  border: 1.5px solid rgba(255,255,255,.45);
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background .12s;
}
.lk-btn.active { background: #6498CE; border-color: #6498CE; color: white; }
.lk-btn:hover:not(.active) { background: rgba(255,255,255,.2); }

/* ─── Body layout ────────────────────────────────────── */
#app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ─── Sidebar ────────────────────────────────────────── */
#sidebar {
  width: 248px;
  flex-shrink: 0;
  background: white;
  border-right: 1px solid rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-section {
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.sidebar-section:last-child { border-bottom: 0; flex: 1; overflow-y: auto; }
.sidebar-label {
  font-size: 10px;
  letter-spacing: .1em;
  color: #999;
  font-weight: 600;
  margin-bottom: 10px;
}

/* Firm pills */
.firm-list { display: flex; flex-direction: column; gap: 4px; }
.firm-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #333;
  transition: background .1s;
  width: 100%;
}
.firm-btn:hover { background: #f5f4f2; }
.firm-btn.active { background: #EBF3FC; color: #185FA5; }
.firm-btn .ti { font-size: 15px; color: #aaa; flex-shrink: 0; }
.firm-btn.active .ti { color: #6498CE; }
.firm-short { font-weight: 600; min-width: 38px; }
.firm-full { font-size: 11px; color: #888; font-weight: 400; line-height: 1.3; }
.firm-btn.active .firm-full { color: #5a8fc0; }

/* Practice list */
.practice-list { display: flex; flex-direction: column; gap: 3px; }
.practice-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 7px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 12px;
  color: #444;
  transition: background .1s;
  width: 100%;
}
.practice-btn:hover { background: #f5f4f2; }
.practice-btn.active { background: #282828; color: white; }
.practice-btn .ti { font-size: 13px; color: #bbb; flex-shrink: 0; }
.practice-btn.active .ti { color: rgba(255,255,255,.7); }

/* History list */
.history-list { display: flex; flex-direction: column; gap: 3px; }
.history-item {
  padding: 9px 12px;
  border-radius: 7px;
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
  font-family: inherit;
  transition: background .1s;
}
.history-item:hover { background: #f5f4f2; }
.history-item.active { background: #f5f4f2; }
.history-row1 { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.history-tags { display: flex; gap: 4px; }
.history-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f0eeec;
  color: #666;
}
.history-tag.firm { background: #EBF3FC; color: #185FA5; }
.history-ago { font-size: 11px; color: #aaa; }
.history-row2 { font-size: 11px; color: #888; margin-top: 3px; }
.history-empty { font-size: 12px; color: #bbb; font-style: italic; padding: 4px 0; }

/* ─── Main content ───────────────────────────────────── */
#main {
  flex: 1;
  overflow-y: auto;
  padding: 28px 32px;
}

/* Welcome / empty state */
.welcome {
  margin-top: 60px;
  text-align: center;
  color: #aaa;
  font-size: 14px;
}
.welcome strong { display: block; font-size: 16px; font-weight: 500; color: #666; margin-bottom: 6px; }

/* Practice header (shown above results) */
.practice-header {
  margin-bottom: 22px;
}
.practice-header-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 10px; }
.practice-title { font-size: 20px; font-weight: 500; color: #1a1a1a; }
.practice-meta { font-size: 12px; color: #999; }

.action-row { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,.12);
  background: white;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
  color: #333;
  transition: background .1s, border-color .1s;
}
.action-btn:hover:not(:disabled) { background: #f5f4f2; border-color: rgba(0,0,0,.2); }
.action-btn.primary { background: #282828; color: white; border-color: #282828; }
.action-btn.primary:hover:not(:disabled) { background: #3a3a3a; }
.action-btn:disabled { opacity: .45; cursor: not-allowed; }
.action-btn .ti { font-size: 14px; }

.subtopic-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 16px; }
.chip-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,.1);
  background: white;
  font-family: inherit;
  font-size: 12px;
  color: #555;
  cursor: pointer;
  transition: background .1s;
}
.chip-btn:hover { background: #f5f4f2; }
.chip-btn.active { background: #6498CE; color: white; border-color: #6498CE; font-weight: 500; }

.spokesperson-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #EBF3FC;
  border-radius: 8px;
  margin-bottom: 22px;
}
.spk-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #282828; color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; letter-spacing: .03em; flex-shrink: 0;
}
.spk-name { font-size: 13px; font-weight: 500; color: #0C447C; }
.spk-creds { font-size: 11px; color: #185FA5; margin-top: 2px; line-height: 1.4; }

/* Loading state */
.loading-row {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 0; color: #888; font-size: 13px;
}
.spinner {
  width: 18px; height: 18px; flex-shrink: 0;
  border: 2px solid rgba(100,152,206,.3);
  border-top-color: #6498CE;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Results section header */
.results-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.results-label { font-size: 10px; letter-spacing: .12em; color: #999; font-weight: 600; }
.results-badge {
  font-size: 11px; background: #f0eeec; color: #888;
  padding: 3px 10px; border-radius: 4px; letter-spacing: .06em;
}
.results-badge.past { background: #f5f4f2; color: #888; font-size: 10px; }

/* Story cards */
.story-card {
  background: white;
  border: 1px solid rgba(0,0,0,.07);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 14px;
}
.story-top { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 8px; }
.story-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: #6498CE; color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.story-hed { font-size: 15px; font-weight: 500; line-height: 1.4; }
.story-hed a { color: #1a1a1a; text-decoration: none; border-bottom: 1px solid rgba(0,0,0,.15); }
.story-hed a:hover { color: #6498CE; border-bottom-color: #6498CE; }
.story-src { font-size: 12px; color: #999; font-style: italic; margin-bottom: 10px; }
.story-src a { color: #999; }
.story-sum { font-size: 13px; line-height: 1.6; margin-bottom: 13px; color: #333; }
.story-angle {
  background: #EBF3FC; border-left: 3px solid #6498CE;
  padding: 10px 13px; border-radius: 0 6px 6px 0; margin-bottom: 12px;
}
.angle-label { font-size: 10px; letter-spacing: .1em; color: #0C447C; font-weight: 600; margin-bottom: 4px; }
.angle-text { font-size: 12px; color: #185FA5; line-height: 1.5; }
.story-outlets { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.outlet-tag {
  font-size: 11px; padding: 3px 9px; border-radius: 4px;
  background: white; border: 1px solid rgba(0,0,0,.1); color: #555;
}
.outlet-tag.primary { background: #282828; color: white; border-color: #282828; }
.develop-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 10px 14px; border-radius: 6px;
  border: 1px solid rgba(0,0,0,.1); background: white;
  font-family: inherit; font-size: 11px; font-weight: 600;
  letter-spacing: .07em; color: #333; cursor: pointer;
  transition: background .1s;
}
.develop-btn:hover { background: #282828; color: white; }
.develop-btn:hover .ti { color: white; }
.develop-btn .ti { color: #aaa; font-size: 13px; }

/* My pick block */
.my-pick {
  background: #282828; color: white; border-radius: 10px;
  padding: 18px 20px; margin-top: 4px; margin-bottom: 14px;
}
.pick-label { font-size: 10px; letter-spacing: .12em; color: #6498CE; font-weight: 600; margin-bottom: 4px; }
.pick-title { font-size: 14px; font-weight: 500; margin-bottom: 8px; }
.pick-rationale { font-size: 13px; color: rgba(255,255,255,.8); line-height: 1.6; }

/* Advisor note */
.advisor-note {
  border: 1px solid rgba(0,0,0,.07); border-radius: 8px;
  padding: 13px 16px; background: #f9f8f6; margin-bottom: 14px;
}
.note-label { font-size: 10px; letter-spacing: .1em; color: #999; font-weight: 600; margin-bottom: 4px; }
.note-text { font-size: 13px; color: #555; line-height: 1.6; }

/* Deadline radar */
.deadline-bucket { margin-bottom: 20px; }
.deadline-bucket-label {
  font-size: 11px; font-weight: 600; letter-spacing: .08em;
  color: #888; padding-bottom: 8px; margin-bottom: 10px;
  border-bottom: 1px solid rgba(0,0,0,.07);
}
.deadline-item { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px solid rgba(0,0,0,.05); }
.deadline-item:last-child { border-bottom: 0; }
.deadline-date { font-size: 12px; font-weight: 600; color: #6498CE; min-width: 88px; flex-shrink: 0; padding-top: 1px; }
.deadline-body { font-size: 13px; line-height: 1.5; }
.deadline-name { font-weight: 500; margin-bottom: 2px; }
.deadline-why { font-size: 12px; color: #777; }

/* Pitch package */
.pitch-card {
  background: white; border: 1px solid rgba(0,0,0,.07);
  border-radius: 10px; padding: 22px; margin-top: 4px;
}
.pitch-section { margin-bottom: 18px; }
.pitch-section:last-child { margin-bottom: 0; }
.pitch-label { font-size: 10px; letter-spacing: .1em; color: #999; font-weight: 600; margin-bottom: 7px; }
.pitch-body { font-size: 14px; line-height: 1.65; color: #333; }
.pitch-list { padding-left: 18px; }
.pitch-list li { font-size: 14px; line-height: 1.65; margin-bottom: 5px; color: #333; }
.email-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: #282828; color: white; border: none;
  padding: 10px 18px; border-radius: 7px;
  font-size: 12px; font-weight: 500; cursor: pointer; font-family: inherit;
  margin-top: 8px;
}
.email-btn:hover { background: #3a3a3a; }

/* Error */
.error-msg { font-size: 13px; color: #c0392b; padding: 14px 0; }

/* Historical briefing banner */
.historical-banner {
  display: flex; align-items: center; justify-content: space-between;
  background: #fffbe6; border: 1px solid #ffe58f;
  border-radius: 8px; padding: 10px 14px; margin-bottom: 18px;
  font-size: 12px; color: #7a5c00;
}
.historical-banner button {
  background: none; border: none; cursor: pointer;
  font-size: 12px; color: #6498CE; font-family: inherit; padding: 0;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 3px; }
