/* ═══════════════════════════════════════════════════════════════════════════
   SAGE — Underwriting Analysis Tool
   Design System v2 (Sage Green + Gold palette)
   See STYLEGUIDE.md for full usage rules.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* ── Brand Colors ──────────────────────────────────────────────────────── */
  --sage:             #2F5D50; /* Primary — buttons, interactive, headings    */
  --sage-dark:        #1F3F36; /* Hover state, chat head, emphasis            */
  --sage-tint:        #E8F0EE; /* Light sage bg — hover zones, info panels    */
  --nav:              #182B25; /* Navbar, darkest surface                     */
  --gold:             #C2A56C; /* Accent — icons, badges, active tab bar      */
  --gold-text:        #96784A; /* Gold used as text (passes WCAG AA)          */

  /* ── Surface Colors ────────────────────────────────────────────────────── */
  --bg-page:          #F7F7F4; /* Page / body background                      */
  --bg-card:          #FFFFFF; /* Cards, modals, drop zones                   */
  --bg-subtle:        #EEF2EF; /* Panels, sticky columns — use sparingly      */

  /* ── Text Colors ───────────────────────────────────────────────────────── */
  --text-primary:     #1F1F1F;
  --text-secondary:   #4A4A4A;
  --text-muted:       #7A7A7A;
  --text-light:       #F5F7F6; /* Text on dark (nav / sage-dark) backgrounds  */

  /* ── Neutral Scale (warm-neutral, not cool blue-gray) ─────────────────── */
  --gray-50:          #F7F7F4;
  --gray-100:         #EFEFEC;
  --gray-200:         #E2E4E0;
  --gray-400:         #9A9E9B;
  --gray-500:         #737773;
  --gray-600:         #4A4A4A;
  --gray-700:         #3A3D3A;
  --gray-800:         #1F1F1F;

  /* ── Semantic Status Colors — DO NOT substitute with brand colors ─────── */
  --status-green:     #16a34a;
  --status-green-bg:  #dcfce7;
  --status-red:       #dc2626;
  --status-red-bg:    #fee2e2;
  --status-yellow:    #d97706;
  --status-yellow-bg: #fef3c7;
  --status-purple:    #6d28d9;
  --status-purple-bg: #f5f3ff;

  /* ── UI Action Colors (from brand mockup) ──────────────────────────────── */
  --danger:           #8B2A2A; /* Destructive actions — Remove/Delete buttons  */
  --danger-hover:     #7A2020; /* Hover state for danger buttons               */
  --amber:            #C48A2A; /* Filled amber — Awaiting/pending state badges */
  --amber-bg:         #FBF3E2; /* Soft amber bg — subtle pending/info badges   */

  /* ── Shadows & Radius ──────────────────────────────────────────────────── */
  --shadow-sm:  0 1px 2px rgba(0,0,0,.06);
  --shadow:     0 1px 4px rgba(0,0,0,.10);
  --shadow-md:  0 4px 12px rgba(0,0,0,.08);
  --radius:     8px;
}

*  { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
       background: var(--bg-page); color: var(--text-primary); font-size: 14px; line-height: 1.5; }

/* ── Header ─────────────────────────────────────────────── */
header {
  background: var(--nav);
  color: var(--text-light);
  padding: 0 24px;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 32px;
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 50;
}
/* Nav brand / logo area */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-logo {
  height: 38px;
  width: auto;
  display: block;
}
.nav-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
  gap: 3px;
}
.nav-brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: .18em;
  color: #CCB14A;
  text-transform: uppercase;
}
.nav-brand-tagline {
  font-size: .6rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.45);
  font-weight: 400;
}

/* ── Notification bell (R-071) ──────────────────────────────────────────── */
#bell-wrap {
  margin-left: auto;
  position: relative;
}
#bell-btn {
  background: none; border: none; cursor: pointer;
  font-size: 1.15rem; padding: 6px 8px; border-radius: 6px;
  position: relative; display: flex; align-items: center;
  color: rgba(255,255,255,.75);
  transition: background .15s;
}
#bell-btn:hover { background: rgba(255,255,255,.12); }
#bell-badge {
  position: absolute; top: 2px; right: 2px;
  background: #ef4444; color: #fff;
  font-size: .6rem; font-weight: 700; line-height: 1;
  min-width: 15px; height: 15px;
  border-radius: 9999px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--nav);
}
#bell-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 320px; max-height: 380px;
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: 8px; box-shadow: var(--shadow-md);
  z-index: 200; overflow: hidden;
  display: flex; flex-direction: column;
}
.bell-dropdown-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  font-size: .8rem; font-weight: 600; color: var(--text-primary);
}
#bell-list { overflow-y: auto; max-height: 320px; }
.bell-empty { padding: 20px 14px; font-size: .8rem; color: var(--gray-400); text-align: center; }
.bell-item {
  display: grid;
  grid-template-columns: 18px 1fr auto auto;
  align-items: start; gap: 6px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--gray-100);
  font-size: .78rem;
}
.bell-item:last-child { border-bottom: none; }
.bell-item-icon { font-size: .8rem; padding-top: 1px; }
.bell-item-ok   .bell-item-icon { color: var(--status-green); }
.bell-item-err  .bell-item-icon { color: var(--status-red); }
.bell-item-msg  { color: var(--text-primary); line-height: 1.4; }
.bell-view-btn  { font-size: .72rem; padding: 2px 7px; white-space: nowrap; }
.bell-item-age  { font-size: .7rem; color: var(--gray-400); white-space: nowrap; padding-top: 2px; }

/* status bar */
#status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .75rem;
  opacity: .8;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gray-400); display: inline-block; }
.status-dot.ok  { background: #4ade80; }
.status-dot.bad { background: #f87171; }

/* ── Nav tabs ───────────────────────────────────────────── */
nav { display: flex; gap: 2px; }
.tab-btn {
  display: inline-flex; align-items: center;
  text-decoration: none;
  background: transparent; border: none; color: rgba(255,255,255,.65);
  padding: 0 14px; height: 56px; cursor: pointer;
  font-size: .875rem; font-weight: 500; border-bottom: 3px solid transparent;
  transition: all .15s;
}
.tab-btn:hover  { color: #fff; background: rgba(255,255,255,.06); }
.tab-btn.active { color: #fff; border-bottom-color: var(--gold); }

/* ── Layout ─────────────────────────────────────────────── */
main { max-width: 1280px; margin: 0 auto; padding: 24px; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px; margin-bottom: 18px;
}
.card-header {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 14px; margin-bottom: 16px;
  border-bottom: 1px solid var(--gray-200);
}
.card-header h2 { font-size: 1rem; font-weight: 600; color: var(--sage); }
.card-header h3 { font-size: .9rem; font-weight: 600; color: var(--sage); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 14px; border-radius: 6px; border: none;
  cursor: pointer; font-size: .8rem; font-weight: 500;
  transition: all .15s; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--sage); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--sage-dark); }
.btn-success  { background: var(--status-green); color: #fff; }
.btn-danger   { background: var(--danger); color: #fff; font-size: .75rem; padding: 5px 10px; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn-ghost    { background: transparent; color: var(--gray-600); border: 1px solid var(--gray-200); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); }
.btn-lg       { padding: 10px 20px; font-size: .9rem; }

/* ── Drop zone ──────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--gray-200); border-radius: var(--radius);
  padding: 48px 24px; text-align: center; cursor: pointer;
  transition: all .2s; background: var(--bg-card);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--sage); background: var(--sage-tint);
}
.drop-zone .dz-icon  { font-size: 2.5rem; margin-bottom: 10px; }
.drop-zone .dz-title { font-size: 1rem; font-weight: 500; margin-bottom: 4px; }
.drop-zone .dz-sub   { font-size: .8rem; color: var(--gray-400); }
.drop-zone .dz-loading { color: var(--sage); font-weight: 500; }
.drop-zone.dz-error    { border-color: var(--red); background: var(--red-bg); }
.drop-zone.dz-error .dz-title { color: var(--red); }
/* Batch upload summary */
.batch-summary { padding: 8px 0; text-align: center; }
.batch-summary-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.batch-summary-lines { display: flex; flex-direction: column; gap: 4px; font-size: .875rem; }

/* ── Quick Lookup ───────────────────────────────────────── */
.ql-textarea {
  width: 100%; box-sizing: border-box;
  padding: 10px 12px; font-size: .875rem; line-height: 1.5;
  border: 1px solid var(--gray-200); border-radius: 6px;
  resize: vertical; font-family: inherit;
  transition: border-color .15s;
}
.ql-textarea:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 2px rgba(47,93,80,.12); }

/* Banner shown above quick-lookup results */
.ql-banner {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 10px 14px; margin-bottom: 16px;
  background: var(--sage-tint); border: 1px solid rgba(47,93,80,.25); border-radius: 7px;
  font-size: .8rem;
}
.ql-banner-label { font-weight: 700; color: var(--sage); white-space: nowrap; }
.ql-banner-desc {
  color: var(--gray-600); flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Profile ────────────────────────────────────────────── */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width:768px) { .profile-grid { grid-template-columns:1fr; } }

.profile-person {
  background: var(--bg-subtle); border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 16px;
}
.profile-person h3 { color: var(--sage); margin-bottom: 4px; font-size: .9rem; }
.profile-analyzed { font-size: .72rem; color: var(--sage); font-weight: 500; margin-bottom: 10px; }
.profile-analyzed.profile-not-analyzed { color: var(--gray-400); font-weight: 400; font-style: italic; }

.pf-row   { display: flex; gap: 6px; margin-bottom: 5px; font-size: .82rem; }
.pf-label { color: var(--gray-400); min-width: 110px; flex-shrink: 0; }
.pf-val   { color: var(--text-primary); }
.pf-val.alert { color: var(--status-red); font-weight: 600; }

.tag-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.tag {
  padding: 2px 8px; border-radius: 9999px; font-size: .72rem; font-weight: 500;
}
.tag-health { background: var(--status-red-bg); color: #991b1b; }
.tag-rx     { background: var(--sage-tint); color: var(--sage-dark); }
.tag-warn   { background: var(--status-yellow-bg); color: #92400e; }

/* ── Results Filter Bar ─────────────────────────────────── */
.results-filter-bar {
  display: flex; flex-wrap: wrap; gap: 10px;
  padding: 10px 0 14px; border-bottom: 1px solid var(--gray-100); margin-bottom: 14px;
}
.result-filtered-out { display: none !important; }

/* ── Results ────────────────────────────────────────────── */
.results-summary {
  background: var(--sage-tint); border: 1px solid rgba(47,93,80,.2);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px;
  font-size: .875rem; line-height: 1.6;
}

.person-section { margin-bottom: 32px; }
.person-section h3 {
  font-size: 1rem; color: var(--sage); font-weight: 600;
  margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 2px solid var(--sage);
}

/* ── Accordion (person-level + sub-level) ───────────────── */
.person-accordion,
.sub-accordion { border: none; }

.person-accordion > summary,
.sub-accordion  > summary { list-style: none; cursor: pointer; user-select: none; }
.person-accordion > summary::-webkit-details-marker,
.sub-accordion   > summary::-webkit-details-marker { display: none; }

.person-accordion-hdr {
  display: flex; align-items: center; gap: 8px;
  font-size: 1rem; font-weight: 700; color: var(--sage);
  padding: 10px 0 8px;
  border-bottom: 2px solid var(--sage);
  margin-bottom: 12px;
}
.person-accordion-hdr::before {
  content: '▶'; font-size: .65rem; color: var(--gray-400);
  display: inline-block; transition: transform .15s;
}
.person-accordion[open] > .person-accordion-hdr::before { transform: rotate(90deg); }
.person-accordion-body { padding-left: 0; margin-bottom: 8px; }

.sub-accordion { margin-bottom: 10px; }
.sub-accordion-hdr {
  display: flex; align-items: center; gap: 8px;
  font-size: .82rem; font-weight: 600; color: var(--gray-700);
  padding: 8px 12px;
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: 6px; margin-bottom: 0;
}
.sub-accordion-hdr::before {
  content: '▶'; font-size: .6rem; color: var(--gray-400);
  display: inline-block; transition: transform .15s; flex-shrink: 0;
}
.sub-accordion[open] > .sub-accordion-hdr::before { transform: rotate(90deg); }
.sub-accordion-hdr-declined { color: var(--gray-500); }
.sub-accordion-body { padding: 10px 0 0; }

.acc-count {
  background: var(--gray-200); color: var(--gray-600);
  border-radius: 9999px; padding: 1px 7px;
  font-size: .7rem; font-weight: 600;
}
.acc-count-declined { background: var(--status-red-bg); color: var(--status-red); }
.acc-empty { padding: 10px 4px; font-size: .8rem; color: var(--gray-400); }

/* ── Excluded (declined) items ───────────────────────────── */
.excluded-list { display: flex; flex-direction: column; gap: 5px; }
.excl-item {
  display: flex; flex-direction: column; gap: 3px;
  padding: 7px 10px; border-radius: 5px;
  background: var(--gray-50); border-left: 3px solid var(--gray-200);
  font-size: .8rem;
}
.excl-item-hdr { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.excl-name { font-weight: 600; color: var(--gray-700); }
.excl-reason { color: var(--gray-500); font-size: .77rem; }
/* Conditions breakdown list */
.excl-conditions {
  list-style: none; margin: 4px 0 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 3px;
  border-top: 1px solid var(--gray-200); padding-top: 5px;
}
.excl-condition-item {
  display: flex; flex-direction: column; gap: 1px;
  padding: 3px 6px; border-radius: 3px;
  background: var(--status-red-bg);
}
.excl-cond-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.excl-cond-name {
  font-weight: 600; font-size: .75rem; color: var(--status-red);
}
.excl-cond-src {
  font-size: .68rem; color: var(--blue); background: var(--blue-light);
  padding: 1px 6px; border-radius: 9999px; white-space: nowrap;
}
.excl-cond-rule {
  font-size: .72rem; color: var(--gray-600);
}
.excl-cond-quote {
  font-size: .7rem; color: var(--gray-500); font-style: italic;
  border-left: 2px solid var(--gray-200); padding-left: 6px; margin-top: 2px;
}

#section-results { scroll-margin-top: 64px; }

/* ── Result cards ───────────────────────────────────────── */
.results-list { display: flex; flex-direction: column; gap: 10px; }

.result-block {
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-card);
}
.result-yes       { border-left: 4px solid var(--status-green); }
.result-no        { border-left: 4px solid var(--status-red); }
.result-uncertain { border-left: 4px solid var(--status-yellow); }

.result-hdr {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px;
  padding: 9px 14px;
  background: var(--sage-tint);
  border-bottom: 1px solid rgba(47,93,80,.12);
}
.result-hdr-left  { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.result-hdr-right { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }

.result-carrier    { font-weight: 700; font-size: .85rem; color: var(--sage); }
.result-sep        { color: var(--gray-400); }
.result-product    { font-size: .85rem; font-weight: 500; color: var(--text-primary); }
.result-type       { font-size: .68rem; color: var(--sage-dark); background: rgba(47,93,80,.10);
                     padding: 1px 7px; border-radius: 9999px; font-weight: 500; }
.result-best-class {
  font-size: .72rem; font-weight: 600;
  color: var(--sage-dark); background: rgba(47,93,80,.10);
  padding: 2px 8px; border-radius: 9999px;
  border: 1px solid rgba(47,93,80,.25);
}

.result-body      { padding: 12px 14px; font-size: .8rem; }
.result-reasoning { font-size: .8rem; margin-bottom: 8px; color: var(--gray-600); line-height: 1.5; }
.result-source-docs { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--gray-100); font-size: .72rem; color: var(--gray-500); display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.result-source-chip { cursor: pointer; font-size: .7rem; padding: 2px 8px; border-left-width: 2px !important; text-transform: capitalize; }
.result-source-chip:hover { background: var(--sage-light, #f0f7f0); border-color: var(--sage) !important; color: var(--sage-dark, #2d5a27); }

/* ── Collapsible result blocks (R-073) ───────────────────────────────────── */
.result-hdr { cursor: pointer; }
.result-hdr:hover { background: rgba(47,93,80,.10); }
.result-toggle-icon { font-size: .65rem; color: var(--gray-400); flex-shrink: 0; transition: transform .15s; }
.result-block.result-collapsed .result-body { display: none; }
.result-block.result-collapsed .result-toggle-icon { transform: rotate(-90deg); }

.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 9999px; font-size: .72rem; font-weight: 700;
}
.badge-yes  { background: var(--status-green-bg);  color: var(--status-green); }
.badge-no   { background: var(--status-red-bg);    color: var(--status-red);   }
.badge-unc  { background: var(--status-yellow-bg); color: var(--status-yellow);}
.badge-conf { background: var(--gray-100); border: 1px solid var(--gray-200);
              color: var(--gray-500); font-weight: 500; margin-left: 4px; }

/* source tag */
.src-carrier { color: var(--sage);          font-size: .68rem; font-weight: 500; }
.src-cheat   { color: var(--status-yellow); font-size: .68rem; }
.src-unknown { color: var(--gray-400);      font-size: .68rem; }

.conditions-list { display: flex; flex-direction: column; gap: 6px; }

/* Disqualifying / uncertain conditions — prominent */
.cond-item {
  font-size: .78rem; line-height: 1.5; padding: 6px 10px;
  border-radius: 4px; border-left: 3px solid transparent;
}
.cond-item .cond-name { font-weight: 700; }
.cond-item .cond-finding { color: var(--text-secondary); }
.cond-item .cond-rule { opacity: .65; font-size: .72rem; }

.cond-bad {
  color: var(--text-primary);
  background: var(--status-red-bg);
  border-left-color: var(--status-red);
}
.cond-bad .cond-name { color: var(--status-red); }

.cond-unc {
  color: var(--text-primary);
  background: var(--status-yellow-bg);
  border-left-color: var(--status-yellow);
}
.cond-unc .cond-name { color: var(--status-yellow); }

/* OK conditions — toned down */
.cond-ok {
  color: var(--gray-500); font-size: .72rem;
  padding: 2px 10px; border-left-color: transparent;
}
.cond-ok .cond-name { font-weight: 600; color: var(--gray-500); }
.cond-ok .cond-finding { color: var(--gray-400); }

/* Separator between attention items and OK items */
.cond-ok-divider {
  border: none; border-top: 1px dashed var(--gray-200);
  margin: 6px 0 2px;
}

/* Application questions inline under each condition */
.app-questions {
  margin-top: 5px; margin-left: 14px;
  display: flex; flex-direction: column; gap: 3px;
}
.app-question {
  background: var(--gray-50); border-left: 2px solid var(--sage);
  padding: 4px 8px; border-radius: 0 4px 4px 0;
  font-size: .7rem; color: var(--text-primary); line-height: 1.6;
}
.aq-label  { font-weight: 700; color: var(--sage); }
.aq-text   { font-style: italic; color: var(--gray-600); }
.aq-answer { font-weight: 500; }
.aq-yes   { color: var(--status-red); }
.aq-no    { color: var(--status-green); }
.aq-na    { color: var(--gray-400); }

.flag-list { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.flag-item { font-size: .75rem; color: var(--amber); }
.flag-item::before { content: "⚠ "; }

/* ── Appointment Questions ──────────────────────────────── */
.appt-q-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-100);
}
.appt-q-item:last-child { border-bottom: none; }
.appt-q-content { flex: 1; min-width: 0; }
.appt-q-text { font-size: .88rem; color: var(--gray-800); line-height: 1.4; }
.appt-q-relevance {
  font-size: .78rem;
  color: var(--gray-400);
  margin-top: 3px;
  font-style: italic;
}
.appt-q-actions { display: flex; gap: 2px; flex-shrink: 0; }

/* ── Chat ───────────────────────────────────────────────── */
.chat-wrap { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.chat-head { background: var(--sage-dark); color: var(--text-light); padding: 11px 16px; font-weight: 600; font-size: .875rem; }
.chat-msgs {
  padding: 16px; min-height: 80px; max-height: 380px;
  overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
}
.chat-msg { max-width: 80%; padding: 9px 13px; border-radius: 8px; font-size: .83rem; line-height: 1.5; white-space: pre-wrap; }
.chat-msg.user  { align-self: flex-end; background: var(--sage); color: #fff; border-radius: 8px 8px 2px 8px; }
.chat-msg.asst  { align-self: flex-start; background: var(--gray-100); color: var(--text-primary); border-radius: 8px 8px 8px 2px; }
.chat-input-row { display: flex; gap: 8px; padding: 11px; border-top: 1px solid var(--gray-200); }
.chat-input-row input {
  flex: 1; padding: 7px 11px; border: 1px solid var(--gray-200);
  border-radius: 6px; font-size: .83rem;
}
.chat-input-row input:focus { outline: none; border-color: var(--sage); }

/* ── Knowledge Base ─────────────────────────────────────── */
.kb-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.kb-top h2 { font-size: 1.1rem; font-weight: 600; color: var(--sage); }

/* Product filter bar */
.kb-filter-bar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.filter-group  { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.filter-group-label {
  font-size: .7rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .07em;
  min-width: 112px; flex-shrink: 0;
}
.filter-btn {
  padding: 4px 14px; border-radius: 20px;
  border: 1.5px solid var(--gray-200);
  background: var(--bg-card); color: var(--gray-600);
  font-size: .76rem; font-weight: 500;
  cursor: pointer; transition: all .15s; line-height: 1.6;
}
.filter-btn:hover { border-color: var(--sage); color: var(--sage); }
.filter-btn.active { background: var(--sage); border-color: var(--sage); color: #fff; }

.carrier-card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 10px; overflow: hidden; }
.carrier-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; cursor: pointer; user-select: none;
  background: var(--sage);
}
.carrier-hdr h3 { font-size: .9rem; color: #fff; font-weight: 600; }
.carrier-hdr .meta { font-size: .75rem; color: rgba(255,255,255,.6); font-weight: 400; margin-left: 6px; }
.carrier-hdr-actions { display: flex; gap: 6px; align-items: center; }

/* Buttons inside the dark header */
.carrier-hdr .btn-ghost {
  color: rgba(255,255,255,.85); border-color: rgba(255,255,255,.35);
}
.carrier-hdr .btn-ghost:hover { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.7); color: #fff; }
.carrier-hdr .btn-danger { background: rgba(185,28,28,.75); border-color: transparent; }
.carrier-hdr .btn-danger:hover:not(:disabled) { background: #b91c1c; }

/* Accordion caret */
.carrier-caret {
  color: rgba(255,255,255,.7); font-size: .85rem; margin-left: 8px;
  display: inline-block; transition: transform .2s ease;
}
.carrier-card.collapsed .carrier-caret { transform: rotate(-90deg); }

.carrier-body { padding: 0 18px 18px; border-top: 1px solid var(--sage-dark); }

.product-list { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; }
.product-item {
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: 6px; padding: 12px 14px;
}
.product-hdr { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.product-name { font-weight: 600; font-size: .85rem; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.product-type { font-size: .72rem; color: var(--gray-400); margin-top: 2px; }
.product-status { font-size: .72rem; padding: 2px 7px; border-radius: 9999px; }

/* Preferred ★ and Instant ⚡ product badges */
.badge-preferred    { font-size: .68rem; background: #FBF3E2; color: var(--gold-text); border: 1px solid var(--gold); border-radius: 4px; padding: 1px 5px; font-weight: 700; white-space: nowrap; }
.badge-instant      { font-size: .68rem; background: var(--sage-tint); color: var(--sage-dark); border: 1px solid var(--sage); border-radius: 4px; padding: 1px 5px; font-weight: 700; white-space: nowrap; }
.badge-accelerated  { font-size: .68rem; background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-200); border-radius: 4px; padding: 1px 5px; font-weight: 600; white-space: nowrap; }
/* Quote link button */
.btn-quote          { font-size: .72rem; padding: 2px 8px; color: var(--blue); text-decoration: none; white-space: nowrap; }
.btn-quote:hover    { background: var(--blue-light); text-decoration: none; }
.btn-quote-result   { font-size: .78rem; padding: 3px 10px; }
/* E-App link button */
.btn-eapp           { font-size: .72rem; padding: 2px 8px; color: var(--sage-dark); text-decoration: none; white-space: nowrap; }
.btn-eapp:hover     { background: var(--sage-tint); text-decoration: none; }
.btn-eapp-result    { font-size: .78rem; padding: 3px 10px; }
.status-processed { background: var(--sage-tint); color: var(--sage-dark); border: 1px solid rgba(47,93,80,.20); }
.status-pending   { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(196,138,42,.25); }

.file-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.file-chip {
  display: flex; align-items: center; gap: 4px;
  background: var(--bg-card); border: 1px solid var(--gray-200);
  border-left-width: 3px;
  border-radius: 4px; padding: 3px 7px; font-size: .72rem;
}
/* Processed = green left accent */
.file-chip-done {
  background: #f0fdf4;
  border-color: rgba(22,101,52,.2);
  border-left-color: var(--status-green);
}
/* Uploaded but not yet extracted = amber left accent */
.file-chip-pending {
  background: var(--amber-bg);
  border-color: rgba(196,138,42,.25);
  border-left-color: var(--amber);
}
.file-chip-icon { font-size: .65rem; line-height: 1; flex-shrink: 0; }
.file-chip button { background: none; border: none; cursor: pointer; color: var(--danger); font-size: .875rem; line-height: 1; padding: 0; }
.file-chip-link { color: var(--sage); text-decoration: none; }
.file-chip-link:hover { text-decoration: underline; color: var(--sage-dark); }

.product-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.product-actions select {
  padding: 5px 8px; border: 1px solid var(--gray-200); border-radius: 4px;
  font-size: .75rem; background: var(--bg-card);
}
.product-summary-box {
  margin-top: 10px; padding: 8px 10px;
  background: var(--sage-tint); border-radius: 4px;
  font-size: .75rem; color: var(--sage-dark); line-height: 1.4;
}

/* ── Corrections section (per product in KB) ─────────────── */
.corrections-section { margin-top: 8px; }
.corrections-details { border-top: 1px solid var(--gray-100); margin-top: 6px; }
.corrections-summary {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 0; font-size: .75rem; font-weight: 600; color: var(--sage);
  cursor: pointer; list-style: none; user-select: none;
}
.corrections-summary::-webkit-details-marker { display: none; }
.correction-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--sage); color: #fff;
  border-radius: 9px; font-size: .68rem; font-weight: 700;
}
.corrections-add-btn {
  margin-left: auto; font-size: .7rem; padding: 2px 8px;
  color: var(--sage); border-color: var(--sage);
}
.corrections-body { padding: 6px 0 4px 0; display: flex; flex-direction: column; gap: 5px; }
.corrections-empty { font-size: .75rem; color: var(--gray-400); padding: 4px 0; font-style: italic; }
.correction-item {
  position: relative;
  padding: 7px 32px 7px 10px;
  background: var(--status-yellow-bg);
  border: 1px solid #fde68a;
  border-radius: 5px;
  font-size: .78rem;
}
.correction-condition { font-weight: 700; color: var(--gray-700); margin-bottom: 2px; }
.correction-text { color: var(--gray-700); line-height: 1.4; }
.correction-meta { font-size: .7rem; color: var(--gray-500); margin-top: 3px; }
.correction-del-btn {
  position: absolute; top: 5px; right: 5px;
  font-size: .65rem; padding: 1px 5px; color: var(--gray-400);
}
.correction-del-btn:hover { color: var(--status-red); }

/* "Save as Correction" button in chat messages */
.chat-save-correction-btn {
  display: block; margin-top: 8px; font-size: .7rem;
  padding: 3px 9px; color: var(--sage); border-color: var(--sage);
}
.chat-save-correction-btn:hover { background: var(--sage-tint); }

/* Inactive product */
.product-inactive { opacity: .45; }

/* Active/inactive toggle */
.product-active-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  cursor: pointer; user-select: none; font-size: .72rem; color: var(--gray-600);
}
.product-active-toggle input { display: none; }
.toggle-track {
  width: 28px; height: 16px; border-radius: 8px; background: var(--gray-200);
  position: relative; transition: background .2s; flex-shrink: 0;
}
.toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff; transition: transform .2s;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.product-active-toggle input:checked + .toggle-track { background: var(--sage); }
.product-active-toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(12px); }

/* ── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 200;
}
.modal {
  background: var(--bg-card); border-radius: var(--radius); padding: 24px;
  min-width: 360px; max-width: 90vw; box-shadow: var(--shadow-md);
}
.modal h3 { color: var(--sage); margin-bottom: 16px; font-size: 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.form-field { margin-bottom: 14px; }
.form-field label { display: block; margin-bottom: 5px; font-size: .8rem; font-weight: 500; }
.form-field input,
.form-field select,
.form-field textarea {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--gray-200); border-radius: 5px;
  font-size: .83rem; font-family: inherit;
}
.form-field textarea { resize: vertical; min-height: 60px; }
.form-field input:focus,
.form-field select:focus { outline: none; border-color: var(--sage); }

/* ── History ────────────────────────────────────────────── */
/* Client search bar */
.history-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}
.history-search-icon {
  position: absolute;
  left: 10px;
  font-size: .85rem;
  pointer-events: none;
  opacity: .5;
}
.history-search-input {
  width: 100%;
  padding: 7px 32px 7px 32px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: .85rem;
  background: var(--gray-100);
  color: var(--text-primary);
  outline: none;
  transition: border-color .15s, background .15s;
}
.history-search-input:focus {
  border-color: var(--sage);
  background: var(--bg-card);
}
.history-search-input::placeholder { color: var(--text-muted); }
.history-search-clear {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: .8rem;
  color: var(--text-muted);
  padding: 2px 4px;
  line-height: 1;
  border-radius: 3px;
}
.history-search-clear:hover { color: var(--text-primary); background: var(--gray-200); }

.history-section-hdr {
  font-size: .75rem; font-weight: 700; color: var(--gray-600);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 8px 2px 6px;
  display: flex; align-items: center; gap: 8px;
}
.history-section-count {
  font-size: .7rem; background: var(--gray-200); color: var(--gray-600);
  border-radius: 9999px; padding: 1px 7px; font-weight: 600;
}
.history-item {
  background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow-sm);
  margin-bottom: 8px; transition: box-shadow .15s;
  display: flex; align-items: stretch;
  border-left: 4px solid transparent; overflow: hidden;
}
.history-item:hover { box-shadow: var(--shadow-md); }
.history-item.hi-status-green  { border-left-color: var(--status-green);  background: #f6fdf7; }
.history-item.hi-status-yellow { border-left-color: var(--status-yellow); background: #fffdf0; }
.hi-main { flex: 1; padding: 12px 12px 10px 12px; cursor: pointer; min-width: 0; }
.hi-top-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hi-name { font-weight: 600; font-size: .9rem; color: var(--sage); flex: 1; min-width: 0; }
.hi-meta-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 5px; }
.hi-meta-item { font-size: .75rem; color: var(--gray-600); }
.hi-meta-item a { color: var(--gray-600); text-decoration: none; }
.hi-meta-item a:hover { text-decoration: underline; color: var(--blue); }
.hi-filename { font-size: .7rem; color: var(--gray-400); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Search result snippets */
.hi-snippets {
  margin-top: 6px; padding-top: 6px;
  border-top: 1px dashed var(--gray-200);
  display: flex; flex-direction: column; gap: 3px;
}
.hi-snippet {
  font-size: .72rem; color: var(--gray-600); line-height: 1.4;
  word-break: break-word;
}
.hi-snippet-label {
  font-weight: 600; color: var(--sage-dark); font-size: .68rem;
}
.hi-snippet mark {
  background: rgba(255, 200, 50, .35); color: inherit;
  padding: 0 1px; border-radius: 2px; font-weight: 600;
}

.hi-edit-btn {
  background: none; border: none; cursor: pointer;
  padding: 0 12px; font-size: .85rem; color: var(--gray-400);
  border-left: 1px solid var(--gray-100); flex-shrink: 0; display: flex; align-items: center;
}
.hi-edit-btn:hover { color: var(--blue); background: var(--gray-50); }
.history-item .hi-badge {
  font-size: .7rem; padding: 2px 8px; border-radius: 9999px;
  background: var(--sage-tint); color: var(--sage-dark); font-weight: 500;
  white-space: nowrap; flex-shrink: 0; align-self: flex-start;
  cursor: default;
}
.history-item .hi-badge.pending { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(196,138,42,.25); }
.history-item .hi-badge-persons { display: flex; gap: 4px; padding: 2px 4px; background: transparent; }
.hi-person-dot {
  font-size: .68rem; font-weight: 600; padding: 2px 7px; border-radius: 9999px;
  white-space: nowrap; cursor: default;
}
.hi-person-dot.done    { background: var(--sage-tint); color: var(--sage-dark); }
.hi-person-dot.pending { background: var(--amber-bg);  color: var(--amber);     border: 1px solid rgba(196,138,42,.25); }

/* ── Misc ───────────────────────────────────────────────── */
.loading { display: inline-flex; align-items: center; gap: 7px; color: var(--gray-400); }
.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--gray-200); border-top-color: var(--sage);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.alert { padding: 11px 14px; border-radius: 5px; font-size: .83rem; margin-bottom: 12px; }
.alert-error   { background: var(--status-red-bg);    color: var(--status-red);    }
.alert-warn    { background: var(--status-yellow-bg); color: var(--status-yellow); }
.alert-success { background: var(--status-green-bg);  color: var(--status-green);  }
.alert-info    { background: var(--sage-tint);         color: var(--sage-dark);     }

.empty-state {
  text-align: center; padding: 48px 24px; color: var(--gray-400);
}
.empty-state .es-icon { font-size: 2.5rem; margin-bottom: 10px; }
.empty-state p { font-size: .875rem; }

.section-divider {
  border: none; border-top: 1px solid var(--gray-200); margin: 20px 0;
}

/* cheat sheet info panel */
.cheat-panel { background: #FBF3E2; border: 1px solid var(--gold); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.cheat-panel h4 { color: var(--gold-text); margin-bottom: 6px; font-size: .85rem; }
.cheat-panel p  { font-size: .78rem; color: var(--gold-text); }

/* ── Carrier Rep Contact ─────────────────────────────────── */
.contact-section {
  margin: 0 -18px 14px -18px;
  padding: 9px 18px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--gray-200);
}
.contact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: .78rem;
}
.contact-field {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-primary);
}
.contact-field a { color: var(--sage); text-decoration: none; }
.contact-field a:hover { text-decoration: underline; }
.contact-lbl {
  font-size: .66rem;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .04em;
  flex-shrink: 0;
}
.contact-edit-btn {
  margin-left: auto;
  font-size: .72rem !important;
  padding: 3px 9px !important;
}
.contact-empty {
  color: var(--gray-400);
  font-size: .75rem;
}

/* ── Reference Tab Full-Height Layout ───────────────────── */
#tab-ref.active {
  display: flex;
  flex-direction: column;
  margin-top: -24px;
  height: calc(100vh - 80px);
  border-radius: 0;
}
#tab-ref .card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}
#tab-ref #ref-grid-area {
  flex: 1;
  min-height: 0;
  flex-direction: column;
}
#tab-ref .ref-grid-wrap {
  flex: 1;
  min-height: 0;
  max-height: none;
}

/* ── Reference Grid ─────────────────────────────────────── */
.ref-grid-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 65vh;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
}

.ref-table {
  border-collapse: collapse;
  font-size: .72rem;
  width: 100%;
}

/* Sticky header row */
.ref-table thead th {
  background: var(--sage);
  color: #fff;
  padding: 8px 12px;
  position: sticky;
  top: 0;
  z-index: 2;
  font-weight: 500;
  border-right: 1px solid rgba(255,255,255,.15);
  text-align: left;
  white-space: normal;
  min-width: 110px;
}

/* Sticky first column header (top-left corner) */
.ref-table thead th.ref-th-condition {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 3;
  min-width: 210px;
  max-width: 210px;
  background: var(--nav);
}

/* All data cells */
.ref-table td {
  padding: 5px 10px;
  border-bottom: 1px solid var(--gray-200);
  border-right: 1px solid var(--gray-200);
  max-width: 150px;
  white-space: normal;
  word-wrap: break-word;
  vertical-align: top;
  cursor: default;
}

/* Sticky first column data cells */
.ref-table td.ref-td-condition {
  position: sticky;
  left: 0;
  background: var(--bg-subtle);
  z-index: 1;
  font-weight: 500;
  color: var(--text-primary);
  min-width: 210px;
  max-width: 210px;
  border-right: 2px solid var(--gray-200);
}

.ref-table tr:hover td { filter: brightness(.96); }
.ref-table tr:hover td.ref-td-condition { background: var(--gray-100); }

/* Cell handling color classes — semantic, do not change to brand colors */
.ref-allow   { background: var(--status-green-bg);  color: #15803d; font-weight: 500; }
.ref-decline { background: var(--status-red-bg);    color: #dc2626; font-weight: 500; }
.ref-table-r { background: var(--status-yellow-bg); color: #b45309; font-weight: 500; }
.ref-restrict{ background: var(--status-purple-bg); color: #6d28d9; font-weight: 500; }
.ref-unknown { background: var(--gray-50);          color: var(--gray-400); }

/* First-column row type colors */
.ref-row-carrier { background: var(--gray-200) !important; color: var(--gray-600); }
.ref-row-misc    { background: #fff3e0 !important;          color: #7c4700; font-weight: 600; }
.ref-row-bg      { background: #f0fdf4 !important;          color: #166534; }

/* Prescription Knockouts — single summary row */
.ref-row-drug-knockout td {
  border-top: 2px solid #fca5a5;
  vertical-align: top;
}
.ref-drug-label {
  background: #fef2f2 !important;
  color: #991b1b !important;
  font-weight: 700;
  font-size: .78rem;
}
.ref-drug-blob {
  background: #fff8f8;
  font-size: .68rem;
  line-height: 1.6;
  white-space: normal;
  max-width: 220px;
  padding: 5px 8px;
}
.drug-blob-count {
  display: inline-block;
  font-weight: 700;
  color: #991b1b;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-radius: 9999px;
  padding: 0 6px;
  font-size: .65rem;
  margin-right: 3px;
  white-space: nowrap;
}
.drug-blob-names {
  color: var(--gray-600);
}

/* ── Analysis Type Filter ─────────────────────────────────────────────────── */
.type-filter-opt {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .78rem;
  color: var(--gray-700);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.type-filter-opt input[type=checkbox] {
  accent-color: var(--sage);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* ── Living Benefits Reference Section ───────────────────────────────────── */
.ref-row-lb-header td {
  background: #14532d !important;
  color: #fff !important;
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-top: 3px solid #166534;
}
.ref-lb-section-label {
  text-align: left;
}
.ref-row-living-benefit td {
  vertical-align: top;
}
.ref-lb-label {
  background: #f0fdf4 !important;
  color: #166534 !important;
  font-weight: 600;
  font-size: .78rem;
}
.ref-lb-cell {
  background: #f0fdf4;
  font-size: .72rem;
  line-height: 1.5;
  white-space: normal;
  max-width: 200px;
  padding: 5px 8px;
  color: #15803d;
}
.lb-check {
  font-size: .7rem;
  margin-right: 3px;
  opacity: .75;
}

/* ── File Coverage Modal ──────────────────────────────────────────────────── */
.fc-modal {
  min-width: min(960px, 94vw);
  max-width: 94vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.fc-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.fc-modal-header h3 { margin: 0; }
.fc-table-wrap {
  overflow: auto;
  flex: 1;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
}
.fc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.fc-table thead th {
  background: var(--bg-subtle);
  padding: 8px 10px;
  text-align: center;
  font-weight: 600;
  font-size: .75rem;
  color: var(--gray-600);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom: 2px solid var(--gray-200);
}
.fc-th-product {
  text-align: left !important;
  min-width: 170px;
}
.fc-carrier-row td {
  background: var(--sage-tint);
  color: var(--sage-dark);
  font-weight: 700;
  font-size: .78rem;
  padding: 6px 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.fc-product-row td {
  border-bottom: 1px solid var(--gray-100);
}
.fc-td-product {
  text-align: left;
  padding: 8px 12px;
  color: var(--gray-800);
  min-width: 170px;
}
.fc-td {
  text-align: center;
  padding: 6px 8px;
  min-width: 88px;
  vertical-align: middle;
}
.fc-ok {
  font-size: 1.1rem;
  cursor: default;
  display: block;
}
.fc-pending-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.fc-extract-btn {
  font-size: .68rem;
  padding: 2px 8px;
  background: var(--sage-tint);
  color: var(--sage-dark);
  border: 1px solid rgba(47,93,80,.2);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.6;
}
.fc-extract-btn:hover { background: var(--sage); color: #fff; }
.fc-extract-btn:disabled { opacity: .55; cursor: default; }
.fc-add-btn {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin: auto;
  border-radius: 6px;
  color: var(--gray-400);
  font-size: .9rem;
  border: 1px dashed var(--gray-300);
  transition: background .15s, color .15s, border-color .15s;
}
.fc-add-btn:hover {
  background: var(--sage-tint);
  color: var(--sage);
  border-color: var(--sage);
}
.fc-legend {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  font-size: .75rem;
  color: var(--gray-500);
  flex-wrap: wrap;
}

/* Reference cell match highlight (search hit in a cell value, not condition name) */
.ref-cell-match { box-shadow: inset 0 0 0 2px var(--gold) !important; }
.ref-search-hl  { background: #FEF3AA; color: #6B4A00; border-radius: 2px; padding: 0 1px; font-weight: 700; }

/* Carrier-info link cells */
.ref-cell-link {
  position: relative; padding: 4px 6px !important;
  background: var(--gray-50);
}
.ref-cell-link a {
  color: var(--blue); text-decoration: none; font-size: .75rem;
  word-break: break-all;
}
.ref-cell-link a:hover { text-decoration: underline; }
.ref-cell-link-empty {
  cursor: pointer; color: var(--gray-400);
}
.ref-cell-link-empty:hover { background: #e8f0fe; }
.ref-link-placeholder { color: var(--gray-300); font-style: italic; font-size: .7rem; }
.ref-link-text { font-size: .75rem; color: var(--gray-600); }
.ref-link-edit {
  display: none; position: absolute; top: 2px; right: 2px;
  background: none; border: none; cursor: pointer;
  font-size: .65rem; color: var(--gray-400); padding: 1px 3px;
  border-radius: 3px;
}
.ref-cell-link:hover .ref-link-edit { display: block; }
.ref-link-edit:hover { background: var(--gray-100); color: var(--blue); }

/* ── CQF PDF Modal ────────────────────────────────────────────────────────── */
.pdf-modal {
  min-width: min(1200px, 96vw);
  max-width: 96vw;
}

/* ── Toast notifications ──────────────────────────────────────────────────── */
#toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 10000;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--gray-200);
  border-radius: var(--radius); padding: 12px 14px;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  min-width: 280px; max-width: 420px;
  opacity: 0; transform: translateX(100%);
  transition: opacity .3s ease, transform .3s ease;
}
.toast-visible { opacity: 1; transform: translateX(0); }
.toast-success { border-left: 4px solid var(--status-green); }
.toast-error   { border-left: 4px solid var(--danger); }
.toast-body    { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toast-icon    { font-weight: 700; font-size: .9rem; }
.toast-success .toast-icon { color: var(--status-green); }
.toast-error   .toast-icon { color: var(--danger); }
.toast-msg     { font-size: .82rem; color: var(--text-primary); line-height: 1.4; }
.toast-action  {
  background: var(--sage); color: #fff; border: none; border-radius: 4px;
  padding: 4px 10px; font-size: .75rem; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.toast-action:hover { background: var(--sage-dark); }
.toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--gray-400); font-size: .85rem; padding: 0 2px; line-height: 1;
}
.toast-close:hover { color: var(--gray-600); }
.toast-navigable .toast-body { cursor: pointer; }
.toast-navigable .toast-body:hover .toast-msg { text-decoration: underline; }
.bell-item-nav { cursor: pointer; }
.bell-item-nav:hover { background: var(--gray-50); }

/* ── Roadmap ─────────────────────────────────────────────────────────────── */
.roadmap-form {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.roadmap-form-row { display: flex; flex-direction: column; gap: 4px; }
.roadmap-form-inline { display: flex; gap: 12px; flex-wrap: wrap; }
.roadmap-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: .875rem;
  font-family: inherit;
  box-sizing: border-box;
}
.roadmap-input:focus { outline: 2px solid var(--blue); border-color: transparent; }
textarea.roadmap-input { resize: vertical; }
.roadmap-form-actions { display: flex; gap: 8px; }

.rm-section-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-600);
  padding: 6px 0 8px;
  border-bottom: 2px solid var(--gray-100);
  margin-bottom: 12px;
  cursor: pointer;
  user-select: none;
}
.rm-section-hdr:hover { opacity: .85; }
.rm-section-pending .rm-section-hdr { color: var(--amber); border-bottom-color: #F0D599; }
.rm-section-queued  .rm-section-hdr { color: #6D3FCC; border-bottom-color: #E5D9FA; }
.rm-section-queued  .rm-section-count { background: #EEE4FF; color: #6D3FCC; }
.rm-section-hdr-done { cursor: pointer; list-style: none; }
.rm-section-hdr-done::-webkit-details-marker { display: none; }
.rm-hdr-right { display: flex; align-items: center; gap: 8px; }
.rm-chevron {
  display: inline-block;
  width: 16px; height: 16px;
  position: relative;
  flex-shrink: 0;
}
.rm-chevron::before {
  content: '';
  display: block;
  width: 7px; height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  position: absolute;
  top: 2px; left: 4px;
  transition: transform .2s;
}
details[open] > summary .rm-chevron::before {
  transform: rotate(-135deg);
  top: 5px;
}
details.rm-section { margin-bottom: 28px; }
.rm-section-count {
  background: var(--gray-200);
  color: var(--gray-600);
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  padding: 1px 8px;
  min-width: 22px;
  text-align: center;
}
.rm-section-pending .rm-section-count { background: var(--amber-bg); color: var(--amber); }
.rm-done-list { margin-top: 10px; }
.rm-empty {
  color: var(--gray-400);
  font-size: .875rem;
  padding: 20px 0;
  text-align: center;
}

.rm-card {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  background: #fff;
  transition: box-shadow .15s;
}
.rm-card:hover { box-shadow: var(--shadow-sm); }
.rm-card-queued {
  border-left: 3px solid #9B6DE8;
}
.rm-card-pending_verification {
  border-left: 3px solid var(--amber);
  background: var(--amber-bg);
}
.rm-card-done {
  opacity: .65;
  background: var(--gray-50);
}
.rm-card-hdr {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.rm-card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.rm-display-id {
  font-family: monospace;
  font-size: .75rem;
  font-weight: 700;
  color: var(--navy);
  background: #e8edf5;
  border: 1px solid #c5d0e0;
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
.rm-display-id:hover { background: #d5ddef; }
.rm-display-id-copied {
  background: var(--green) !important;
  color: #fff !important;
  border-color: var(--green) !important;
  transition: background .15s ease, color .15s ease;
}
.rm-card-title {
  font-weight: 600;
  font-size: .9rem;
  color: var(--gray-800);
  flex: 1;
  min-width: 0;
}
.rm-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.rm-card-desc {
  font-size: .82rem;
  color: var(--gray-600);
  line-height: 1.5;
  margin-bottom: 10px;
  white-space: pre-wrap;
}
.rm-card-notes {
  background: var(--gray-50);
  border-left: 3px solid var(--sage);
  border-radius: 0 5px 5px 0;
  padding: 8px 12px;
  margin-bottom: 10px;
}
.rm-notes-label {
  display: block;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--sage);
  margin-bottom: 4px;
}
.rm-notes-body {
  font-size: .8rem;
  color: var(--gray-700);
  line-height: 1.55;
  white-space: pre-wrap;
}
.rm-pending-note {
  font-size: .8rem;
  color: var(--blue);
  background: var(--blue-light);
  border-radius: 5px;
  padding: 6px 10px;
  margin-bottom: 10px;
  font-style: italic;
}
.rm-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.rm-btn-pending    { color: var(--amber); }
.rm-btn-delete     { color: var(--gray-400); }
.rm-btn-queue      { color: #6D3FCC; font-weight: 600; }
.rm-btn-queue-move { color: var(--gray-600); min-width: 28px; font-weight: 700; }
.rm-btn-delete:hover { color: var(--danger); }

.rm-badge {
  font-size: .7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.rm-cat-feature { background: #e8f4fd; color: #1a6fa8; }
.rm-cat-bug     { background: #fdecea; color: #c0392b; }
.rm-pri-high    { background: #fde8e8; color: #b91c1c; }
.rm-pri-medium  { background: #fef9e7; color: #92620a; }
.rm-pri-low     { background: #e9f7ef; color: #1a7a42; }
.rm-date {
  font-size: .72rem;
  color: var(--gray-400);
  white-space: nowrap;
}
.rm-verified-date { color: #1a7a42; }

/* ── Analysis product-selector modal ──────────────────────── */
.analysis-product-modal  { width: 680px; max-width: 95vw; }
.analysis-modal-toolbar  { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.analysis-type-grid      { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.analysis-type-group     { border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; }
.analysis-type-hdr       { display: flex; align-items: center; gap: 6px; padding: 6px 10px;
                            background: var(--gray-50); border-bottom: 1px solid var(--gray-200); }
.analysis-type-label     { font-size: .75rem; font-weight: 700; text-transform: uppercase;
                            letter-spacing: .04em; color: var(--gray-600); flex: 1; }
.analysis-type-sep       { color: var(--gray-300); font-size: .78rem; }
.analysis-product-row    { display: flex; align-items: center; gap: 8px; padding: 5px 10px;
                            cursor: pointer; border-bottom: 1px solid var(--gray-100); }
.analysis-product-row:last-child { border-bottom: none; }
.analysis-product-row:hover { background: var(--gray-50); }
.analysis-product-row input[type="checkbox"] { width: 14px; height: 14px; cursor: pointer; flex-shrink: 0; }
.analysis-product-name    { flex: 1; font-size: .81rem; color: var(--gray-800); }
.analysis-product-carrier { font-size: .72rem; color: var(--gray-400); white-space: nowrap; }
.btn-link-sm { background: none; border: none; padding: 0; color: var(--blue); font-size: .76rem; cursor: pointer; text-decoration: underline; }
.btn-link-sm:hover { color: var(--navy); }
