@font-face {
  font-family: "Source Sans 3";
  src: url("/fonts/source-sans-3.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
}
@font-face {
  font-family: "Source Serif 4";
  src: url("/fonts/source-serif-4.woff2") format("woff2");
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f8f9fa;
  --surface: #ffffff;
  --sidebar-bg: #ffffff;
  --subtle: #f3f4f6;
  --hover: #f4f5f7;
  --line: #e4e4e7;
  --line-strong: #d4d4d8;
  --ink: #111113;
  --secondary: #52525b;
  --muted: #6b7280;
  --accent: #0f766e;
  --accent-hover: #0d5f59;
  --accent-soft: #f0fdfa;
  --accent-line: #99f6e4;
  --btn-bg: #18181b;
  --btn-ink: #ffffff;
  --btn-hover: #27272a;

  --score3-bg: #ecfdf5; --score3-ink: #047857; --score3-line: #a7f3d0;
  --score2-bg: #eff6ff; --score2-ink: #1d4ed8; --score2-line: #bfdbfe;
  --score1-bg: #fefce8; --score1-ink: #a16207; --score1-line: #fef08a;
  --score0-bg: #f4f4f5; --score0-ink: #71717a; --score0-line: #e4e4e7;

  --ok: #15803d; --ok-bg: #f0fdf4; --ok-line: #bbf7d0;
  --danger: #b91c1c; --danger-bg: #fef2f2; --danger-line: #fecaca;
  --warn: #a16207; --warn-bg: #fefce8; --warn-line: #fde68a;
  --info: #1d4ed8; --info-bg: #eff6ff; --info-line: #bfdbfe;
  --mark: #fef08a;
  --paper-shadow: 0 2px 12px rgba(17, 17, 19, 0.08), 0 0 0 1px rgba(17, 17, 19, 0.06);

  --text-body: 0.9625rem;
  --text-sm: 0.875rem;
  --text-xs: 0.8125rem;
  --radius: 6px;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f12;
  --surface: #17171b;
  --sidebar-bg: #141418;
  --subtle: #1e1e23;
  --hover: #222229;
  --line: #27272e;
  --line-strong: #3f3f48;
  --ink: #ececef;
  --secondary: #a1a1aa;
  --muted: #8b8b96;
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-soft: #102624;
  --accent-line: #1e4d47;
  --btn-bg: #ececef;
  --btn-ink: #111113;
  --btn-hover: #d4d4d8;

  --score3-bg: #0f261e; --score3-ink: #34d399; --score3-line: #1a4d3c;
  --score2-bg: #132035; --score2-ink: #60a5fa; --score2-line: #1e3a5f;
  --score1-bg: #271f0f; --score1-ink: #fbbf24; --score1-line: #544016;
  --score0-bg: #1f1f24; --score0-ink: #8e8e99; --score0-line: #32323a;

  --ok: #4ade80; --ok-bg: #0f2417; --ok-line: #1e462d;
  --danger: #f87171; --danger-bg: #2a1517; --danger-line: #5b2126;
  --warn: #fbbf24; --warn-bg: #271f0f; --warn-line: #544016;
  --info: #60a5fa; --info-bg: #132035; --info-line: #1e3a5f;
  --mark: rgba(250, 204, 21, 0.28);
  --paper-shadow: 0 4px 20px rgba(0,0,0,0.45), 0 0 0 1px #27272e;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
/* every size is in rem: the root sets them all (owner: "la fuente es pequeña"; 16px → 18px) */
html { font-size: 112.5%; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--text-body);
  line-height: 1.48;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num, table { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--surface); border: 1px solid var(--line); padding: 6px 12px; border-radius: var(--radius); z-index: 100; }
.skip:focus { top: 8px; }

/* App Frame: Fixed Left Sidebar + Main Scrollable Workspace */
.app-frame {
  display: grid;
  grid-template-columns: 222px minmax(0, 1fr);
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 12px;
  overflow-y: auto;
}
.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 10px;
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-weight: 700;
  font-size: 0.95rem;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1rem; letter-spacing: -0.02em; }
.brand-text small { font-size: 0.72rem; color: var(--muted); font-weight: 500; }

.sidebar-nav {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.nav-group-label {
  font-size: 0.69rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0 8px;
  margin-bottom: 4px;
}
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: left;
  transition: background-color 120ms var(--ease), color 120ms var(--ease);
}
.nav-item svg { width: 15px; height: 15px; flex-shrink: 0; opacity: 0.8; }
.nav-item:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.is-active svg { opacity: 1; }
.nav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  font-size: 0.71rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--subtle);
  color: var(--secondary);
}
.nav-item.is-active .nav-badge {
  background: var(--accent);
  color: #ffffff;
}
.nav-ext-arrow { font-size: 0.75rem; color: var(--muted); }

.sidebar-footer {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.sync-mini {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 10px;
  padding: 0 4px;
}
.sync-dot { width: 7px; height: 7px; border-radius: 99px; background: var(--ok); flex-shrink: 0; }
.user-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}
.user-avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}
.user-meta { min-width: 0; flex: 1; }
.user-meta select {
  width: 100%;
  border: none;
  background: transparent;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.user-meta select:focus { outline: none; }
.user-role { font-size: 0.69rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 2px; }

/* Buttons & Inputs */
.btn-primary, .btn-accent, .btn-subtle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease);
}
.btn-primary { background: var(--btn-bg); color: var(--btn-ink); }
.btn-primary:hover { background: var(--btn-hover); text-decoration: none; }
.btn-accent { background: var(--accent); color: #ffffff; font-weight: 600; }
.btn-accent:hover { background: var(--accent-hover); text-decoration: none; }
.btn-subtle { background: var(--surface); color: var(--secondary); border-color: var(--line); }
.btn-subtle:hover { background: var(--hover); color: var(--ink); border-color: var(--line-strong); text-decoration: none; }
.btn-xs { height: 26px; padding: 0 8px; font-size: var(--text-xs); }
.btn-sm { height: 30px; padding: 0 10px; font-size: var(--text-xs); }
.btn-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--secondary);
}
.icon-btn:hover { background: var(--subtle); color: var(--ink); }
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn .icon-sun { display: none; }
:root[data-theme="dark"] .icon-btn .icon-sun { display: block; }
:root[data-theme="dark"] .icon-btn .icon-moon { display: none; }

.input, .select {
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: var(--text-sm);
  color: var(--ink);
}
.input:focus, .select:focus { border-color: var(--accent); outline: none; }

/* Main Column */
.main-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px 0;
}
.page-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 12px;
}
.page-header h1 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.page-sub { font-size: var(--text-xs); color: var(--muted); margin-top: 2px; }

.tab-strip {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.tab-search {
  margin-left: auto;
  flex: 0 1 320px;
  min-width: 190px;
  margin-bottom: 6px;
}
.theme-floating {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--paper-shadow);
}
.page-header-row { padding-right: 44px; }
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.is-active { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.tab-count {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--subtle);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tab-btn.is-active .tab-count { background: var(--accent-soft); color: var(--accent); }

.page-body {
  padding: 16px 20px 36px;
  flex: 1 1 auto;
}

/* Filter Bar (Sticky Top Bar) */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.search-wrap {
  position: relative;
  flex: 1 1 260px;
  max-width: 420px;
}
.search-wrap input {
  width: 100%;
  padding-left: 31px;
}
.search-wrap svg {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

/* Signal Score Badges (Stotles 0-3 style) */
.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 0.74rem;
  font-weight: 700;
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.score-3 { background: var(--score3-bg); color: var(--score3-ink); border-color: var(--score3-line); }
.score-2 { background: var(--score2-bg); color: var(--score2-ink); border-color: var(--score2-line); }
.score-1 { background: var(--score1-bg); color: var(--score1-ink); border-color: var(--score1-line); }
.score-0 { background: var(--score0-bg); color: var(--score0-ink); border-color: var(--score0-line); }

.signal-bars {
  display: inline-flex;
  gap: 2px;
  align-items: flex-end;
}
.signal-bars i {
  display: block;
  width: 3px;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.25;
}
.signal-bars i.on { opacity: 1; }
.signal-bars i:nth-child(1) { height: 6px; }
.signal-bars i:nth-child(2) { height: 9px; }
.signal-bars i:nth-child(3) { height: 12px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 0.71rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--subtle);
  color: var(--secondary);
  white-space: nowrap;
}
.badge-accent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok-line); }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-line); white-space: normal; line-height: 1.3; }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.badge-info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }

/* Dense Opportunity Table (Stotles / GovTribe default) */
.table-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
}
.opp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.opp-table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 8px 9px;
  border-bottom: 1px solid var(--line);
  background: var(--subtle);
  white-space: nowrap;
}
.opp-table td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.opp-table tr:last-child td { border-bottom: none; }
.opp-table tbody tr {
  transition: background-color 100ms var(--ease);
  cursor: pointer;
}
.opp-table tbody tr:hover { background: var(--hover); }
.opp-table tbody tr.is-focused {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}
.opp-table tbody tr.is-seen .opp-title { font-weight: 500; }
.opp-table tbody tr.is-seen .opp-title { color: var(--secondary); }
.opp-table tbody tr.is-unread .opp-title { font-weight: 700; }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: 2px; }
.opp-title {
  font-weight: 600;
  color: var(--ink);
  font-size: 0.91rem;
  line-height: 1.32;
  margin-bottom: 3px;
}
.opp-title:hover { color: var(--accent); }
.opp-sub { font-size: var(--text-xs); color: var(--secondary); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.reason-chip {
  display: inline-block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--secondary);
  line-height: 1.3;
  max-width: 210px;
}
.triage-cell {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-end;
}
.triage-btns {
  display: inline-flex;
  gap: 4px;
  flex-wrap: nowrap;
}
.t-btn {
  height: 25px;
  padding: 0 7px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--secondary);
  font-size: 0.71rem;
  font-weight: 600;
  white-space: nowrap;
}
.t-btn:hover { background: var(--subtle); color: var(--ink); border-color: var(--line-strong); }
.t-btn.is-on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.t-btn.is-danger:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }

.assignee-select {
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  font-size: 0.71rem;
  color: var(--secondary);
}

/* Kanban Pipeline */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(195px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.kanban-col {
  background: var(--subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 420px;
}
.kanban-col-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.71rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--secondary);
  padding: 2px 2px 6px;
  border-bottom: 1px solid var(--line);
}
.kanban-col-head .num { white-space: nowrap; flex-shrink: 0; }
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 120ms var(--ease);
}
.kanban-card:hover { border-color: var(--accent); }
.kanban-card-title {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  cursor: pointer;
}
.kanban-card-title:hover { color: var(--accent); }
.kanban-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  color: var(--secondary);
}
.kanban-move {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

/* Opportunity Detail Page */
.detail-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 14px 24px 0;
}
.detail-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.detail-facts-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 0 12px;
  border-top: 1px solid var(--line);
}
.fact-cell { font-size: var(--text-xs); }
.fact-cell .fl { color: var(--muted); display: block; }
.fact-cell .fv { font-weight: 700; color: var(--ink); font-size: 0.86rem; font-variant-numeric: tabular-nums; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  margin-bottom: 14px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* Fact Sheet Grid (No prose fluff) */
.factsheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.factsheet-table th {
  width: 220px;
  text-align: left;
  padding: 8px 10px;
  color: var(--muted);
  font-weight: 600;
  font-size: var(--text-xs);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  background: var(--subtle);
}
.factsheet-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.factsheet-table tr:last-child th,
.factsheet-table tr:last-child td { border-bottom: none; }

.cite-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: 4px;
  vertical-align: baseline;
}
.cite-btn:hover { background: var(--accent); color: #ffffff; }

/* Split-Pane Documents + Q&A Tab (Blueprint §6) */
.doc-view, .doc-qa-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.doc-view { grid-template-columns: 250px minmax(0, 1fr);
  gap: 14px;
  height: calc(100vh - 230px);
  min-height: 520px;
}
.viewer-box {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #eceef1;
}
:root[data-theme="dark"] .viewer-box { background: #0b0b0d; }
.doc-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.doc-tab {
  border: 1px solid var(--line);
  background: var(--subtle);
  color: var(--secondary);
  border-radius: 5px;
  padding: 4px 9px;
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}
.doc-tab.is-active { background: var(--btn-bg); color: var(--btn-ink); border-color: transparent; }
.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: var(--text-xs);
}
.viewer-hl-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 6px;
  padding: 6px 10px;
  background: var(--subtle);
  border-bottom: 1px solid var(--line);
  font-size: var(--text-xs);
}
.hl-chip {
  border: 1px solid var(--warn-line);
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 0.71rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}
.viewer-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.pdf-page {
  width: 100%;
  max-width: 640px;
  background: #fff;
  color: #18181b;
  padding: 30px 34px 26px;
  border-radius: 3px;
  box-shadow: var(--paper-shadow);
  transform-origin: top center;
}
:root[data-theme="dark"] .pdf-page { background: #1a1a1f; color: #e4e4e7; }
.pdf-page-head, .pdf-page-foot {
  display: flex;
  justify-content: space-between;
  font-size: 0.71rem;
  color: #71717a;
}
.pdf-page-head { border-bottom: 1px solid #e4e4e7; padding-bottom: 7px; margin-bottom: 14px; }
.pdf-page-foot { border-top: 1px solid #e4e4e7; padding-top: 7px; margin-top: 16px; }
:root[data-theme="dark"] .pdf-page-head { border-bottom-color: #2e2e36; }
:root[data-theme="dark"] .pdf-page-foot { border-top-color: #2e2e36; }
.pdf-body { font-family: "Source Serif 4", Georgia, serif; font-size: 0.92rem; line-height: 1.62; }
.pdf-body h4 { font-family: "Source Sans 3", sans-serif; margin: 0 0 8px; font-size: 0.95rem; }
.pdf-clause { margin: 0 0 10px; padding: 4px 7px; border-radius: 4px; }
.pdf-clause.ai-hl { background: rgba(254, 240, 138, 0.45); border-left: 3px solid #ca8a04; padding-left: 10px; }
:root[data-theme="dark"] .pdf-clause.ai-hl { background: rgba(250, 204, 21, 0.14); border-left-color: #fbbf24; }
.pdf-clause.is-focused { background: rgba(250, 204, 21, 0.72); box-shadow: 0 0 0 2px #ca8a04; }
:root[data-theme="dark"] .pdf-clause.is-focused { background: rgba(250, 204, 21, 0.30); box-shadow: 0 0 0 2px #fbbf24; }

/* Risks / Flags */
.risk-card {
  padding: 11px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--danger-line);
  background: var(--danger-bg);
  margin-bottom: 8px;
}
.risk-card.is-warn { border-color: var(--warn-line); background: var(--warn-bg); }
.risk-title { font-weight: 700; font-size: var(--text-sm); color: var(--danger); margin-bottom: 3px; }
.risk-card.is-warn .risk-title { color: var(--warn); }

/* Plain-language interest cards */
.interest-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  margin-bottom: 8px;
}

/* Modal & Toast */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 19, 0.5);
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-card {
  width: min(740px, 100%);
  max-height: 88vh;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(0,0,0,0.24);
}
.modal-head, .modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { margin: 0; font-size: 0.98rem; }
.modal-body { padding: 16px; overflow-y: auto; flex: 1 1 auto; }
.modal-foot { border-bottom: none; border-top: 1px solid var(--line); background: var(--subtle); }
.textarea {
  width: 100%;
  min-height: 260px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.toast-root {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-size: var(--text-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
}
.toast button {
  border: 1px solid rgba(255,255,255,0.28);
  background: transparent;
  color: inherit;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 0.69rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--secondary);
}

@media (max-width: 1120px) {
  .app-frame { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--line); }
  .doc-qa-split { grid-template-columns: 1fr; height: auto; }
  .doc-view { height: auto; }
  .doc-view .viewer-box { height: 75vh; }
  .detail-facts-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* a screen parked for now (owner): visible but dimmed and not clickable */
.nav-item.is-parked { opacity: 0.4; cursor: not-allowed; }
.nav-item.is-parked:hover { background: transparent; }

/* a read pliego's page as extracted: keep its line breaks */
.pdf-body .pdf-clause.raw { white-space: pre-wrap; font-size: 0.86rem; line-height: 1.45; }

/* the passage a fact-sheet value or an answer cites, on its page */
mark.quote { background: var(--warn-bg); color: inherit; outline: 2px solid var(--warn-line); border-radius: 2px; }
/* on a read pliego the whole page is one block: mark only the cited passage, not the page */
.pdf-body .pdf-clause.raw.is-focused { background: transparent; box-shadow: none; outline: none; border-color: transparent; }
.pdf-body .pdf-clause.raw mark.quote { background: #fde047; color: #111; outline: none; padding: 1px 0; }

/* the sidebar folds to a rail of icons (btn-collapse) */
.sidebar-tools { display: flex; gap: 4px; align-items: center; }
.app-frame { transition: grid-template-columns 160ms var(--ease); }
.app-frame.is-collapsed { grid-template-columns: 60px minmax(0, 1fr); }
.app-frame.is-collapsed .sidebar { padding: 12px 8px; overflow-x: hidden; }
.app-frame.is-collapsed .sidebar-top { flex-direction: column; gap: 8px; padding: 2px 0 10px; }
.app-frame.is-collapsed .sidebar-tools { flex-direction: column; }
.app-frame.is-collapsed .brand-text,
.app-frame.is-collapsed .nav-label,
.app-frame.is-collapsed .nav-group-label,
.app-frame.is-collapsed .nav-ext-arrow,
.app-frame.is-collapsed .sync-mini,
.app-frame.is-collapsed .user-meta,
.app-frame.is-collapsed #btn-theme { display: none; }
.app-frame.is-collapsed .nav-item { justify-content: center; padding: 9px 0; position: relative; }
.app-frame.is-collapsed .nav-item svg { width: 18px; height: 18px; }
.app-frame.is-collapsed .nav-badge { position: absolute; top: 1px; right: 2px; font-size: 0.6rem; padding: 0 4px; }
.app-frame.is-collapsed .nav-badge[hidden] { display: none; }
.app-frame.is-collapsed .user-card { justify-content: center; padding: 6px 0; border: none; background: transparent; }
.app-frame.is-collapsed #btn-collapse .chev { transform: rotate(180deg); transform-origin: 14px 12px; }

/* Pliegos being read: a spinner in the badges, a panel with an indeterminate bar on top of the detail */
.spinner { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; vertical-align: -1px; animation: radar-spin .8s linear infinite; }
.spinner-lg { width: 20px; height: 20px; border-width: 3px; margin: 2px 0 0; color: var(--info); flex: none; }
.badge.is-busy { font-weight: 600; }
.read-elapsed { font-variant-numeric: tabular-nums; font-weight: 600; margin-left: 4px; opacity: .85; }
.read-panel { border: 1px solid var(--info-line); background: var(--info-bg); color: var(--ink); border-radius: 10px; padding: 12px 14px 0;
  margin: 0 0 14px; overflow: hidden; }
.read-panel-row { display: flex; gap: 12px; align-items: flex-start; }
.read-panel strong { color: var(--info); }
.read-panel-sub { font-size: var(--text-xs); color: var(--secondary); margin-top: 3px; line-height: 1.45; }
.read-bar { height: 3px; margin: 12px -14px 0; background: var(--info-line); position: relative; overflow: hidden; }
.read-bar span { position: absolute; top: 0; bottom: 0; width: 35%; background: var(--info); animation: radar-bar 1.6s ease-in-out infinite; }
@keyframes radar-spin { to { transform: rotate(360deg); } }
@keyframes radar-bar { 0% { left: -35%; } 100% { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .spinner, .read-bar span { animation-duration: 3s; } }

/* Inbox as cards: a responsive grid; each card reads top to bottom: score and deadline, title, buyer, money, why */
.view-switch { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.view-switch button { border: 0; background: none; color: var(--muted); padding: 6px 9px; cursor: pointer; display: grid; place-items: center; }
.view-switch button + button { border-left: 1px solid var(--line); }
.view-switch button:hover { color: var(--ink); background: var(--hover); }
.view-switch button.is-on { color: var(--accent); background: var(--accent-soft); }

.opp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.opp-card { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px 12px; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; min-width: 0; }
.opp-card:hover { border-color: var(--line-strong); box-shadow: var(--paper-shadow); transform: translateY(-1px); }
.opp-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.opp-card.is-unread { border-left: 3px solid var(--accent); padding-left: 14px; }
.oc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.oc-deadline { font-size: var(--text-xs); font-weight: 600; color: var(--secondary); background: var(--subtle); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.oc-deadline.is-near { color: var(--warn); background: var(--warn-bg); }
.oc-deadline.is-soon { color: var(--danger); background: var(--danger-bg); }
.oc-title { margin: 2px 0 0; font-size: .97rem; line-height: 1.35; font-weight: 700; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.opp-card.is-seen .oc-title { font-weight: 500; color: var(--secondary); }
.opp-card:hover .oc-title { color: var(--accent); }
.oc-buyer { font-size: var(--text-sm); color: var(--secondary); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.oc-money { display: flex; align-items: center; gap: 8px; }
.oc-money strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.oc-reason { margin: 0; font-size: var(--text-xs); line-height: 1.45; color: var(--secondary); background: var(--subtle); border-radius: var(--radius);
  padding: 7px 9px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.oc-foot { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.oc-state { flex: 1 1 auto; min-width: 0; }
.oc-meta { display: flex; gap: 8px; font-size: var(--text-xs); color: var(--muted); white-space: nowrap; }
.oc-actions { display: flex; gap: 4px; }
@media (max-width: 560px) { .opp-cards { grid-template-columns: 1fr; } }

/* a fact-sheet item stated in other documents too: their citations, smaller, under the item */
.also-in { font-size: var(--text-xs); font-weight: 400; color: var(--muted); margin-top: 3px; }

/* EU notices (C4P, TED): their own sidebar entry with Bandeja's tabs; chips filter by why they came in */
.eu-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.eu-chip { border: 1px solid var(--line); background: var(--surface); color: var(--secondary); border-radius: 999px; padding: 4px 11px;
  font-size: var(--text-xs); font-weight: 600; cursor: pointer; }
.eu-chip span { color: var(--muted); font-weight: 500; margin-left: 2px; }
.eu-chip.is-on { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.eu-pill { display: inline-flex; align-items: center; font-size: var(--text-xs); font-weight: 700; border-radius: 999px; padding: 2px 9px;
  border: 1px solid var(--info-line); background: var(--info-bg); color: var(--info); white-space: nowrap; }
.eu-pill.eu-hadea, .eu-pill.eu-tender_core, .eu-pill.eu-grant_core { border-color: var(--score3-line); background: var(--score3-bg); color: var(--score3-ink); }
.eu-pill.eu-pcp { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.eu-pill.eu-tender_health, .eu-pill.eu-grant_health { border-color: var(--line-strong); background: var(--surface); color: var(--secondary); }

/* Nuevas as wide bands: one tender per band across the whole width (owner: not a grid of tiles) */
.opp-bands { display: flex; flex-direction: column; gap: 10px; }
.opp-band { display: grid; grid-template-columns: 210px minmax(0, 1fr) auto; gap: 18px; align-items: start; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.opp-band:hover { border-color: var(--line-strong); box-shadow: var(--paper-shadow); }
.opp-band:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.opp-band.is-unread { border-left: 3px solid var(--accent); padding-left: 14px; }
.ob-signal { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.ob-reason { margin: 0; font-size: var(--text-xs); line-height: 1.45; color: var(--secondary);
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ob-body { min-width: 0; }
.ob-title { margin: 0 0 5px; font-size: 1.04rem; line-height: 1.35; font-weight: 700; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.opp-band.is-seen .ob-title { font-weight: 500; color: var(--secondary); }
.opp-band:hover .ob-title { color: var(--accent); }
.ob-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--text-sm); color: var(--secondary); }
.ob-meta strong { color: var(--ink); font-weight: 600; }
.ob-ref { font-family: monospace; color: var(--muted); }
.ob-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ob-side { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; white-space: nowrap; }
.ob-money { font-size: 1.12rem; font-variant-numeric: tabular-nums; }
@media (max-width: 1000px) {
  .opp-band { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .ob-signal { flex-direction: row; align-items: center; }
  .ob-reason { -webkit-line-clamp: 2; }
  .ob-side { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
}
.ob-dates { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 3px; font-size: var(--text-sm); color: var(--muted); }
.ob-deadline { font-weight: 600; color: var(--secondary); }
.ob-deadline.is-near { color: var(--warn); }
.ob-deadline.is-soon { color: var(--danger); }
.ob-lang { font-size: var(--text-xs); font-weight: 500; color: var(--muted); white-space: nowrap; }
.opp-band.is-eu { grid-template-columns: 122px minmax(0, 1fr) auto; }

/* long descriptions (EU notices): a comfortable line length, paragraphs, lists */
.desc-text { max-width: 80ch; line-height: 1.65; }
.desc-text p { margin: 0 0 .8em; }
.desc-text p:last-child { margin-bottom: 0; }
.desc-list { margin: -.3em 0 .9em; padding-left: 1.3em; }
.desc-list li { margin: .2em 0; }

/* the tender's pages under its title in the detail: plain links with an external-link icon */
.detail-links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 6px; font-size: var(--text-sm); }
.detail-links a { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; text-decoration: none; }
.detail-links a:hover { text-decoration: underline; }
.ext-icon { width: 13px; height: 13px; flex: none; opacity: .8; }

/* --- Detail page of a Spanish tender: Resumen, Criterios y precio, Requisitos, Alcance, Entrega, Bitácora --- */
.lot-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: var(--text-xs); color: var(--secondary); }
.lot-bar label { font-weight: 700; color: var(--ink); }
.lot-bar select { height: 28px; max-width: min(520px, 100%); font-size: var(--text-xs); }
.fs-missing { color: var(--secondary); font-size: var(--text-sm); padding: 4px 0; }
.fs-dash { color: var(--muted); font-size: var(--text-xs); }
.fs-sub { color: var(--secondary); font-size: var(--text-xs); margin-top: 3px; }
.fs-note { color: var(--secondary); font-size: var(--text-sm); margin: 0 0 8px; }
.fs-scope { margin: 0 0 4px; font-size: var(--text-body); line-height: 1.5; }
.alert-row { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: var(--text-sm); }
.alert-row:last-of-type { border-bottom: none; }
.alert-q { margin-top: 4px; color: var(--secondary); font-size: var(--text-xs); }
.link-btn { background: none; border: none; padding: 0 2px; color: var(--accent); font: inherit; font-size: var(--text-xs); font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.tab-line { display: grid; grid-template-columns: minmax(120px, 170px) 1fr auto; gap: 10px; align-items: baseline; width: 100%;
  padding: 9px 4px; background: none; border: none; border-bottom: 1px solid var(--line); text-align: left; font: inherit;
  font-size: var(--text-sm); color: var(--ink); cursor: pointer; }
.tab-line:last-child { border-bottom: none; }
.tab-line:hover { background: var(--hover); }
.tab-line span { color: var(--secondary); }
.score-split { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.score-split div { background: var(--subtle); border-radius: var(--radius); padding: 10px; text-align: center; }
.score-split strong { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.score-split span { font-size: var(--text-xs); color: var(--secondary); }
.table-scroll { overflow-x: auto; }
.fs-grid td, .ck-table td { vertical-align: top; font-size: var(--text-sm); }
.ck-env { font-weight: 700; font-size: var(--text-sm); margin: 12px 0 4px; }
.ck-env:first-of-type { margin-top: 0; }
.ck-env span { font-weight: 400; color: var(--secondary); }
.ck-table td:first-child { min-width: 220px; }
.ck-table tr.ck-hecho td:first-child, .ck-table tr.ck-no_aplica td:first-child { color: var(--muted); }
.ck-table tr.ck-hecho td:first-child { text-decoration: line-through; }
.input-xs { height: 28px; font-size: var(--text-xs); min-width: 110px; }
.req-list { margin: 0; padding-left: 20px; font-size: var(--text-sm); }
.req-list li { margin: 4px 0; }
.log-form { display: grid; gap: 8px; }
.log-form select { max-width: 260px; }
.log-form button { justify-self: start; }
.log-entry { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: var(--text-sm); }
.log-entry:last-child { border-bottom: none; }
.log-text { margin: 4px 0 2px; white-space: pre-wrap; }
@media (max-width: 560px) {
  .score-split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tab-line { grid-template-columns: 1fr auto; }
  .tab-line span:not([aria-hidden]) { grid-column: 1 / -1; grid-row: 2; }
}
.log-form textarea { height: auto; padding: 8px 9px; line-height: 1.45; resize: vertical; }
.crit-row { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: var(--text-sm); }
.crit-row:last-child { border-bottom: none; }
.crit-name { min-width: 0; flex: 1; }
.crit-pts { white-space: nowrap; text-align: right; }
.ck-table { table-layout: fixed; min-width: 720px; }
.ck-table th:nth-child(2) { width: 190px; }
.ck-table th:nth-child(3) { width: 130px; }
.ck-table th:nth-child(4) { width: 210px; }
.ck-table .input-xs { width: 100%; min-width: 0; }
@media (max-width: 560px) {
  /* on a phone a fact's label goes above its value, so the value gets the whole width */
  .factsheet-table, .factsheet-table tbody, .factsheet-table tr, .factsheet-table th, .factsheet-table td { display: block; width: auto; }
  .factsheet-table th { border-bottom: none; padding-bottom: 2px; }
  .factsheet-table td { padding-top: 2px; }
  .crit-row { flex-direction: column; gap: 4px; }
  .crit-pts { text-align: left; }
}

/* past examples (radar/examples.py) */
.badge-example { background: var(--subtle); color: var(--secondary); border: 1px dashed var(--line-strong); }
.example-line { font-size: var(--text-xs); color: var(--secondary); margin-top: 4px; line-height: 1.5; }
.example-line code { font-size: 0.95em; }

/* The cited source, in a panel on the right (app-v2.js openSource): the tab being read stays visible beside it */
.src-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 70;
  width: min(46vw, 760px);
  display: flex; flex-direction: column;
  background: var(--bg); border-left: 1px solid var(--line-strong);
  box-shadow: -10px 0 28px rgba(0, 0, 0, 0.14);
  animation: src-in 160ms var(--ease);
}
@keyframes src-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
body.has-src-panel .main-col { margin-right: min(46vw, 760px); }
.src-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; background: var(--surface); }
.src-doc { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.src-sub { font-size: var(--text-xs); color: var(--muted); margin-top: 2px; }
.src-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; padding: 0 16px 10px; background: var(--surface); border-bottom: 1px solid var(--line); }
.src-quote { margin: 12px 16px 0; padding: 8px 12px; font-size: var(--text-sm); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius); }
.src-quote span { color: var(--secondary); font-size: var(--text-xs); }
.src-scroll { position: relative; flex: 1 1 auto; overflow-y: auto; padding: 16px; }
.src-scroll .pdf-page { max-width: none; }
@media (max-width: 1000px) {
  .src-panel { width: 100vw; }
  body.has-src-panel .main-col { margin-right: 0; }
}

/* the original PDF page, drawn by pdf.js (app-v2.js, showPdfPage): the canvas, and over it pdf.js's invisible text
   layer, where the cited passage (pdfq) and the searched words (pdfs) are marked. The text-layer rules follow
   pdf.js 4.10's pdf_viewer.css. */
.pdfv-slot { position: relative; width: 100%; background: #fff; border-radius: 3px; box-shadow: var(--paper-shadow); flex: 0 0 auto; }
.viewer-scroll .pdfv-slot { margin: 0 auto; }
.pdfv-wait { position: absolute; inset: 0; display: flex; align-items: flex-start; justify-content: center; padding-top: 40px; color: #71717a; font-size: var(--text-xs); }
.pdfv-page { position: relative; }
.pdfv-page canvas { display: block; width: 100%; height: 100%; }
.textLayer { position: absolute; text-align: initial; inset: 0; overflow: clip; opacity: 1; line-height: 1; text-size-adjust: none; -webkit-text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; caret-color: CanvasText; z-index: 0; }
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer > :not(.markedContent), .textLayer .markedContent span:not(.markedContent) { z-index: 1; }
.textLayer span.markedContent { top: 0; height: 0; }
.textLayer ::selection { background: rgb(0 0 255 / 0.25); }
.textLayer br::selection { background: transparent; }
.textLayer mark { color: transparent; border-radius: 2px; padding: 1px 0; margin: -1px 0; }
.textLayer mark.pdfq { background: rgb(250 204 21 / 0.35); box-shadow: 0 0 0 2px rgb(234 88 12 / 0.9); }
.textLayer mark.pdfs { background: rgb(56 189 248 / 0.35); }

/* Ajustes (the administrator's settings): sections on the left; Modelos de IA = uses, then providers as opencodex shows them */
.settings-main { min-width: 0; max-width: 1100px; }
.settings-card { margin-bottom: 16px; }
.settings-uses { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.settings-uses th, .settings-uses td { text-align: left; vertical-align: top; padding: 8px 10px 8px 0; border-top: 1px solid var(--line); }
.settings-uses tr:first-child th, .settings-uses tr:first-child td { border-top: none; }
.settings-uses th { width: 42%; font-weight: 600; color: var(--ink); }
.settings-uses-how { white-space: nowrap; color: var(--muted); font-size: var(--text-xs); text-align: right !important; }
.prov-overview { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 14px; }
.prov-count { padding: 10px 14px; font-size: var(--text-sm); color: var(--secondary); display: flex; flex-direction: column; gap: 2px; }
.prov-count + .prov-count { border-left: 1px solid var(--line); }
.prov-count strong { font-size: 1.4rem; color: var(--ink); }
.prov-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 14px; align-items: start; }
.prov-list { padding: 8px; }
.prov-group { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--muted); padding: 8px 8px 4px; }
.prov-item { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 8px; border: none; background: transparent; border-radius: var(--radius); text-align: left; color: var(--ink); }
.prov-item:hover { background: var(--subtle); }
.prov-item.is-active { background: var(--subtle); box-shadow: inset 2px 0 0 var(--accent, #0f766e); }
.prov-name { font-weight: 600; }
.prov-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--muted); }
.prov-dot.is-ok { background: #16a34a; }
.prov-dot.is-warn { background: #d97706; }
.prov-dot.is-bad { background: #dc2626; }
.prov-detail-head { display: flex; align-items: center; gap: 10px; }
.prov-detail-head h2 { margin: 0; font-size: 1.1rem; }
.prov-state { font-size: var(--text-xs); color: var(--secondary); display: inline-flex; align-items: center; gap: 5px; }
.setting-help { font-size: var(--text-sm); color: var(--secondary); margin: 6px 0 8px; }
.setting-meta { font-size: var(--text-xs); color: var(--muted); margin: 4px 0 8px; }
.setting-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; flex-wrap: wrap; }
.setting-row > label:first-child { width: 80px; font-size: var(--text-sm); font-weight: 600; color: var(--secondary); }
.setting-row select.input, .setting-row input.input { flex: 1 1 300px; min-width: 0; height: 32px; }
.setting-inline { display: flex; gap: 6px; align-items: center; white-space: nowrap; font-size: var(--text-sm); }
.setting-warn { font-size: var(--text-sm); color: var(--warn); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 6px 10px; }
.setting-actions { display: flex; gap: 8px; margin-top: 14px; }
@media (max-width: 900px) {
  .prov-layout { grid-template-columns: 1fr; }
}
.settings-uses th .setting-help { font-weight: 400; margin: 2px 0 0; }
.prov-detail .btn-primary:disabled { opacity: 0.4; cursor: default; }
.prov-overview { grid-template-columns: repeat(3, auto) 1fr; border: none; background: transparent; margin: 0 0 8px; }
.prov-count { flex-direction: row; align-items: center; gap: 6px; padding: 2px 16px 2px 0; }
.prov-count + .prov-count { border-left: none; }
.prov-count strong { font-size: var(--text-sm); }

/* The chat on a tender's pliegos (its own tab), as ChatGPT or claude.ai: the box in the middle until the first question,
   then the conversation grows upwards over the box at the foot; questions in bubbles on the right, answers full width. */
.chat-page { height: calc(100vh - 230px); min-height: 480px; display: flex; }
.qa-box { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.qa-empty { margin: auto; width: 100%; max-width: 760px; padding: 0 8px 8vh; text-align: center; }
.qa-hello { font-family: "Source Serif 4", Georgia, serif; font-weight: 500; font-size: 1.7rem; margin: 0 0 22px; color: var(--ink); }

.qa-empty .qa-composer, .qa-empty .qa-under { text-align: left; }
.qa-thread { flex: 1 1 auto; overflow-y: auto; min-height: 0; padding: 8px 8px 16px; display: flex; flex-direction: column; gap: 18px; }
.qa-thread > .qa-msg { width: 100%; max-width: 760px; margin: 0 auto; }
.qa-msg { font-size: 1rem; line-height: 1.6; color: var(--ink); }
.qa-msg.user { width: auto !important; max-width: min(560px, 85%) !important; margin: 0 max(0px, calc((100% - 760px) / 2)) 0 auto !important;
  background: var(--subtle); border: 1px solid var(--line); border-radius: 18px; padding: 10px 16px; white-space: pre-wrap; }
.qa-msg.assistant { padding: 0 2px; }
.qa-msg.is-pending > div:first-child { color: var(--muted); animation: qa-pulse 1.4s ease-in-out infinite; }
@keyframes qa-pulse { 50% { opacity: 0.45; } }
.qa-cites { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.qa-model { margin-top: 6px; font-size: var(--text-xs); color: var(--muted); }
.qa-foot { width: 100%; max-width: 760px; margin: 0 auto; padding: 6px 8px 4px; }
.qa-composer { position: relative; display: flex; align-items: flex-end; gap: 8px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 12px 12px 12px 18px; box-shadow: 0 1px 6px rgb(0 0 0 / 0.06); }
.qa-composer:focus-within { border-color: var(--muted); }
.qa-empty .qa-composer { min-height: 104px; align-items: flex-end; }
.qa-composer textarea { flex: 1; border: none; outline: none; resize: none; background: transparent; color: var(--ink);
  font: inherit; font-size: 1rem; line-height: 1.5; max-height: 200px; padding: 2px 0; align-self: stretch; }
.qa-send { flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--btn-bg); color: var(--btn-ink);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.qa-send:hover { opacity: 0.85; }
.qa-under { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 6px 0; font-size: var(--text-xs); color: var(--muted); }
.qa-down { position: absolute; left: 50%; transform: translateX(-50%); bottom: 118px; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: 0 2px 8px rgb(0 0 0 / 0.15); cursor: pointer; }
.qa-pick-wrap { position: relative; }
.qa-pick { border: none; background: transparent; color: var(--secondary); font-size: var(--text-xs); font-weight: 600; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.qa-pick:hover { background: var(--subtle); color: var(--ink); }
.qa-pick-def { font-weight: 400; color: var(--muted); }
.qa-pick-menu { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 20; width: min(380px, 80vw); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.18); padding: 12px; display: flex; flex-direction: column; gap: 8px; color: var(--ink); }
.qa-pick-menu label { display: flex; flex-direction: column; gap: 3px; font-size: var(--text-xs); font-weight: 600; color: var(--secondary); }
.qa-pick-menu select { height: 30px; font-size: var(--text-sm); }
.qa-pick-note { margin: 0; font-size: var(--text-xs); color: var(--muted); }
.doc-link { color: inherit; text-decoration: none; } .doc-link:hover { text-decoration: underline; }
/* the chat's box and question bubbles in claude.ai's colours (owner, 29 Nov 2026) */
:root { --chat-box-bg: #ffffff; --chat-box-line: #e5e3da; --chat-box-ink: #141413; --chat-box-hint: #8c8a82; }
:root[data-theme="dark"] { --chat-box-bg: #30302e; --chat-box-line: #42413d; --chat-box-ink: #f5f4ef; --chat-box-hint: #8f8e88; }
.qa-composer { background: var(--chat-box-bg); border-color: var(--chat-box-line); box-shadow: 0 1px 8px rgb(0 0 0 / 0.08); }
.qa-composer:focus-within { border-color: var(--chat-box-line); box-shadow: 0 1px 10px rgb(0 0 0 / 0.14); }
.qa-composer textarea { color: var(--chat-box-ink); }
.qa-composer textarea::placeholder { color: var(--chat-box-hint); }
.qa-msg.user { background: var(--chat-box-bg); border-color: var(--chat-box-line); color: var(--chat-box-ink); }
.badge-link { text-decoration: none; color: var(--accent, inherit); cursor: pointer; } .badge-link:hover { text-decoration: underline; }

/* Documentos: the tender's documents listed on the left, the open one beside them (owner, 29 Nov 2026) */
.doc-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.doc-item { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 8px 10px; border: none; border-radius: 6px; background: transparent; color: var(--ink); cursor: pointer; }
.doc-item:hover { background: var(--subtle); }
.doc-item.is-active { background: var(--subtle); box-shadow: inset 2px 0 0 var(--accent); }
.doc-item-name { font-size: var(--text-sm); font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.doc-item-meta { font-size: var(--text-xs); color: var(--muted); }
@media (max-width: 1120px) { .doc-view { grid-template-columns: 1fr; } .doc-list { flex-direction: row; overflow-x: auto; } .doc-item { min-width: 180px; } }
.ppt-points { margin: 4px 0 8px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; line-height: 1.5; }
.ob-deadline.is-past { color: var(--muted); }
.btn-danger-on { color: var(--danger); border-color: var(--danger-line); background: var(--danger-bg); }
/* the chat's «@» mentions: the menu over the box, the mention in a question, web citations */
.qa-mentions { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 15; background: var(--chat-box-bg); border: 1px solid var(--chat-box-line);
  border-radius: 14px; padding: 6px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.18); }
.qa-mention-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: none; border-radius: 9px; background: transparent;
  color: var(--chat-box-ink); text-align: left; cursor: pointer; font-size: var(--text-sm); }
.qa-mention-item span:last-child { color: var(--chat-box-hint); }
.qa-mention-item.is-on, .qa-mention-item:hover { background: var(--subtle); }
.qa-mention-icon { width: 20px; text-align: center; }
.qa-mention { color: var(--accent); font-weight: 600; }
.web-cite { text-decoration: none; }
/* an answer's sources, one line per origin: Pliegos, Web, Histórico */
.qa-sources { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.qa-source { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.qa-source-label { font-size: var(--text-xs); font-weight: 700; color: var(--muted); min-width: 96px; display: inline-flex; gap: 6px; align-items: center; }
/* the price formula as the pliego writes it, and its variables */
.formula-box { margin-bottom: 10px; }
code.formula { display: inline-block; font-size: 1.05rem; padding: 6px 12px; border-radius: 8px; background: var(--subtle); border: 1px solid var(--line); color: var(--ink); }
.formula-vars { margin-top: 10px; border-collapse: collapse; }
.formula-vars th { text-align: left; padding: 4px 14px 4px 0; vertical-align: top; white-space: nowrap; }
.formula-vars td { padding: 4px 0; }
.formula-crop { margin: 10px 0 4px; }
.formula-crop img { max-width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; }
.formula-crop figcaption { font-size: var(--text-xs); color: var(--muted); margin-top: 4px; }
/* lots: almost separate contracts (owner, 29 Nov 2026) — under their tender's card in the inbox, and on a lot's page */
.lot-toggle { cursor: pointer; border: 1px solid var(--line); }
.lot-toggle:hover { background: var(--subtle); }
.lot-rows { margin: -6px 0 12px 48px; border: 1px solid var(--line); border-top: none; border-radius: 0 0 var(--radius) var(--radius); background: var(--surface); }
.lot-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.lot-row:hover { background: var(--subtle); }
.lot-row-n { font-size: var(--text-xs); font-weight: 700; color: var(--accent); }
.lot-row-title { font-weight: 600; color: var(--ink); }
.lot-row.is-seen .lot-row-title { color: var(--secondary); font-weight: 500; }
.lot-row-money { font-variant-numeric: tabular-nums; }
.lot-rows-foot { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; border-top: 1px solid var(--line); font-size: var(--text-xs); color: var(--muted); }
.lot-title { margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lot-title-money { color: var(--secondary); font-variant-numeric: tabular-nums; }
.req-group { margin-bottom: 8px; }
.req-label { font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.02em; color: var(--muted); text-transform: uppercase; margin-top: 6px; }

/* a tender's detail: its notes and secondary lines one size up and in the secondary ink, not the faint muted grey
   (owner, 29 Nov 2026: «Esta ficha no asigna criterios…» was hard to read) */
.lot-bar { font-size: var(--text-sm); }
.lot-bar span { color: var(--secondary); }
.lot-bar select { font-size: var(--text-sm); height: 30px; }
.fs-dash { font-size: var(--text-sm); color: var(--secondary); }
.fs-sub { font-size: var(--text-sm); }
.fs-missing { font-size: 0.95rem; }
.qa-model, .qa-under { font-size: var(--text-sm); }
.req-label { font-size: var(--text-sm); }
.lot-rows-foot { font-size: var(--text-sm); }
/* a required profile in full */
.prof { padding: 12px 0; border-top: 1px solid var(--line); }
.prof:first-child { border-top: none; padding-top: 2px; }
.prof-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 4px; font-size: 1.02rem; }
.prof-part { margin: 6px 0 0 2px; }
.prof-part .ppt-points { margin-top: 2px; }
.src-scroll .src-pg { margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
/* PPT tab: every requirement word for word */
.ppt-bar { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; }
.ppt-bar input { flex: 0 1 360px; height: 32px; }
.ppt-reqs { margin: 0; padding-left: 2.2em; }
.ppt-reqs li { margin: 0 0 8px; line-height: 1.5; }
.ppt-bar input { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; font: inherit; }
/* «Rehacer» (admin): one panel to make the models' readings again with another model */
.redo-back { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 16px; }
.redo-panel { width: min(640px, 100%); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.redo-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 1.05rem; }
.redo-parts { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.redo-parts td { padding: 7px 6px; border-top: 1px solid var(--line); vertical-align: middle; }
.redo-parts tr:first-child td { border-top: none; }
.redo-parts td:first-child { width: 24px; }
.redo-parts td:last-child { text-align: right; white-space: nowrap; }
.redo-pick { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.redo-pick label { display: flex; flex-direction: column; gap: 4px; font-size: var(--text-sm); color: var(--secondary); flex: 1 1 160px; }
.redo-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.redo-err { color: #e5484d; font-size: var(--text-sm); margin-bottom: 8px; }
/* .16 sub-criteria under their criterion */
.crit-parent > .crit-row { border-bottom: none; }
.crit-kids { margin-left: 18px; border-left: 2px solid var(--line); padding-left: 12px; }
.crit-kids .crit-row .crit-name strong { font-weight: 600; }
/* .18 judgement scale under a criterion */
.crit-scale { margin-top: 6px; font-size: var(--text-sm); }
.crit-scale summary { cursor: pointer; color: var(--accent, var(--secondary)); }
.crit-scale table { margin-top: 6px; border-collapse: collapse; width: 100%; }
.crit-scale th { text-align: left; white-space: nowrap; vertical-align: top; padding: 4px 10px 4px 0; color: var(--secondary); font-weight: 600; }
.crit-scale td { padding: 4px 0; border-top: 1px solid var(--line); }
/* Ajustes › Ingesta: a dot per day per platform */
.hrow { display: grid; grid-template-columns: 190px 1fr 190px; align-items: center; gap: 14px; padding: 7px 0; border-top: 1px solid var(--line); }
.hrow.hhead { border-top: none; padding: 0 0 2px; }
.hname { font-weight: 600; }
.hdots { display: flex; gap: 3px; }
.hdot { flex: 1 1 0; max-width: 14px; height: 22px; border-radius: 3px; background: var(--line); }
.hdot.ok { background: #2fb37b; }
.hdot.partial { background: #e2a336; }
.hdot.failed { background: #e5484d; }
.hdots-legend { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--secondary); max-width: calc(30 * 17px); }
.hlast { font-size: var(--text-sm); color: var(--secondary); text-align: right; }
.is-bad { color: #e5484d; }
@media (max-width: 720px) { .hrow { grid-template-columns: 1fr; gap: 4px; } .hlast { text-align: left; } }
