/* ---------------------------------------------
   LawVoteTool - base styles
   Two-column responsive layout (desktop - single-column on mobile)
--------------------------------------------- */

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

[hidden] { display: none !important; }

:root {
  --color-bg:        #87aa83;
  --color-surface:   #d4d9dd;
  --color-border:    #1d0606;
  --color-text:      #222;
--color-muted  :     #666;
  --color-accent:    #1a5276;
  /* Score gradient endpoints: red (0%) - gray (50%) - green (100%) */
  --color-score-red:     169, 50, 38;    /* #a93226 */
  --color-score-neutral: 136, 136, 136;  /* #888888 */
  --color-score-green:   26, 122, 63;    /* #1a7a3f */
  /* Donor score gradient: red (0%) - dark-gray (50%) - blue (100%) */
  --color-donor-score-low:  169, 50, 38;     /* red        */
  --color-donor-score-mid:  90, 90, 90;      /* dark gray  */
  --color-donor-score-high: 20, 92, 200;     /* blue       */
  --col-left-width:  320px;
  --gap:             1rem;
  --radius:          6px;
}

/* -- Global -- */

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

a { color: var(--color-accent); }

button {
  cursor: pointer;
  padding: 0.35em 0.8em;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  font-size: 0.9em;
}

button:hover { background: #eef2f7; }

.btn-danger { background: #c0392b; color: #fff; border-color: #a93226; }
.btn-danger:hover { background: #a93226; }

select, input[type="search"], input[type="text"] {
  padding: 0.3em 0.5em;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: inherit;
  width: 100%;
}

fieldset { border: none; }

h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0;
  color: var(--color-accent);
}

/* -- Header -- */

.site-header {
  background: var(--color-accent);
  color: #fff;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.site-logo {
  flex-shrink: 0;
  border-radius: 50%;
  opacity: 0.92;
}

.site-header h1 { font-size: 1.3rem; }

.tagline {
  font-size: 0.85rem;
  opacity: 0.8;
}

.header-notes-editor-link {
  margin-left: auto;
  color: #fff;
  font-size: 0.82rem;
  white-space: nowrap;
  opacity: 0.78;
}

.header-notes-editor-link:hover,
.header-notes-editor-link:focus-visible {
  opacity: 1;
}

.app-version {
  font-size: 0.75rem;
  opacity: 0.65;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  align-self: center;
}

.site-footer {
  background: var(--color-accent);
  color: #fff;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  opacity: 0.92;
  margin-top: auto;
  flex-shrink: 0;
}

.site-footer-left {
  display: flex;
  align-items: left;
  gap: 1rem;
}

.site-footer-copy {
  opacity: 0.75;
  align-items: center;
  gap: 1rem;
}

.site-footer-feedback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  opacity: 0.75;
  text-decoration: underline;
  align-items: right;
  cursor: pointer;
}

.site-footer-feedback:hover,
.site-footer-feedback:focus-visible {
  opacity: 1;
}

.btn-donate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  opacity: 0.75;
  text-decoration: underline;
  white-space: nowrap;
}

.btn-donate:hover,
.btn-donate:focus-visible {
  opacity: 1;
}

/* -- App layout -- */

.app-layout {
  display: grid;
  grid-template-columns: var(--col-left-width) 1fr;
  gap: var(--gap);
  padding: var(--gap) 0.4rem;
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
  overflow: hidden;
}

/* -- Left column -- */

.control-pane {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  position: sticky;
  top: var(--gap);
  align-self: start;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
}

.control-pane section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* -- Law list -- */

.law-list {
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.law-list li {
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  font-size: 0.88em;
  line-height: 1.35;
}

.law-list li:last-child { border-bottom: none; }
.law-list li:hover      { background: #f0f4f8; }
.law-list li.selected   { background: #ddeeff; font-weight: 600; }

.law-list li            { display: flex; align-items: center; gap: 0.3em; }
.law-list-label         { flex: 1; min-width: 0; }
/* Fixed-width slot keeps all rows aligned whether or not a vote arrow is present */
.law-vote-slot                   { flex-shrink: 0; width: 20px; display: flex; align-items: center; justify-content: center; }
.law-vote-arrow                  { display: block; }
.law-vote-arrow[data-imp="1"]    { width: 12px; height: 12px; }
.law-vote-arrow[data-imp="2"]    { width: 15px; height: 15px; }
.law-vote-arrow[data-imp="3"]    { width: 19px; height: 19px; }
.law-vote-arrow[data-imp="4"]    { width: 23px; height: 23px; }
.law-vote-arrow[data-imp="5"]    { width: 28px; height: 28px; }
/* Note icon - always in DOM but invisible when no note, preserving alignment */
.law-note-icon                   { flex-shrink: 0; width: 1.3em; text-align: center; font-size: 1.7em; line-height: 1; color: var(--color-accent); visibility: hidden; }
.law-note-icon.has-note          { visibility: visible; }
/* Emergency clause indicator - always in DOM but invisible when no emergency clause, preserving alignment */
.law-emergency-icon              { flex-shrink: 0; width: 1.3em; text-align: center; font-size: 3em; font-style: italic; color: #cc4400; visibility: hidden; line-height: 1; }
.law-emergency-icon.has-emergency { visibility: visible; }

/* -- Law detail / vote controls -- */

#lawDetail { font-size: 0.9em; }

.compliance-note {
  font-size: 0.78em;
  color: var(--color-muted);
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--color-border);
}

.my-vote-controls {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}
.my-note-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.9em;
}
.note-area-title {
  font-size: inherit;
}
.note-area-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
}
.note-preview-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.15em 0.3em;
  border: 1px solid var(--color-border, #ccc);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  color: var(--color-accent);
  line-height: 1;
  flex-shrink: 0;
}
.note-preview-btn:hover {
  background: var(--color-accent-bg, #e8f0ff);
}
.note-preview-clickable {
  cursor: pointer;
  min-height: 1.5em;
}
.note-preview-clickable.note-preview-empty {
  color: var(--color-muted, #888);
  font-style: italic;
}
#myNote {
  width: 100%;
  resize: vertical;
  min-height: 3.5rem;
  font-size: 0.85em;
  font-family: inherit;
  padding: 0.3em 0.4em;
  border: 1px solid var(--color-border, #ccc);
  border-radius: 3px;
  background: #fff;
  color: #000;
  box-sizing: border-box;
}
#myNote.law-note-limit-reached,
.bill-info-note.law-note-limit-reached {
  border-color: #b02222;
  box-shadow: 0 0 0 1px #b02222;
}
#myNote.law-note-limit-reached:focus,
#myNote.law-note-limit-reached:focus-visible,
.bill-info-note.law-note-limit-reached:focus,
.bill-info-note.law-note-limit-reached:focus-visible {
  border-color: #b02222;
  outline: 1px solid #b02222;
  box-shadow: 0 0 0 1px #b02222;
}
.my-note-status {
  font-size: 0.8em;
  color: #b02222;
}
.my-note-preview {
  font-size: 0.82em;
  white-space: pre-wrap;
  background: #f4f7fb;
  border: 1px solid #dde3ec;
  border-radius: 3px;
  padding: 0.3rem 0.4rem;
  color: #2a2a2a;
}
.my-note-preview a {
  color: var(--color-accent);
  text-decoration: underline;
  word-break: break-all;
}

/* -- Profile panel -- */

.profile-actions {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.profile-action-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.profile-action-label {
  font-size: 0.78em;
  font-weight: 600;
  color: var(--color-muted);
  min-width: 2.8rem;
  flex-shrink: 0;
}

.profile-action-label::after {
  content: ':';
}

.profile-actions button {
  font-size: 0.82em;
  padding-left: 0.5em;
  padding-right: 0.5em;
  white-space: nowrap;
}

/* -- Right column -- */

.results-pane {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-height: 0;
  overflow: hidden;
}

#resultsView {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.2rem;
}

/* -- Tabs -- */

.results-nav-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  position: relative;
  z-index: 2;
}

.results-tabs {
  display: flex;
  gap: 0.25rem;
}

.results-tabs button {
  padding: 0.45em 1.2em;
  border: 2px solid #000;
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--color-surface);
  font-weight: 500;
  position: relative;
}

.results-tabs button[aria-selected="true"] {
  background: #e8edf2;
  color: var(--color-accent);
  z-index: 3;
}

.tab-panel {
  background: var(--color-surface);
  border: 2px solid #000;
  border-radius: var(--radius);
  padding: 0.5rem 0.4rem;
  position: relative;
  z-index: 1;
}

/* -- Profile tab - new sub-tab layout -- */

.profile-tab-panel  { display: flex; flex-direction: column; padding: 1rem; overflow: auto; }

/* Vote Profile sidebar - simplified to dropdown + View button */
.btn-view-profile   { width: 100%; margin-top: 0.4rem; }

/* Profile tab inner: sub-tab list on left, content on right */
.profile-tab-inner  {
  display: flex;
  height: 100%;
  min-height: 400px;
}

.profile-sub-tab-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-right: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 0.5rem 0;
  min-width: 80px;
}

.profile-sub-tab {
  display: block;
  width: 100%;
  padding: 0.6em 1em;
  text-align: left;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  font-size: 0.9em;
  cursor: pointer;
  color: var(--color-text);
  white-space: nowrap;
}
.profile-sub-tab:hover   { background: #edf1f5; }
.profile-sub-tab.active  {
  border-left-color: var(--color-accent);
  color: var(--color-accent);
  font-weight: 600;
  background: #edf1f5;
}

.profile-sub-content { flex: 1; overflow: auto; }
.profile-sub-panel   { padding: 1rem; }

/* -- View sub-tab -- */

.profile-meta-card        { margin-bottom: 1rem; }
.profile-meta-card-inner  {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #f8f9fb;
}
.profile-meta-photo         { width: 70px; height: 105px; object-fit: cover; border-radius: 4px; border: 1px solid var(--color-border); }
.profile-meta-photo-placeholder {
  width: 70px; height: 105px;
  background: #dde3ea; border-radius: 4px;
  border: 1px dashed var(--color-border);
  flex-shrink: 0;
}
.profile-meta-info          { flex: 1; display: flex; flex-direction: column; gap: 0.2rem; }
.profile-meta-name          { font-size: 1.05em; font-weight: 600; }
.profile-meta-year          { font-size: 0.85em; color: var(--color-muted); }
.profile-meta-type          { font-size: 0.8em; text-transform: capitalize; color: var(--color-muted); }
.profile-meta-dist          { font-size: 0.85em; }
.profile-meta-website a     { font-size: 0.82em; color: var(--color-accent); }
.profile-meta-id            { font-size: 0.75em; color: var(--color-muted); font-family: monospace; margin-top: 0.2rem; }
.profile-view-heading       { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; padding-bottom: 0.4rem; border-bottom: 2px solid var(--color-accent); }
.pvh-label                  { font-weight: 700; font-size: 1rem; }
.pvh-badge                  { font-size: 0.72em; background: var(--color-accent); color: #fff; padding: 0.1em 0.5em; border-radius: 3px; vertical-align: middle; white-space: nowrap; }
.profile-no-votes           { color: var(--color-muted); font-size: 0.9em; }

/* Law list in View sub-tab */
.profile-law-items          { list-style: none; padding: 0; margin: 0; }
.profile-law-item           {
  display: block;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  font-size: 0.88em;
}
.profile-law-item:hover     { background: #f0f4f8; }
.pli-data                   { display: flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.4rem; }
.pli-vote                   { font-weight: 700; width: 2.2rem; text-align: center; flex-shrink: 0; }
.profile-vote-yes .pli-vote { color: #1a7a1a; }
.profile-vote-no  .pli-vote { color: #c0391a; }
.pli-stars                  { color: #b0860a; flex-shrink: 0; letter-spacing: -0.05em; }
.pli-id                     { font-family: monospace; flex-shrink: 0; color: var(--color-accent); }
.pli-title                  { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pli-note-icon              { flex-shrink: 0; width: 1.4em; text-align: center; font-size: 0.85em; opacity: 0.65; transition: opacity 0.15s; }
.profile-law-item:hover .pli-note-icon,
.profile-law-item.pli-expanded .pli-note-icon { opacity: 1; }

/* Inline note body - hidden until .pli-expanded */
.pli-note-body              {
  display: none;
  padding: 0.35rem 0.6rem 0.45rem 0.6rem;
  font-size: 0.85em;
  white-space: pre-wrap;
  color: #333;
  background: #f4f7fb;
  border-top: 1px solid #dde3ec;
}
.pli-expanded .pli-note-body { display: block; }

/* Law detail in View sub-tab (kept in DOM, no longer used for notes) */
.profile-law-detail         { margin-top: 1rem; padding: 0.75rem; border: 1px solid var(--color-border); border-radius: var(--radius); background: #f8f9fb; }
.pld-title                  { margin: 0 0 0.5rem; font-size: 0.95em; }
.pld-note                   { margin: 0; white-space: pre-wrap; font-size: 0.9em; }
.pld-no-note                { margin: 0; color: var(--color-muted); font-size: 0.9em; }

/* -- Manage sub-tab -- */

.profile-manage-filters {
  display: flex; justify-content: flex-end; align-items: center;
  flex-wrap: wrap; gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.profile-manage-filters label { display: flex; flex-direction: row; align-items: center; gap: 0.35rem; }
.profile-filters-left  { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.profile-filters-right { display: flex; align-items: center; }

.profile-list-filter-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85em;
}
.profile-list-filter-label input {
  width: 100%;
  min-width: 0;
}
.profile-list-filter-spacer {
  visibility: hidden;
  pointer-events: none;
}

/* Small inline link-style button (e.g. Refresh in column heading) */
.btn-inline-link {
  font-size: 0.75em; font-weight: 400;
  padding: 0.1em 0.4em;
  border: 1px solid transparent;
  background: none;
  color: var(--color-accent);
  border-radius: var(--radius);
}
.btn-inline-link:hover { border-color: var(--color-accent); background: #edf1f5; }

/* Centered content wrapper for the profile tab */
.profile-manage-center {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

/* 3-column management table */
.profile-manage-cols {
  display: grid;
  grid-template-columns: 1fr 6rem 1fr;
  gap: 0.5rem;
  align-items: stretch;
}

.profile-mcol           { display: flex; flex-direction: column; gap: 0.4rem; }
.profile-mcol-heading   { margin: 0 0 0.3rem; font-size: 0.9em; font-weight: 600; border-bottom: 1px solid var(--color-border); padding-bottom: 0.2rem; text-align: center; }
.profile-mcol-shared .profile-slot-select { flex: 1; }

/* Middle action columns */
.profile-mcol-mid       {
  display: flex; flex-direction: column; justify-content: center;
  align-items: center; gap: 0.4rem; padding-top: 0;
}
.profile-mid-group      { display: flex; flex-direction: column; gap: 0.3rem; align-items: stretch; transform: translateY(-1.45rem); }
.profile-mid-group button { font-size: 0.8em; white-space: nowrap; }

.profile-compare-rr-row { display: flex; flex-direction: column; align-items: stretch; gap: 0.15rem; margin-top: 0.5rem; }
.compare-rr-label { display: block; font-size: 0.8em; font-weight: 500; }
.compare-rr-controls { display: flex; gap: 0.3rem; align-items: center; }
.compare-rr-controls select { flex: 1; min-width: 0; font-size: 0.82em; }
.compare-rr-controls button { white-space: nowrap; font-size: 0.82em; }

/* Slot cards */
.profile-slot-card {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #f8f9fb;
  min-height: 3rem;
  font-size: 0.88em;
}
.slot-card-label  { font-weight: 600; }
.slot-card-detail { font-size: 0.82em; color: var(--color-muted); margin-top: 0.15rem; }

/* Working profile rich card */
.wc-inner        { display: flex; gap: 0.6rem; align-items: flex-start; }
.wc-photo-wrap   { flex-shrink: 0; width: 60px; height: 90px; border: 1px solid var(--color-border); border-radius: calc(var(--radius) - 1px); overflow: hidden; background: #e8eaee; display: flex; align-items: center; justify-content: center; }
.wc-photo        { width: 100%; height: 100%; object-fit: contain; display: block; }
.wc-photo-placeholder { width: 100%; height: 100%; background: linear-gradient(135deg,#d0d4dc 0%,#e8eaee 100%); }
.wc-info         { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.wc-name         { font-weight: 600; font-size: 0.9em; word-break: break-word; }
.wc-year-type    { font-size: 0.78em; color: var(--color-muted); }
.wc-dist         { font-size: 0.78em; color: var(--color-muted); }
.wc-website      { font-size: 0.76em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc-votes        { font-size: 0.78em; color: var(--color-muted); margin-top: 0.2rem; }

/* Reference / Shared lists */
.profile-slot-select    { width: 100%; font-size: 0.85em; min-height: 6rem; border: 1px solid var(--color-border); border-radius: var(--radius); }

/* Action button columns */
.profile-mcol-actions   { display: flex; flex-direction: row; flex-wrap: wrap; gap: 0.3rem; align-items: flex-start; justify-content: center; }
.profile-mcol-actions button { font-size: 0.82em; padding: 0.25em 0.6em; white-space: nowrap; }
.profile-mcol-actions button:disabled { opacity: 0.45; cursor: not-allowed; }
.profile-create-btns    { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; margin-top: 0.4rem; }
.profile-create-btns button { font-size: 0.82em; padding: 0.25em 0.6em; white-space: nowrap; }

/* -- Compare area -- */

.profile-compare-area   { margin-top: 1rem; padding: 1rem; border: 1px solid var(--color-border); border-radius: var(--radius); background: #f8f9fb; }
.compare-header         { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; gap: 0.5rem; font-size: 0.9em; font-weight: 600; }
.compare-left-label     { flex: 1; }
.compare-score          { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.compare-right-label    { flex: 1; text-align: right; }
.compare-bar-wrap       { margin-bottom: 0.75rem; }
.compare-bar-bg         { height: 1rem; background: #dde3ea; border-radius: 4px; overflow: hidden; }
.compare-bar-fill       { height: 100%; transition: width 0.3s ease; }
.compare-bar-labels     { display: flex; justify-content: space-between; font-size: 0.75em; color: var(--color-muted); margin-top: 0.1rem; }
.compare-detail-table   { width: 100%; border-collapse: collapse; font-size: 0.83em; }
.compare-detail-table th { padding: 0.2em 0.4em; border-bottom: 2px solid var(--color-border); text-align: left; background: #edf1f5; }
.compare-detail-table td { padding: 0.2em 0.4em; border-bottom: 1px solid #eee; }
.compare-note-row       { background-color: #f9f9f9; }
.compare-no-bills       { color: var(--color-muted); font-size: 0.9em; margin: 0; }
.compare-metadata       { margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid #dde3ea; }
.compare-metadata h3    { margin: 0 0 0.5rem 0; font-size: 0.9em; }
.compare-meta-table     { width: 100%; border-collapse: collapse; font-size: 0.82em; }
.compare-meta-table td  { padding: 0.3em 0.5em; border-bottom: 1px solid #eee; }
.meta-key              { font-weight: 600; width: 20%; }
.meta-val-a            { color: #2c5282; }
.meta-val-b            { color: #7c2d12; }
.compare-note-summary   { margin-top: 0.75rem; padding: 0.5rem 0.7rem; background: #fef3c7; border-left: 3px solid #f59e0b; border-radius: 3px; }
.compare-note-summary p { margin: 0; font-size: 0.85em; }
.compare-note-summary a { color: #d97706; font-weight: 600; text-decoration: none; }
.compare-note-summary a:hover { text-decoration: underline; }
.compare-note-breakdown { margin-top: 1rem; padding: 0.75rem; background: #f3f4f6; border-radius: 4px; }
.compare-note-breakdown h3 { margin: 0 0 0.5rem 0; font-size: 0.9em; }
.compare-note-table     { width: 100%; border-collapse: collapse; font-size: 0.81em; }
.compare-note-table th  { padding: 0.3em 0.5em; border-bottom: 2px solid #cbd5e1; text-align: left; background: #e2e8f0; }
.compare-note-table td  { padding: 0.3em 0.5em; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
.compare-note-table strong { display: block; }
.compare-note-table small { display: block; color: #666; font-size: 0.85em; }
.note-cell { color: #374151; }
.vote-y  { color: #1a7a1a; font-weight: 700; }
.vote-n  { color: #c0391a; font-weight: 700; }

/* -- Inline metadata edit area -- */

.profile-meta-edit-label {
  font-weight: 600;
  font-size: 0.9em;
  margin: 1rem 0 0.25rem;
  text-align: center;
}
.profile-meta-edit-area {
  max-width: 600px;
  margin: 0 auto 1rem;
  padding: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #e8edf8;
}
.profile-meta-edit-area.meta-read-only { background: #f0f2f5; opacity: 0.8; cursor: not-allowed; }
.profile-meta-edit-area.meta-read-only * { cursor: not-allowed; }
.profile-meta-id-display-row {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  margin-bottom: 0.75rem; padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}
.profile-meta-id-display {
  font-weight: 600; font-size: 0.95em; text-align: center; color: var(--color-accent);
}
.profile-meta-edit-fields {
  display: flex; gap: 1rem; align-items: center;
}
.profile-meta-field-grid { flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }

/* -- Metadata edit dialog -- */

.profile-meta-dlg       { width: min(680px, 96vw); }
.profile-meta-dlg-title { margin: 0 0 1rem; font-size: 1.05em; }
.profile-meta-dlg-body  { display: flex; gap: 1.2rem; align-items: flex-start; }

.profile-meta-photo-col { display: flex; flex-direction: column; gap: 0.5rem; align-items: center; flex-shrink: 0; }
.profile-photo-drop {
  width: 100px; height: 150px;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; text-align: center; position: relative;
  background: #f8f9fb; transition: border-color 0.15s;
}
.profile-photo-drop:hover  { border-color: var(--color-accent); }
.profile-photo-drop.drag-over { border-color: var(--color-accent); background: #e8edf8; }
.profile-photo-preview     { width: 100%; height: 100%; object-fit: contain; border-radius: calc(var(--radius) - 2px); display: block; }
.profile-photo-placeholder { font-size: 0.75em; color: var(--color-muted); line-height: 1.4; padding: 0.5rem; }
.profile-photo-remove      { font-size: 0.78em; }
.profile-photo-default     { padding: 0.75rem; filter: brightness(0) opacity(0.35); }
.profile-photo-fallback    { opacity: 0.85; }

.profile-meta-fields    { flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }
.profile-field-row      { display: flex; flex-direction: column; gap: 0.15rem; }
.profile-field-row--inline { flex-direction: row; align-items: center; gap: 0.4rem; cursor: pointer; }
.profile-field-row--inline .profile-field-label { font-weight: normal; color: inherit; }
.profile-field-label    { font-size: 0.8em; font-weight: 600; color: var(--color-muted); }
.profile-field-hint     { font-size: 0.78em; padding: 0.2rem 0.3rem; border-radius: 0.25rem; margin-top: -0.2rem; }
.profile-field-hint--warn  { color: #7a3000; background: #fff3cd; }
.profile-field-hint--info  { color: #1a4a1a; background: #d4edda; }
.profile-field-hint--note  { color: #334; background: #eef2f7; }
.profile-field-row input,
.profile-field-row select { font-size: 0.9em; }

/* -- Toolbar -- (moved below to avoid duplicate) */

.results-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.results-toolbar label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88em;
  white-space: nowrap;
}

.results-toolbar select,
.results-toolbar input { width: auto; }

.results-toolbar select:focus,
.results-toolbar input:focus {
  outline: 2px solid #80bdff;
  outline-offset: 1px;
}

.results-toolbar-spacer {
  flex: 1 1 auto;
  min-width: 0;
}

.results-contact-btn {
  margin-left: auto;
}

.contact-legislators-bg {
  --contact-legislators-bg-overlay: rgba(238, 246, 252, 0.84);
}

.stdDlg.contact-legislators-dlg,
.wideDlg.contact-legislators-dlg {
  width: min(30rem, 92vw);
  max-width: 100%;
  overflow-x: hidden;
  border: 2px solid #1a5ca8;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  background-color: var(--contact-legislators-bg-overlay);
  background-image: none;
  color: var(--color-text);
}

.stdDlg.contact-legislators-dlg > :first-child,
.wideDlg.contact-legislators-dlg > :first-child,
.stdDlg.contact-legislators-dlg .dlg-buttons,
.wideDlg.contact-legislators-dlg .dlg-buttons {
  background-color: transparent;
  background-image: none;
}

.contact-legislators-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 100%;
}

.contact-legislators-heading {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  line-height: 1.2;
  font-weight: 700;
}

.contact-legislators-subheading {
  margin: 0 0 0.45rem;
}

.contact-legislators-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  width: min(22rem, 100%);
  max-width: 100%;
  min-width: 0;
  margin-inline: auto;
  margin-bottom: 0.65rem;
}

.contact-legislators-controls span {
  text-align: center;
}

.contact-legislators-controls select {
  width: 8.5rem;
  max-width: 100%;
}

.contact-legislators-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  width: min(22rem, 100%);
  max-width: 100%;
  min-width: 0;
  margin-inline: auto;
  margin-bottom: 0.65rem;
}

.contact-legislators-email-list {
  min-height: 10rem;
  max-height: 52vh;
  width: min(22rem, 100%);
  max-width: 100%;
  overflow: auto;
  overflow-x: hidden;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: #fff;
  color: var(--color-text);
  margin-inline: auto;
  padding: 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.donor-toolbar { flex-direction: column; align-items: flex-start; gap: 0.4rem; }

.donor-sort-desc { display: inline-flex; align-items: center; gap: 0.3rem; }

.donor-toolbar-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.donor-toolbar-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 50rem;
  flex-wrap: wrap;
}

.donor-toolbar-filters label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.donor-type-filter {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.75rem;
  align-items: center;
}

.donor-type-filter label {
  font-size: 0.85em;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.donor-filter-check {
  font-size: 0.85em;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--color-accent);
  font-weight: 500;
}

/* -- Member cards (legislators tab) - shares rc-card styles with roll-call view -- */

.member-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* -- Committees tab -- */

.committees-tab-panel {
  padding: 0.75rem;
}

.committees-toolbar {
  margin-bottom: 0.6rem;
  gap: 0.5rem 0.75rem;
}

.committees-toolbar select,
.committees-toolbar input {
  min-width: 13rem;
}

.committee-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.committee-chamber-section {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #f8fafc;
  padding: 0.7rem;
}

.committee-chamber-heading {
  margin: 0 0 0.55rem;
  font-size: 1.05em;
  color: var(--color-accent);
}

.committee-grid {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.committee-card {
  border: 1px solid #d7dee7;
  border-radius: var(--radius);
  background: #ffffff;
  padding: 0.55rem;
}

.committee-name {
  margin: 0 0 0.35rem;
  font-size: 0.98em;
}

.committee-members {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: flex-start;
}

.committee-member-slot {
  display: inline-flex;
  flex-direction: column;
  gap: 0.15rem;
}

.committee-member-slot--chair {
  margin-right: 0.8rem;
}

.committee-member-slot--vice-chair {
  margin-right: 0.8rem;
}

.committee-role-label {
  font-size: 0.72em;
  font-weight: 600;
  color: #4a5a6b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}

.committee-empty {
  color: var(--color-muted);
  font-size: 0.92em;
}

/* Fallback background for legislators with no score (null) */
.member-cards .rc-card:not([style*="background"]) {
  background: #888;
}

/* Score color is applied as inline style via scoreColorStyle() in utils.mjs.
   score-none is used when there is no score (null). */
.score-none { color: rgba(255,255,255,0.7); }

/* -- Donor list -- */

.donor-list-wrap {
  overflow-x: auto;
}

/* Donor card cell - minimal padding so the card sits flush */
.donor-table .donor-card-cell {
  padding: 0.2rem;
  vertical-align: top;
}

/* Donor card name - underlined to signal clickability */
.rc-card-name--link {
  cursor: pointer;
  text-decoration: underline dotted rgba(255,255,255,0.7);
  text-underline-offset: 2px;
}
.rc-card-name--link:hover {
  text-decoration: underline rgba(255,255,255,1);
}

/* Placeholder photo area when no image is available */
.rc-card-photo--placeholder {
  background: transparent;
  border-radius: 2px;
  width: 52px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.rc-card-photo--placeholder-img {
  width: 52px;
  height: 64px;
  object-fit: contain;
  object-position: center;
  opacity: 0.35;
}

/* Individual donors: slightly more visible */
.rc-card-photo--placeholder[data-donor-type="Individual"] .rc-card-photo--placeholder-img {
  opacity: 0.55;
}

.donor-table .donor-name  { font-weight: 600; }
.donor-table .donor-amount { text-align: right; white-space: nowrap; }
.donor-table .donor-score  { font-weight: 700; text-align: center; white-space: nowrap; }

.donor-table .donor-recipients-row td {
  background: #f0ebe6 !important;
  padding-top: 0;
  padding-bottom: 0.4rem;
}

.donor-table .recipient-list {
  list-style: none;
  margin: 0;
  padding: 0.15rem 0 0 1rem;
  color: #444;
  font-size: 0.82em;
  font-weight: 500;
}

.donor-table .donor-legs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-content: flex-start;
  vertical-align: top;
}
/* Fallback for legislators with no score in donor rows */
.donor-table .donor-legs .rc-card:not([style*="background"]) {
  background: #888;
}
.donor-leg-link {
  display: inline-block;
  margin: 1px 4px 1px 0;
  color: #16a34a;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  white-space: nowrap;
}
.donor-leg-link::after { content: ','; margin-left: -2px; }
.donor-leg-link:last-child::after { content: ''; }

.donor-table .recipient-unmatched { opacity: 0.75; }
.recipient-list-label {
  display: block;
  font-size: 0.78em;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.recipient-amount { color: #333; }

.donor-summary-heading {
  margin: 0;
  font-size: 0.95em;
  font-weight: 700;
  color: #fff;
  text-align: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Donor name - blue filter link */
.donor-name-link {
  color: #1a5ca8;
  font-weight: 600;
  text-decoration: underline dotted;
  cursor: pointer;
}
.donor-name-link:hover { text-decoration: underline; }

/* Donor detail info button (small, inline after donor name) */
.donor-info-btn {
  background: none;
  border: 1px solid #bbb;
  border-radius: 3px;
  padding: 0 4px;
  margin-left: 5px;
  font-size: 0.78em;
  color: #555;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1.4;
}
.donor-info-btn:hover { background: #e8e8e8; color: #1a5ca8; }

/* Out-of-state column */
.donor-table .donor-oos { text-align: center; white-space: nowrap; }
.donor-oos-mark {
  display: inline-block;
  font-size: 1.1em;
  color: #c0392b;
  font-weight: 700;
  cursor: default;
}

/* -- Donor detail dialog -- */
.donor-info-dlg { padding: 0.25rem 0.5rem; min-width: 320px; }
.donor-info-title {
  margin: 0 0 0.5rem;
  font-size: 1.15em;
  font-weight: 700;
}
.donor-info-oos-badge {
  display: inline-block;
  background: #fce8e6;
  color: #c0392b;
  border: 1px solid #e8a09a;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.88em;
  font-weight: 600;
  margin-bottom: 0.6rem;
}
.donor-info-table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 0.75rem;
  font-size: 0.92em;
}
.donor-info-table th {
  text-align: left;
  padding: 3px 10px 3px 0;
  color: #555;
  font-weight: 600;
  white-space: nowrap;
  width: 6rem;
}
.donor-info-table td { padding: 3px 0; word-break: break-word; }
.donor-info-section { margin-top: 0.75rem; }
.donor-info-section h3 { font-size: 0.9em; font-weight: 700; margin: 0 0 0.3rem; color: #333; }
.donor-info-recipients {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9em;
}
.donor-info-recipients th {
  text-align: left;
  padding: 2px 12px 2px 0;
  color: #555;
  font-weight: 600;
  border-bottom: 1px solid #ddd;
}
.donor-info-recipients td { padding: 2px 12px 2px 0; }
.donor-info-recipients tfoot td {
  font-weight: 700;
  border-top: 1px solid #ddd;
  padding-top: 4px;
}
.donor-info-amt { text-align: right; padding-right: 0 !important; }
.donor-info-leg-name { min-width: 10rem; }
.donor-info-unmatched { opacity: 0.65; font-style: italic; }
.backfill-note { font-size: 0.78em; color: #888; font-style: italic; margin-left: 4px; }
.donor-chain-list {
  margin: 0;
  padding-left: 1.4em;
  font-size: 0.9em;
  color: #444;
}
.donor-chain-list li { margin: 2px 0; }
.donor-info-oos-funding h3 { color: #c0392b; }
.donor-info-ai-note {
  margin-top: 0.75rem;
  font-size: 0.8em;
  color: #888;
  border-top: 1px solid #eee;
  padding-top: 0.5rem;
}

/* -- Bill Info tab -- */

.bill-info-panel {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 155px);
}

.bill-info-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0.75rem;
  background: #e8edf2;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.88em;
  flex-shrink: 0;
}

.bill-info-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
  min-width: 0;
}

.bill-info-header-title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bill-info-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2em 0.45em;
  font-size: 0.82em;
}
.bill-info-status-item   { padding: 0.1em 1em; border-radius: 3px; font-weight: 500; }
.bill-info-status-pass   { background: #d4edda; color: #155724; }
.bill-info-status-signed { background: #d4edda; color: #155724; }
.bill-info-status-fail   { background: #f8d7da; color: #721c24; }
.bill-info-status-veto   { background: #f8d7da; color: #721c24; }
.bill-info-status-kill     { background: #fff3cd; color: #856404; }
.bill-info-status-pending  { background: #e2e3e5; color: #383d41; }

.bill-info-note-area {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.bill-info-note-label {
  font-size: 0.86em;
  color: var(--color-muted);
}

.bill-info-note {
  width: 100%;
  min-height: 2.2em;
  resize: vertical;
  font-size: 0.96em;
  line-height: 1.35;
  padding: 0.45em 0.55em;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: inherit;
  background: #fff;
}

.bill-info-header-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  padding-top: 0.1rem;
}

.bill-info-law-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-right: 0.2rem;
}

.bill-info-law-nav-btn {
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--color-accent);
  font-size: 0.92em;
  line-height: 1.2;
  cursor: pointer;
}

.bill-info-law-nav-btn:hover:not(:disabled) {
  background: #ddeeff;
  border-color: #6699cc;
}

.bill-info-law-nav-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.bill-info-back-breakdown-btn {
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--color-accent);
  font-size: 0.92em;
  line-height: 1.2;
  white-space: nowrap;
  min-width: max-content;
  cursor: pointer;
}

.bill-info-back-breakdown-btn:hover {
  background: #ddeeff;
  border-color: #6699cc;
}

/* -- District tab -- */

.district-tab-panel { padding: 1rem; }

.district-tab-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.9em;
}

.district-tab-placeholder {
  padding: 2rem;
  text-align: center;
  color: var(--color-muted);
}

.district-tab-placeholder p  { max-width: 36em; margin: 0 auto; line-height: 1.6; }

.district-tab-content { text-align: center; }
.district-tab-title   { margin: 0 0 0.75rem; font-size: 1.1em; }
.district-tab-img     { max-width: 100%; max-height: 70vh; object-fit: contain; border-radius: 4px; }
.district-tab-error   { color: var(--color-muted); margin-top: 1rem; }

.bill-info-pdf-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
}

.bill-info-pdf-toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.75rem;
  background: #e8edf2;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.88em;
  flex-shrink: 0;
  min-width: 700px;
}

.bill-info-pdf-label {
  font-weight: 600;
}

.bill-info-pdf-toolbar .bill-info-status {
  flex: 1;
  min-width: 0;
  margin: 0 0.65rem;
}

.bill-info-pdf-external {
  font-size: 0.85em;
  margin-left: auto;
}

.bill-info-iframe {
  flex: 1;
  border: none;
  width: 100%;
  min-width: 700px;
}

.bill-info-summary {
  padding: 1.25rem 1.5rem;
  max-height: calc(100vh - 155px);
  overflow-y: auto;
  font-size: 0.93em;
  line-height: 1.7;
}

.bill-summary-title {
  margin: 0 0 0.5rem;
  font-size: 1.15em;
}

.bill-summary-emergency {
  margin: 0 0 0.4rem;
  color: #b00000;
  font-size: 1.5em;
  font-weight: 700;
  text-align: center;
}

.bill-summary-credit {
  font-size: 0.82em;
  color: var(--color-muted);
  padding-bottom: 0.85rem;
  border-bottom: 1px solid #ccc;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.bill-summary-body p + p {
  margin-top: 0.6rem;
}

.law-governor-action {
  margin: 0.35rem 0 0.85rem;
  font-size: 0.95em;
  color: var(--color-muted);
}

/* -- Roll call view -- */

.bill-info-rollcall {
  padding: 1rem 1.5rem;
  max-height: calc(100vh - 155px);
  overflow-y: auto;
  font-size: 0.9em;
}

.rc-title {
  margin: 0 0 0.75rem;
  font-size: 1.1em;
}

.rc-chamber {
  margin-bottom: 1.75rem;
}

.rc-chamber-title {
  font-size: 1em;
  font-weight: 600;
  margin: 0 0 0.5rem;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--color-border);
}

/* 3-column layout: Yea | Missed | Nay */
.rc-groups {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
  align-items: start;
}

.rc-group-head {
  font-weight: 600;
  font-size: 0.88em;
  margin-bottom: 0.4rem;
  text-align: center;
}

.rc-group-y .rc-group-head { color: #1a7a3f; }
.rc-group-m .rc-group-head { color: #666; }
.rc-group-n .rc-group-head { color: #a93226; }

.rc-count { font-weight: normal; }

/* Card grid within each column */
.rc-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.rc-card {
  width: 97px;
  height: 154px;
  box-sizing: border-box;
  border: 1px solid #000;
  border-radius: var(--radius);
  padding: 0.4rem 0.3rem;
  text-align: center;
  font-size: 12px;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

/* Card background comes from profile score (inline style via scoreColorStyle()).
   Fallback gray only when score is null (blank profile), matching Legislators tab. */
.rc-cards .rc-card:not([style*="background"]) {
  background: #888;
}

.rc-card-photo {
  width: 52px;
  height: 64px;
  flex-shrink: 0;
  position: relative;
}

.rc-card-funding-track {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  border-radius: 0 0 2px 2px;
  background: rgba(0, 0, 0, 0.22);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
  z-index: 4;
  overflow: hidden;
  cursor: default;
}

.rc-card-funding-in-bar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  border-radius: 0 0 2px 2px;
  background: #2db24b;
  z-index: 1;
  pointer-events: none;
}

.rc-card-funding-out-bar {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  border-radius: 0 0 2px 2px;
  background: #cc2d2d;
  z-index: 1;
  pointer-events: none;
}

.rc-card-power-bar {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 5px;
  border-radius: 2px 2px 0 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55);
  z-index: 2;
  pointer-events: auto;
}

.rc-card-activity-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 5px;
  border-radius: 2px 2px 0 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
  z-index: 2;
  pointer-events: auto;
}

.rc-card-seniority-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  border-radius: 0 2px 2px 0;
  background: #7e3ff2;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.4);
  z-index: 3;
  pointer-events: auto;
}

/* Donor stat bars - vertical side bars on the photo div */
/* Yellow Activity bar on LEFT side; height driven by inline style */
.rc-card-donor-recip-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 5px;
  border-radius: 2px 2px 0 0;
  background: #ffea00;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
  z-index: 4;
  pointer-events: auto;
}

/* Orange Influence bar on RIGHT side; height driven by inline style */
.rc-card-donor-given-bar {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 5px;
  border-radius: 2px 2px 0 0;
  background: #ff7a00;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55);
  z-index: 4;
  pointer-events: auto;
}

.rc-card-photo--clickable {
  cursor: pointer;
  transition: opacity 0.12s ease;
}

.rc-card-photo--clickable:hover {
  opacity: 0.8;
}

.rc-card-photo--clickable:focus-visible {
  outline: 2px solid rgba(255,255,255,0.8);
  outline-offset: 2px;
  border-radius: 2px;
}

.rc-card-photo img {
  width: 52px;
  height: 64px;
  object-fit: contain;
  object-position: center;
  display: block;
  border-radius: 2px;
  background: rgba(255,255,255,0.2);
}

.rc-card-name {
  font-weight: 600;
  line-height: 1.2;
  font-size: 0.95em;
  overflow: hidden;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  width: 100%;
}

.rc-card-meta {
  font-size: 0.85em;
  opacity: 0.85;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  width: 100%;
}

.rc-card-dist-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: inherit;
  color: inherit;
  opacity: inherit;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
}

.rc-card-score {
  font-size: 1em;
  font-weight: 700;
  opacity: 0.95;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
}

.rc-card-chamber-badge {
  position: absolute;
  right: 0.32rem;
  bottom: 0.32rem;
  min-width: 0.9rem;
  height: 0.9rem;
  padding: 0 0.18rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.45);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 0.9rem;
  text-align: center;
  pointer-events: none;
}

.rc-card-score--link {
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: font-size 0.12s ease;
}

.rc-card-score--link:hover {
  font-size: 1.25em;
}

.rc-card--clickable {
  cursor: pointer;
}
.rc-card--clickable:hover {
  filter: brightness(1.15);
}

.rc-no-vote {
  padding: 2rem;
  color: var(--color-muted);
  text-align: center;
}

/* -- Score breakdown panel -- */

.breakdown-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.75rem;
}

.breakdown-back {
  display: block;
  margin-bottom: 0.75rem;
  white-space: nowrap;
}

.breakdown-body {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.breakdown-card-slot {
  flex-shrink: 0;
  width: 160px;
}

.breakdown-detail {
  flex: 1;
  min-width: 0;
}

.breakdown-detail h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05em;
}

.breakdown-explain {
  font-size: 0.85em;
  color: var(--color-muted);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.breakdown-explain p + p { margin-top: 0.3em; }

.breakdown-stats {
  font-size: 0.95em;
  color: var(--color-text);
  background: rgba(0,0,0,0.03);
  border: 1px solid var(--color-border, #ccc);
  border-radius: 4px;
  padding: 0.5em 0.7em;
  margin: 0 0 0.75rem 0;
  font-family: inherit;
  line-height: 1.4;
}

.breakdown-stats-line {
  margin-left: 1rem;
}

.breakdown-stats-action {
  margin: 0 0 0.75rem 0;
}

.breakdown-add-ref-btn {
  font-size: 0.95em;
}

.breakdown-member-controls {
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.breakdown-show-all-votes {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.95em;
  user-select: none;
}

.vote-key-item {
  display: inline-block;
  margin: 0 0.5em 0 0;
  padding: 0 0.3em;
  border-radius: 3px;
  font-size: 0.9em;
}

.breakdown-table-wrap {
  overflow-x: auto;
}

.breakdown-table {
  width: auto;
  max-width: 100%;
  margin: 0 auto;
  border-collapse: collapse;
  font-size: 0.85em;
  border: 1px solid var(--color-border);
}

.breakdown-table th {
  text-align: center;
  padding: 0.35rem 0.6rem;
  background: #c8d0d8;
  border: 1px solid var(--color-border);
  white-space: nowrap;
}

.breakdown-table td {
  padding: 0.3rem 0.6rem;
  border: 1px solid #d0d5da;
  vertical-align: middle;
}

.breakdown-table th:not(:first-child),
.breakdown-table td:not(:first-child) {
  text-align: center;
}

.breakdown-table tbody tr:nth-child(even) td { background: #f4f6f8; }
.breakdown-table tbody tr:nth-child(odd)  td { background: #ffffff; }
.breakdown-table tr:hover td { background: #e8edf4; }

/* Summary rows - must come after nth-child stripe rules to win specificity */
.donor-table tbody .donor-summary-heading-row td {
  background: #1a3a5c !important;
  padding: 0.2rem 0.5rem;
  position: sticky;
  top: 0;
  z-index: 2;
}
.donor-table tbody .donor-summary-heading-row:hover td { background: #1a3a5c !important; }
.donor-table tbody .donor-summary-row td {
  font-weight: 700;
  background: #d6e4f5 !important;
  border-bottom: 3px solid #1a3a5c !important;
  position: sticky;
  top: 1.6rem;
  z-index: 1;
}
.donor-table tbody .donor-summary-row:hover td { background: #c2d8f0 !important; }

.breakdown-table tr.breakdown-total td {
  font-weight: 700;
  border-top: 2px solid var(--color-border);
  border-bottom: none;
  background: #dce3ea;
}

.breakdown-table .bill-short-title {
  color: var(--color-muted);
  font-size: 0.9em;
}

/* Vote result classes used in breakdown table */
.vote-agree  { color: #1a7a3f; font-weight: 600; }
.vote-oppose { color: #a93226; font-weight: 600; }
.vote-missed { color: #c78813; }
.vote-excl   { color: var(--color-muted); }
.breakdown-note-icon { margin-left: 0.3em; font-size: 1.1em; color: var(--color-accent); cursor: default; vertical-align: middle; }

/* Make score elements on cards/rows show a pointer to hint they're clickable */
.score-clickable {
  cursor: pointer;
  text-decoration: underline dotted;
}

/* -- Help button -- */

.help-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s, border-color 0.15s;
  align-self: center;
  margin-bottom: 2px;
}

.help-btn:hover,
.help-btn:focus-visible {
  opacity: 1;
  border-color: var(--color-border);
  outline: none;
}

/* -- Help content panel -- */

.help-content {
  padding: 0.25rem 0.5rem;
  font-size: 0.88em;
  line-height: 1.6;
  max-width: 720px;
  margin: 0 auto;
  min-height: 0;
  overflow-y: auto;
  max-height: calc(100vh - 160px);
}

.help-content h1 { font-size: 1.25em; font-weight: 700; margin: 1.5rem 0 0.4rem; }
.help-content h2 { font-size: 1.1em;  font-weight: 700; margin: 1.2rem 0 0.3rem; border-bottom: 1px solid var(--color-border); padding-bottom: 0.2rem; }
.help-content h3 { font-size: 1em;    font-weight: 700; margin: 1rem 0 0.25rem; }
.help-content h4 { font-size: 0.95em; font-weight: 600; margin: 0.8rem 0 0.2rem; }
.help-content h1,
.help-content h2,
.help-content h3,
.help-content h4 { scroll-margin-top: 0.75rem; }

.help-content p  { margin: 0.4rem 0; }
.help-content ul,
.help-content ol { margin: 0.4rem 0 0.4rem 1.4rem; }
.help-content li { margin: 0.15rem 0; }

.help-content blockquote {
  border-left: 3px solid var(--color-border);
  padding-left: 0.75rem;
  margin: 0.5rem 0;
  color: var(--color-muted);
  font-style: italic;
}

.help-content code {
  font-family: monospace;
  background: #e8ecf0;
  padding: 0.1em 0.3em;
  border-radius: 3px;
  font-size: 0.92em;
}

.help-content pre {
  background: #e8ecf0;
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  overflow-x: auto;
  font-size: 0.85em;
  margin: 0.5rem 0;
}

.help-content pre code { background: none; padding: 0; }

.help-content hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1rem 0;
}

/* Tables inside the help panel use the same visual treatment as breakdown tables */
.help-content table {
  width: auto;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.9em;
  border: 1px solid var(--color-border);
  margin: 0.5rem 0;
}

.help-content th {
  text-align: center;
  padding: 0.3rem 0.6rem;
  background: #c8d0d8;
  border: 1px solid var(--color-border);
  white-space: nowrap;
  font-weight: 600;
}

.help-content td {
  padding: 0.3rem 0.6rem;
  border: 1px solid #d0d5da;
  vertical-align: top;
}

.help-content tbody tr:nth-child(even) td { background: #f4f6f8; }
.help-content tbody tr:nth-child(odd)  td { background: #ffffff; }
.help-content tr:hover td { background: #e8edf4; }

/* -- Committee kills section -- */

.committee-kills-section {
  margin-top: 1.5rem;
  border-top: 2px solid var(--color-border);
  padding-top: 1rem;
}

.committee-kills-heading {
  margin: 0 0 0.4rem;
  font-size: 1em;
  font-weight: 700;
}

.committee-kills-desc {
  font-size: 0.82em;
  color: var(--color-muted);
  margin: 0 0 0.6rem;
  line-height: 1.4;
}

/* Role badges in the committee kills table */
.ck-role { font-weight: 600; white-space: nowrap; }
.ck-role--chair      { color: #a93226; }   /* red  - highest accountability */
.ck-role--vice-chair { color: #c78813; }   /* amber */
.ck-role--member     { color: var(--color-muted); font-weight: 400; }

/* -- Dialogs -- */

.stdDlg,
.wideDlg {
  margin:        auto;  /* override the * { margin: 0 } reset so <dialog> stays centered */
  background:    var(--color-bg);
  color:         #fff;
  border:        none;
  border-radius: 1em;
  overflow:      clip;
  box-shadow:
    rgba(0,0,0,0.25)  0px  54px 55px,
    rgba(0,0,0,0.12)  0px -12px 30px,
    rgba(0,0,0,0.12)  0px   4px  6px,
    rgba(0,0,0,0.17)  0px  12px 13px,
    rgba(0,0,0,0.09)  0px  -3px  5px;
}

.stdDlg  { max-width: 65ch; }
.wideDlg { min-width: min(80vw, 100ch); max-width: 95vw; }

/* Legislator detail dialog - richer green background */
.stdDlg.member-info-dlg,
.wideDlg.member-info-dlg { background: #ffffff; border: 2px solid #ff0000; color: #222; }

.member-dlg-photo {
  flex-shrink: 0;
  width: 108px;
  height: 132px;
  object-fit: cover;
  object-position: top center;
  border-radius: 4px;
  border: 3px solid #ccc;
}

.member-dlg-leadership-badge {
  display: inline-block;
  background: #1a5c8a;
  color: #fff;
  font-size: 0.68em;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  margin-left: 0.5em;
  vertical-align: middle;
  letter-spacing: 0.03em;
}

.member-dlg-power-components {
  font-size: 0.76em;
  color: #888;
  margin-top: 2px;
  white-space: nowrap;
}

.member-dlg-breakdown-lines {
  white-space: normal;
  line-height: 1.35;
}

.member-dlg-breakdown-lines > div {
  margin-top: 1px;
}

.member-dlg-funding-track {
  position: relative;
  width: 220px;
  max-width: 100%;
  height: 8px;
  margin-top: 2px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.member-dlg-funding-in {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: #2db24b;
}

.member-dlg-funding-out {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  background: #cc2d2d;
}

.member-dlg-factor-track {
  position: relative;
  width: 220px;
  max-width: 100%;
  height: 8px;
  margin-top: 2px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.member-dlg-factor-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
}

.member-dlg-factor-fill--activity { background: #ffea00; }
.member-dlg-factor-fill--power { background: #ff7a00; }
.member-dlg-factor-fill--seniority { background: #7e3ff2; }

.member-dlg-committees {
  margin-top: 0.65rem;
  font-size: 0.85em;
}

.member-dlg-committees-label {
  font-weight: 600;
  color: #444;
  margin-bottom: 0.2rem;
}

.member-dlg-committees-list {
  margin: 0;
  padding-left: 1.2rem;
  color: #555;
  line-height: 1.5;
}

.member-dlg-committee-item em {
  color: #888;
  font-style: normal;
}

.member-dlg-committee-chairnote {
  font-weight: 400;
  font-style: italic;
  color: #888;
  font-size: 0.9em;
}

.member-dlg-role-badge {
  display: inline-block;
  font-size: 0.72em;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 0.35em;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.member-dlg-role-badge--chair {
  background: #7b2d00;
  color: #fff;
}

.member-dlg-role-badge--vicechair {
  background: #5a4300;
  color: #fff;
}

/* Breakdown dialog - white background, dark border */
.stdDlg.breakdown-dlg,
.wideDlg.breakdown-dlg { background: #ffffff; border: 2px solid #1a3a5c; color: #222; }

.wideDlg.breakdown-dlg { min-width: auto; max-width: 900px; }

.breakdown-dlg-content { padding: 0; }

.breakdown-dlg-close { min-width: 6em; }

/* Donor detail dialog - white background, blue border */
.stdDlg.donor-info-dlg,
.wideDlg.donor-info-dlg { background: #ffffff; border: 2px solid #1a5276; }

/* Donation level dialog */
.stdDlg.donate-levels-dlg {
  background: #ffffff;
  border: 2px solid #1a5276;
  color: #222;
  min-width: min(92vw, 30rem);
  max-width: 32rem;
}

.donate-levels-content {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.donate-levels-title {
  margin: 0;
  font-size: 1.2rem;
}

.donate-levels-subtitle {
  margin: 0;
  color: #445;
  font-size: 0.92rem;
}

.donate-levels-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.25rem;
}

.donate-level-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem 0.4rem;
  border-radius: 0.35rem;
  cursor: pointer;
}

.donate-level-option:hover {
  background: #eef4fb;
}

.donate-level-option input[type="radio"] {
  margin: 0;
}

.donate-level-label {
  line-height: 1.25;
}

/* Feedback dialog */
.stdDlg.feedback-dlg {
  background: #ffffff;
  border: 2px solid #1a5276;
  color: #222;
  min-width: min(94vw, 40rem);
  max-width: 42rem;
}

.feedback-dlg-content {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.feedback-dlg-title {
  margin: 0;
  font-size: 1.2rem;
}

.feedback-dlg-layout {
  display: flex;
  gap: 1rem;
  align-items: stretch;
}

.feedback-types {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0;
  min-width: 12rem;
  margin: 0;
  padding: 0;
  border: 0;
}

.feedback-type-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.1rem 0.45rem;
  border-radius: 0.35rem;
  cursor: pointer;
}

.feedback-type-option:hover {
  background: #eef4fb;
}

.feedback-type-option input[type="radio"] {
  margin: 0;
}

.feedback-type-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 1.9rem;
  width: 1.9rem;
  height: 1.9rem;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.35rem;
  line-height: 1;
}

.feedback-type-label {
  line-height: 1.25;
}

.feedback-type-option--disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.feedback-type-option--disabled:hover {
  background: transparent;
}

.feedback-message-wrap {
  flex: 1 1 auto;
}

.feedback-message {
  width: 100%;
  min-height: 8rem;
  resize: vertical;
  box-sizing: border-box;
  padding: 0.7rem 0.8rem;
  border: 1px solid #9db3c8;
  border-radius: 0.45rem;
  font: inherit;
  line-height: 1.4;
  color: #222;
  background: #fff;
}

.feedback-message:focus {
  outline: 2px solid rgba(26, 82, 118, 0.2);
  border-color: #1a5276;
}

.feedback-dlg .feedback-dlg-buttons {
  display: grid;
  grid-template-columns: auto 33% auto;
  justify-content: center;
  align-items: center;
  gap: 0;
  padding: 0.85em 1.1em 1em;
}

.feedback-dlg .feedback-dlg-buttons > button {
  min-width: 6.5rem;
}

#btnFeedbackSubmit {
  grid-column: 1;
  justify-self: start;
}

#btnFeedbackCancel {
  grid-column: 3;
  justify-self: end;
}

.feedback-reply-wrap {
  margin-top: 0.5rem;
}

.feedback-reply-label {
  display: block;
  font-size: 0.85rem;
  color: #555;
  margin-bottom: 0.25rem;
}

.feedback-reply-optional {
  color: #888;
}

.feedback-reply-email {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.7rem;
  border: 1px solid #9db3c8;
  border-radius: 0.45rem;
  font: inherit;
  font-size: 0.9rem;
  color: #222;
  background: #fff;
}

.feedback-reply-email:focus {
  outline: 2px solid rgba(26, 82, 118, 0.2);
  border-color: #1a5276;
}

.feedback-turnstile-wrap {
  margin-top: 0.55rem;
}

.feedback-turnstile-wrap:empty {
  display: none;
}

.stdDlg > :first-child,
.wideDlg > :first-child {
  max-height: 70vh;
  overflow-y: auto;
  padding:    1em;
}

.stdDlg::backdrop,
.wideDlg::backdrop {
  background: rgba(0,0,0,0.5);
}

.dlg-buttons {
  display:         flex;
  justify-content: center;
  gap:             0.5em;
  padding:         0.75em 1em;
}

.dlg-prompt-body {
  flex-direction: column;
  align-items:    stretch;
}

.dlg-prompt-body #inpPrompt {
  width:         100%;
  box-sizing:    border-box;
  margin-bottom: 0.5em;
  font-size:     1em;
  padding:       0.3em 0.5em;
  border-radius: 0.3em;
  border:        none;
}

.dlg-prompt-body > div {
  display:         flex;
  justify-content: center;
  gap:             0.5em;
}

/* -- Mobile -- */

@media (max-width: 700px) {
  body {
    height: auto;
    overflow: visible;
  }

  .app-layout {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .control-pane {
    position: static;
    max-height: none;
  }

  .results-pane,
  #resultsView {
    min-height: auto;
    overflow: visible;
  }

  .feedback-dlg-layout {
    flex-direction: column;
  }

  .feedback-types {
    min-width: 0;
  }

  .results-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .results-toolbar label {
    width: 100%;
  }

  .results-toolbar-spacer {
    display: none;
  }

  .results-contact-btn {
    margin-left: 0;
    width: 100%;
  }

  .results-toolbar select,
  .results-toolbar input[type="search"] {
    width: 100%;
  }

  .member-cards {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  .profile-action-group {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-actions button {
    width: 100%;
  }
}

/* -- Follow the Money tab -- */

.money-tab-panel {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.mf-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.4rem 0.6rem;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.mf-toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.mf-toolbar-sep {
  width: 1.25rem;
  display: inline-block;
}

.mf-toolbar input[type="search"] {
  width: 9rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid #bbb;
  border-radius: 3px;
  font-size: 0.9em;
}

.mf-toolbar select {
  padding: 0.2rem 0.4rem;
  border: 1px solid #bbb;
  border-radius: 3px;
  font-size: 0.9em;
}

.mf-toolbar-row-break {
  flex: 1 0 100%;
  height: 0;
}

#mfDonorJump {
  min-width: 14rem;
}

#mfDonorSort {
  width: auto;
}

.mf-sort-info {
  margin-left: auto;
  font-size: 0.78em;
  color: #888;
  white-space: nowrap;
  align-self: center;
}

.mf-show-all-btn {
  margin-left: 0.5rem;
  padding: 0.2em 0.6em;
  font-size: 0.78em;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  align-self: center;
}

/* -- Money flow relationships dialog -- */
.mf-rel-dlg {
  padding: 0;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  width: min(1200px, 96vw);
}
.dlg-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}
.dlg-title {
  font-size: 0.95em;
  font-weight: 700;
  color: var(--color-text);
}
.dlg-close-btn {
  padding: 0.25em 0.75em;
  font-size: 0.82em;
  font-weight: 600;
  min-width: 5.5rem;
}
.mf-rel-body {
  overflow: hidden;
  padding: 0 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.mf-rel-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.mf-rel-table thead,
.mf-rel-table tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}
.mf-rel-table tbody {
  display: block;
  overflow-y: auto;
  max-height: 62vh;
}
.mf-rel-table thead th {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.35rem 0.4rem;
  font-size: 0.75em;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-muted);
  text-align: center;
}
.mf-rel-table th:nth-child(1),
.mf-rel-table td:nth-child(1),
.mf-rel-table th:nth-child(3),
.mf-rel-table td:nth-child(3),
.mf-rel-table th:nth-child(5),
.mf-rel-table td:nth-child(5) {
  width: 31%;
}
.mf-rel-table th:nth-child(2),
.mf-rel-table td:nth-child(2),
.mf-rel-table th:nth-child(4),
.mf-rel-table td:nth-child(4) {
  width: 3.5%;
}
.mf-rel-table tbody tr {
  border-bottom: 1px solid rgba(0,0,0,0.08);
}
.mf-rel-table td {
  padding: 0.22rem 0.3rem;
  vertical-align: middle;
}
.mf-rel-arrow-cell {
  text-align: center;
}
.mf-rel-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.mf-rel-col-hdr {
  font-size: 0.75em;
  font-weight: 700;
  color: var(--color-muted, #888);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  padding-bottom: 0.4rem;
  margin-bottom: 0.15rem;
}
.mf-rel-col-hdr span:nth-child(2),
.mf-rel-col-hdr span:nth-child(4) { display: none; }
.mf-rel-cell {
  display: flex;
  align-items: center;
}
.mf-rel-left  { justify-content: flex-end;   text-align: right; }
.mf-rel-center{ justify-content: center;     text-align: center; }
.mf-rel-right { justify-content: flex-start; text-align: left; }
.mf-rel-link {
  background: none;
  border: none;
  color: var(--color-accent);
  cursor: pointer;
  font-size: 0.88em;
  padding: 0.1em 0.2em;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.mf-rel-link:hover { color: #fff; }
.mf-rel-arrow {
  color: var(--color-muted, #888);
  font-size: 0.8em;
  white-space: nowrap;
  padding: 0 0.1rem;
}
.mf-rel-none {
  color: var(--color-muted, #888);
  font-style: italic;
  font-size: 0.85em;
}

.mf-section-heading {
  margin: 0 0 0.75rem;
  font-size: 1.15em;
  font-weight: 700;
  color: var(--color-accent);
}

.mf-loop-indicator {
  color: #b02222;
  font-size: 0.88em;
  font-weight: 700;
}

.mf-container {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.mf-empty {
  color: var(--color-muted);
  font-style: italic;
  padding: 2rem;
  text-align: center;
}

/* Table group headings (thead th with colspan) */
.mf-table thead th {
  padding: 0.2rem 0.4rem;
  font-size: 0.78em;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
}

.mf-head-donors { color: #1a5c8a; }
.mf-head-focus  { color: var(--color-accent); }
.mf-head-recips { color: #1a6b3c; }

/* Flow table */
.mf-table {
  border-collapse: collapse;
  table-layout: auto;
}

.mf-table td {
  padding: 0.15rem 0.2rem;
  vertical-align: middle;
  white-space: nowrap;
}

/* Focus card column - generous horizontal padding */
.mf-col-focus {
  padding: 0.15rem 0.4rem;
  text-align: center;
  vertical-align: middle;
}

/* Donor-area placeholder when there are no donors: keeps the focus column
   horizontally stable. min-width approximates a typical card width. */
.mf-col-donor-placeholder {
  min-width: 12rem;
}

/* Recipient-area placeholder when there are no recipients */
.mf-col-recip-placeholder {
  min-width: 12rem;
}

/* Highlight a donor/legislator card that matches the active filter text */
.mf-card-filter-match {
  outline: 2px solid #e67e22;
  outline-offset: 1px;
  border-radius: 3px;
}

/* Card cells: no extra padding so cards sit flush */
.mf-col-card {
  padding: 0.15rem 0.2rem;
  vertical-align: top;
}

/* Amount column */
.mf-col-amount {
  text-align: right;
  font-size: 0.82em;
  font-variant-numeric: tabular-nums;
  padding: 0.15rem 0.35rem;
  color: #333;
  white-space: nowrap;
}

/* Arrow column */
.mf-col-arrow-sm {
  text-align: center;
  padding: 0.15rem 0.1rem;
}

/* Loop label column */
.mf-col-loop {
  padding: 0.15rem 0.25rem;
  text-align: center;
}

/* Loop label text */
.mf-loop-label {
  display: inline-block;
  color: #c0392b;
  font-weight: 700;
  font-size: 0.78em;
  letter-spacing: 0.04em;
  line-height: 1.2;
  padding: 1px 3px;
  border: 1px solid #e8a09a;
  border-radius: 3px;
  background: #fce8e6;
}

/* Arrow span */
.mf-arrow {
  font-size: 1.1em;
  color: #555;
  line-height: 1;
}

/* Bracket column - sized just wide enough for its border */
.mf-col-bracket {
  width: 10px;
  min-width: 10px;
  padding: 0;
}

/* Right-side bracket (Collector) - borders on right */
.mf-bracket-top      { border-top:    2px solid #777; border-right: 2px solid #777; }
.mf-bracket-mid      {                                 border-right: 2px solid #777; }
.mf-bracket-bot      { border-bottom: 2px solid #777; border-right: 2px solid #777; }
.mf-bracket-only     { border-top: 2px solid #777; border-right: 2px solid #777; border-bottom: 2px solid #777; }

/* Left-side bracket (Distributor) - borders on left */
.mf-bracket-top-l    { border-top:    2px solid #777; border-left: 2px solid #777; }
.mf-bracket-mid-l    {                                 border-left: 2px solid #777; }
.mf-bracket-bot-l    { border-bottom: 2px solid #777; border-left: 2px solid #777; }
.mf-bracket-only-l   { border-top: 2px solid #777; border-left: 2px solid #777; border-bottom: 2px solid #777; }

/* Prev/Next navigation buttons */
.mf-nav-btn {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-size: 0.82em;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  cursor: pointer;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-accent);
}

.mf-nav-btn:hover {
  background: #ddeeff;
  border-color: #6699cc;
}

/* Simple layout (neither donors nor recipients) */
.mf-simple {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0;
}

.mf-focus-slot {
  display: flex;
  justify-content: center;
}
