/* ═══════════════════════════════════════════════════════════════════════
 * STICKY "Back to Governance view" button
 * Floating FAB injected by src/agency-back-btn.js. Visible only when
 * body.agency-mode is set AND the user is on a sub-agency view (not on
 * #cat-agency-landing). Mirrors the red pill pattern used by the WUA
 * Remix "← Back to Act view" FAB.
 * ═══════════════════════════════════════════════════════════════════ */
.agency-back-to-gov {
  position: fixed;
  bottom: 18px;
  left: 18px;
  z-index: var(--guide-z-sticky, 350);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 10px 14px;
  /* Picks up the active umbrella tier (state cobalt / county copper /
     city teal) via :root[data-gov-tier]; defaults to legacy gov green. */
  background: var(--guide-color-action);
  color: var(--guide-color-text-on-accent, #fff);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font-family: inherit;
  font-size: var(--guide-fs-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: var(--guide-shadow-raised);
  transition: transform var(--guide-dur-fast) ease, box-shadow var(--guide-dur-fast) ease, background var(--guide-dur-fast) ease;
}
.agency-back-to-gov:hover {
  box-shadow: var(--guide-shadow-overlay);
}
.agency-back-to-gov:active { transform: translateY(0); }
.agency-back-to-gov svg,
.agency-back-to-gov [data-lucide] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.agency-back-to-gov[hidden] { display: none !important; }

/* ═══════════════════════════════════════════════════════════════════════
 * ENFORCEMENT-HUB intel section — spread full-width + drop eyebrow banner
 * The shared .hub-intel-card has max-width: 1280px which kept the
 * "Enforcement Intelligence" cards in a centered column. Users wanted
 * the cards to use the same full width as the page's other sections and
 * the prominent "ENFORCEMENT INTELLIGENCE" label-banner removed.
 *
 * AI-trigger functionality is preserved via cmd-K, the hero-bar coach
 * button, and the AI tab — only the visual banner is hidden here.
 * ═══════════════════════════════════════════════════════════════════ */
.ef-intel-card {
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}
.ef-intel-card .hub-intel-section-title {
  display: none !important;
}
.ef-intel-card .hub-intel-alerts {
  /* Now that the eyebrow is gone, give the alerts a bit of top air so
     they're not crammed against the card's padding. */
  margin-top: 0 !important;
}

/* ═══════════════════════════════════════════════════════════════════════
 * WUA Remix tool-dialog polish layer
 *
 * Shared visual styling for the 21 launchpad tool modules so opened
 * dialogs feel coherent with the rest of the app (cream surface, slate
 * text, tabular numerics, accent-color rules).
 *
 * - .frh-*  Federal reserved rights hub (FW 16)
 * - .tch-*  Tribal compacts hub (FW 16)
 * - .wuar-tool-chapter-link  Shared "→ Read the full FW-NN chapter" footer
 * ═══════════════════════════════════════════════════════════════════ */

/* ─── Shared "Read full FW-NN chapter" footer ────────────────────────── */
.wuar-tool-chapter-link {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0 4px;
  padding: 14px 18px;
  background: var(--guide-color-raised);
  border: 1px solid var(--guide-color-line);
  border-radius: 10px;
  color: var(--guide-color-ink);
  text-decoration: none;
  transition: transform var(--guide-dur-fast) ease, box-shadow var(--guide-dur-fast) ease, background var(--guide-dur-fast) ease, border-color var(--guide-dur-fast) ease;
  font-family: inherit;
}
.wuar-tool-chapter-link:hover {
  box-shadow: var(--guide-shadow-raised);
  background: var(--guide-color-raised);
  border-color: color-mix(in srgb, var(--guide-color-action) 36%, transparent);
}
.wuar-tool-chapter-link-icon {
  font-size: var(--guide-fs-2xl);
  line-height: 1;
  flex-shrink: 0;
}
.wuar-tool-chapter-link-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.wuar-tool-chapter-link-eyebrow {
  font-size: var(--guide-fs-2xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: var(--guide-label-case, uppercase);
  color: var(--text-tertiary, #6b6b73);
}
.wuar-tool-chapter-link-label {
  font-size: var(--guide-fs-md);
  font-weight: 700;
  color: var(--text-primary, #1a1a1f);
  letter-spacing: -0.005em;
}
.wuar-tool-chapter-link-arrow {
  font-size: var(--guide-fs-xl);
  font-weight: 700;
  color: var(--guide-color-action);
  flex-shrink: 0;
  transition: transform var(--guide-dur-fast) ease;
}
.wuar-tool-chapter-link:hover .wuar-tool-chapter-link-arrow {
  transform: translateX(3px);
}

/* ─── Federal Reserved Rights Hub (FW 16) ─────────────────────────────── */
.frh { display: flex; flex-direction: column; gap: 16px; font-size: var(--guide-fs-md); color: var(--text-primary, #1a1a1f); }
.frh-summary {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 24px;
  align-items: center;
  padding: 16px 18px;
  background: var(--guide-color-paper-2);
  border-radius: 10px;
}
.frh-summary-stat { display: flex; flex-direction: column; line-height: 1.1; }
.frh-summary-num {
  font-family: var(--guide-font-mono);
  font-size: var(--guide-fs-2xl);
  font-weight: 800;
  color: var(--text-primary, #1a1a1f);
  font-variant-numeric: tabular-nums;
}
.frh-summary-label {
  font-size: var(--guide-fs-2xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: var(--guide-label-case, uppercase);
  color: var(--text-tertiary, #6b6b73);
  margin-top: 2px;
}
.frh-summary-doctrine {
  display: flex;
  flex-direction: column;
  font-size: var(--guide-fs-xs);
  color: var(--text-secondary, #4a4a52);
}
.frh-summary-eyebrow {
  font-size: var(--guide-fs-2xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: var(--guide-label-case, uppercase);
  color: var(--text-tertiary, #6b6b73);
  margin-bottom: 2px;
}
.frh-type-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.frh-type-chip {
  padding: 4px 10px;
  background: var(--bg-3, #f7f5f0);
  border: 1px solid var(--border-default, var(--guide-color-border-default, rgba(0, 0, 0, 0.10)));
  border-radius: 999px;
  font-size: var(--guide-fs-xs);
  color: var(--text-secondary, #4a4a52);
}
.frh-type-chip strong { color: var(--text-primary, #1a1a1f); font-weight: 700; }
.frh-table-wrap {
  border: 1px solid var(--border-default, var(--guide-color-border-default, rgba(0, 0, 0, 0.10)));
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-2, #fff);
}
.frh-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--guide-fs-sm);
}
.frh-table thead th {
  background: var(--bg-3, #f0ebd9);
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  font-size: var(--guide-fs-2xs);
  letter-spacing: 0.06em;
  text-transform: var(--guide-label-case, uppercase);
  color: var(--text-secondary, #4a4a52);
  border-bottom: 2px solid var(--mt-slate, #3b5a7a);
  white-space: nowrap;
}
.frh-table tbody td {
  padding: 8px 12px;
  border-top: 1px solid var(--border-subtle, var(--guide-color-border-subtle, rgba(0, 0, 0, 0.06)));
  vertical-align: top;
}
.frh-table tbody tr:hover { background: var(--bg-3, #f7f5f0); }
.frh-table tbody tr td:first-child { font-weight: 600; color: var(--text-primary, #1a1a1f); }
.frh-table .frh-num,
.frh-table tbody td:nth-child(5) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--guide-font-mono);
}
.frh-status {
  font-size: var(--guide-fs-xs);
  font-weight: 600;
}
.frh-footer {
  margin: 0;
  padding: 8px 12px;
  background: var(--bg-3, #f7f5f0);
  border-radius: 6px;
  color: var(--text-tertiary, #6b6b73);
  line-height: 1.5;
}

/* ─── Tribal Compacts Hub (FW 16) ─────────────────────────────────────── */
.tch { display: flex; flex-direction: column; gap: 16px; font-size: var(--guide-fs-md); color: var(--text-primary, #1a1a1f); }
.tch-summary {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 24px;
  align-items: center;
  padding: 16px 18px;
  background: var(--guide-color-paper-2);
  border-radius: 10px;
  position: relative;
}
.tch-summary-stat { display: flex; flex-direction: column; line-height: 1.1; }
.tch-summary-num {
  font-family: var(--guide-font-mono);
  font-size: var(--guide-fs-2xl);
  font-weight: 800;
  color: var(--text-primary, #1a1a1f);
  font-variant-numeric: tabular-nums;
}
.tch-summary-label {
  font-size: var(--guide-fs-2xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: var(--guide-label-case, uppercase);
  color: var(--text-tertiary, #6b6b73);
  margin-top: 2px;
}
.tch-summary-breakdown { display: flex; flex-wrap: wrap; gap: 8px; }
.tch-breakdown-chip {
  padding: 4px 10px;
  background: var(--bg-2, #fff);
  border: 1px solid var(--border-default, var(--guide-color-border-default, rgba(0, 0, 0, 0.10)));
  border-radius: 999px;
  font-size: var(--guide-fs-xs);
  color: var(--text-secondary, #4a4a52);
}
.tch-breakdown-chip strong { color: var(--text-primary, #1a1a1f); font-weight: 700; }
.tch-role-pill {
  position: absolute;
  top: 16px;
  right: 18px;
  padding: 4px 10px;
  background: var(--mt-teal, #0f766e);
  color: var(--guide-color-text-on-accent, #fff);
  border-radius: 999px;
  font-size: var(--guide-fs-2xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: var(--guide-label-case, uppercase);
}
.tch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.tch-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  background: var(--bg-2, #fff);
  border: 1px solid var(--border-default, var(--guide-color-border-default, rgba(0, 0, 0, 0.10)));
  border-radius: 10px;
  box-shadow: var(--guide-shadow-rest);
}
.tch-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.tch-card-head h4 {
  margin: 0;
  font-size: var(--guide-fs-md);
  font-weight: 700;
  color: var(--text-primary, #1a1a1f);
}
.tch-mca {
  font-family: var(--guide-font-mono);
  font-size: var(--guide-fs-2xs);
  font-weight: 600;
  padding: 2px 6px;
  background: var(--bg-3, #f1ecdd);
  border: 1px solid var(--border-default, #e0d8c0);
  border-radius: 4px;
  color: #4a3f24;
  white-space: nowrap;
}
.tch-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: var(--guide-fs-2xs);
  color: var(--text-tertiary, #6b6b73);
}
.tch-allocs {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--guide-fs-xs);
}
.tch-allocs tr td { padding: 4px 0; border-top: 1px solid var(--border-subtle, var(--guide-color-border-subtle, rgba(0, 0, 0, 0.06))); }
.tch-allocs tr:first-child td { border-top: 0; }
.tch-allocs td:first-child { color: var(--text-secondary, #4a4a52); }
.tch-allocs td:last-child {
  text-align: right;
  font-family: var(--guide-font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-primary, #1a1a1f);
}
.tch-total td {
  padding-top: 6px !important;
  border-top: 2px solid var(--text-primary, #1a1a1f) !important;
  font-weight: 700;
}
.tch-instream {
  font-size: var(--guide-fs-xs);
  color: var(--text-secondary, #4a4a52);
}
.tch-instream summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--mt-teal, #0f766e);
  padding: 4px 0;
}
.tch-instream summary:hover { color: var(--mt-teal-deep, #115e59); }
.tch-instream ul { margin: 4px 0 0; padding-left: 16px; }
.tch-instream li { font-size: var(--guide-fs-xs); line-height: 1.5; }
.tch-notes {
  margin: 4px 0 0;
  font-size: var(--guide-fs-xs);
  color: var(--text-tertiary, #6b6b73);
  line-height: 1.5;
  font-style: italic;
}
.tch-footer {
  margin: 0;
  padding: 8px 12px;
  background: var(--bg-3, #f7f5f0);
  border-radius: 6px;
  color: var(--text-tertiary, #6b6b73);
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════
   DARK THEME OVERRIDES
   ═══════════════════════════════════════════════════════════════════ */
[data-theme="dark"] .wuar-tool-chapter-link {
  background: var(--guide-color-raised);
  border-color: color-mix(in srgb, var(--guide-color-action) 28%, transparent);
  color: var(--guide-color-ink);
}
[data-theme="dark"] .wuar-tool-chapter-link:hover {
  background: var(--guide-color-raised);
  border-color: color-mix(in srgb, var(--guide-color-action) 45%, transparent);
}
[data-theme="dark"] .wuar-tool-chapter-link-eyebrow { color: #6B6B73; }
[data-theme="dark"] .wuar-tool-chapter-link-label { color: var(--guide-color-ink); }
[data-theme="dark"] .frh { color: var(--guide-color-ink); }
[data-theme="dark"] .frh-summary {
  background: var(--guide-color-paper-2);
}
[data-theme="dark"] .frh-summary-num { color: var(--guide-color-ink); }
[data-theme="dark"] .frh-summary-label { color: #a0a0b0; }
[data-theme="dark"] .frh-summary-doctrine { color: #a0a0b0; }
[data-theme="dark"] .frh-summary-eyebrow { color: #6B6B73; }
[data-theme="dark"] .frh-type-chip {
  background: #2a2a38;
  border-color: rgba(255, 255, 255, 0.10);
  color: #a0a0b0;
}
[data-theme="dark"] .frh-type-chip strong { color: var(--guide-color-ink); }
[data-theme="dark"] .frh-table-wrap {
  background: #1e1e28;
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .frh-table thead th {
  background: #2a2a38;
  color: #a0a0b0;
  border-bottom-color: rgba(59, 90, 122, 0.4);
}
[data-theme="dark"] .frh-table tbody td { border-top-color: rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .frh-table tbody tr:hover { background: rgba(255, 255, 255, 0.04); }
[data-theme="dark"] .frh-table tbody tr td:first-child { color: var(--guide-color-ink); }
[data-theme="dark"] .frh-footer { background: #23232e; color: #6B6B73; }
[data-theme="dark"] .tch { color: var(--guide-color-ink); }
[data-theme="dark"] .tch-summary {
  background: var(--guide-color-paper-2);
}
[data-theme="dark"] .tch-summary-num { color: var(--guide-color-ink); }
[data-theme="dark"] .tch-summary-label { color: #a0a0b0; }
[data-theme="dark"] .tch-breakdown-chip {
  background: #2a2a38;
  border-color: rgba(255, 255, 255, 0.10);
  color: #a0a0b0;
}
[data-theme="dark"] .tch-breakdown-chip strong { color: var(--guide-color-ink); }
[data-theme="dark"] .tch-card {
  background: #23232e;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}
[data-theme="dark"] .tch-card-head h4 { color: var(--guide-color-ink); }
[data-theme="dark"] .tch-mca {
  background: #2a2a38;
  border-color: rgba(255, 255, 255, 0.12);
  color: #a0a0b0;
}
[data-theme="dark"] .tch-card-meta { color: #6B6B73; }
[data-theme="dark"] .tch-allocs td:first-child { color: #a0a0b0; }
[data-theme="dark"] .tch-allocs td:last-child { color: var(--guide-color-ink); }
[data-theme="dark"] .tch-allocs tr td { border-top-color: rgba(255, 255, 255, 0.06); }
[data-theme="dark"] .tch-total td { border-top-color: rgba(255, 255, 255, 0.3) !important; }
[data-theme="dark"] .tch-instream { color: #a0a0b0; }
[data-theme="dark"] .tch-notes { color: #6B6B73; }
[data-theme="dark"] .tch-footer { background: #23232e; color: #6B6B73; }
