/* =========================
   Signalytics Design Tokens
   Brand: green #00bf63, black, white
   ========================= */

:root {
  /* Brand */
  --brand-500: #00bf63;
  --brand-600: #00a854;
  --brand-700: #008a45;

  /* Neutrals (light theme) */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f7f8;
  --text: #0b0b0c;          /* near-black */
  --muted: #5b5f66;
  --border: #e6e7ea;
  --border-2: #d6d9de;

  /* Status */
  --success: var(--brand-500);
  --danger: #e5484d;
  --warning: #f59e0b;
  --info: #3b82f6;

  /* Typography */
  --font-sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  --fs-12: 12px;
  --fs-14: 14px;
  --fs-16: 16px;
  --fs-20: 20px;
  --fs-24: 24px;
  --lh-tight: 1.25;
  --lh-normal: 1.5;

  /* Spacing scale */
  --s-2: 2px;
  --s-4: 4px;
  --s-6: 6px;
  --s-8: 8px;
  --s-10: 10px;
  --s-12: 12px;
  --s-16: 16px;
  --s-20: 20px;
  --s-24: 24px;
  --s-32: 32px;
  --s-40: 40px;
  --s-48: 48px;

  /* Radius */
  --r-8: 8px;
  --r-12: 12px;
  --r-16: 16px;

  /* Shadows (subtle, modern) */
  --shadow-1: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-2: 0 8px 20px rgba(0,0,0,0.10);

  /* Focus ring */
  --focus: 0 0 0 3px rgba(0, 191, 99, 0.25);

  /* Container */
  --maxw: 1160px;

  /* Motion */
  --t-fast: 120ms;
  --t: 180ms;
  --ease: cubic-bezier(.2,.8,.2,1);
}

/* Optional dark theme */
:root[data-theme="dark"] {
  --bg: #0b0b0c;
  --surface: #121214;
  --surface-2: #17171a;
  --text: #f2f3f5;
  --muted: #a8acb3;
  --border: #24262b;
  --border-2: #2f3239;
  --shadow-1: 0 1px 2px rgba(0,0,0,0.45);
  --shadow-2: 0 12px 26px rgba(0,0,0,0.60);
  --focus: 0 0 0 3px rgba(0, 191, 99, 0.30);
}

/* =========================
   Base
   ========================= */

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  padding: 40px 100px 80px;
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--s-24);
}

.h1 { font-size: 28px; line-height: var(--lh-tight); margin: 0 0 var(--s-24); letter-spacing: -0.02em; text-align: center; }
.h2 { font-size: var(--fs-24); line-height: var(--lh-tight); margin: 0 0 var(--s-12); letter-spacing: -0.01em; }
.h3 { font-size: var(--fs-20); line-height: var(--lh-tight); margin: 0 0 var(--s-10); }
.p  { margin: 0 0 var(--s-12); color: var(--muted); }

.page-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--s-12);
  margin-bottom: var(--s-16);
}

/* =========================
   Shared App Navbar
   ========================= */
.app-navbar {
  display: flex;
  align-items: center;
  gap: var(--s-24);
  padding: var(--s-12) var(--s-24);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 40;
}
.app-navbar__brand {
  font-weight: 700;
  font-size: var(--fs-16);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.app-navbar__brand:hover { text-decoration: none; color: var(--brand-500); }

.app-navbar__group {
  position: relative;
}
.app-navbar__label {
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  padding: 6px 10px;
  border-radius: var(--r-8);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  display: flex;
  align-items: center;
  gap: 5px;
}
.app-navbar__label::after {
  content: "";
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  opacity: 0.5;
}
.app-navbar__label:hover {
  background: var(--surface-2);
  color: var(--text);
}
.app-navbar__group.open .app-navbar__label {
  background: var(--surface-2);
  color: var(--text);
}
.app-navbar__group.open .app-navbar__label::after {
  transform: rotate(180deg);
}
.app-navbar__dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 180px;
  padding: var(--s-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-12);
  box-shadow: var(--shadow-2);
  z-index: 50;
  flex-direction: column;
  gap: 2px;
}
.app-navbar__group.open .app-navbar__dropdown {
  display: flex;
}
.app-navbar__spacer { flex: 1; }

.app-navbar__link {
  font-size: var(--fs-13, 13px);
  padding: 8px 12px;
  border-radius: var(--r-8);
  color: var(--text);
  text-decoration: none;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
  white-space: nowrap;
}
.app-navbar__link:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.app-navbar__link[aria-current="page"] {
  background: color-mix(in srgb, var(--brand-500) 10%, var(--surface));
  color: var(--brand-500);
  font-weight: 600;
}

.app-navbar__sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 var(--s-8);
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .app-navbar {
    flex-wrap: wrap;
    gap: var(--s-12);
    padding: var(--s-10) var(--s-16);
  }
}
}

.see-allowed-row {
  margin-bottom: 40px;
}

.rule-ids {
  margin: -4px 0 var(--s-12);
  color: var(--danger);
  font-style: italic;
  font-size: var(--fs-14);
}

.required-asterisk {
  color: var(--danger);
  font-weight: 700;
}

.required-msg {
  color: var(--danger);
  font-size: var(--fs-12);
  font-weight: 600;
  margin-left: var(--s-8);
  font-style: italic;
}

.page-spacer {
  height: 80px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
}

/* =========================
   Glossary hover terms
   ========================= */

.gloss-term {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: var(--s-4);
  font-style: italic;
  border-bottom: 1px dotted var(--border-2);
  cursor: help;
}

.gloss-bubble {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  width: min(360px, 80vw);
  padding: var(--s-16) var(--s-20, 20px);
  border-radius: var(--r-12);
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-2);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
  z-index: 10;
}

.gloss-title {
  display: block;
  font-size: var(--fs-12);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: color-mix(in srgb, var(--bg) 70%, var(--text));
  margin-bottom: var(--s-6);
}

.gloss-def {
  display: block;
  font-size: var(--fs-14);
  line-height: var(--lh-normal);
}

.gloss-term:hover .gloss-bubble,
.gloss-term:focus-within .gloss-bubble {
  opacity: 1;
  transform: translateY(0);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--s-8);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.toggle__track {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border);
  position: relative;
  transition: background var(--t) var(--ease), box-shadow var(--t) var(--ease);
}

.toggle__track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: transform var(--t) var(--ease), background var(--t) var(--ease);
}

.toggle input:focus-visible + .toggle__track {
  box-shadow: var(--focus);
}

.toggle input:checked + .toggle__track {
  background: var(--brand-500);
}

.toggle input:checked + .toggle__track::after {
  transform: translateX(20px);
  background: #0b0b0c;
}

.toggle__label {
  font-size: var(--fs-12);
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--s-16) 0;
}

/* Layout helpers */
.row { display: flex; gap: var(--s-16); align-items: center; }
.stack { display: flex; flex-direction: column; gap: var(--s-12); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-16); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-16); }
.controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-16); }
@media (max-width: 900px) {
  .grid-2, .grid-3, .controls { grid-template-columns: 1fr; }
}

/* =========================
   Buttons
   ========================= */

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--r-12);
  padding: 10px 14px;
  font-size: var(--fs-14);
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-8);
  transition: transform var(--t-fast) var(--ease),
              background var(--t) var(--ease),
              border-color var(--t) var(--ease),
              color var(--t) var(--ease),
              box-shadow var(--t) var(--ease);
  user-select: none;
}

.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn--primary {
  background: var(--brand-500);
  color: #0b0b0c; /* black text on green for punchy contrast */
}
.btn--primary:hover { background: var(--brand-600); }

.btn--outline {
  background: transparent;
  border-color: var(--border-2);
  color: var(--text);
}
.btn--outline:hover { border-color: var(--brand-500); }

.btn--ghost {
  background: transparent;
  color: var(--text);
}
.btn--ghost:hover { background: var(--surface-2); }

.btn--danger {
  background: var(--danger);
  color: #ffffff;
}
.btn--danger:hover { filter: brightness(0.95); }

.btn--sm { padding: 8px 10px; border-radius: var(--r-8); font-size: var(--fs-12); }
.btn--lg { padding: 12px 16px; border-radius: var(--r-16); font-size: var(--fs-16); }

/* Icon button */
.iconbtn {
  width: 40px; height: 40px;
  border-radius: var(--r-12);
  border: 1px solid var(--border);
  background: var(--surface);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--t) var(--ease), border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.iconbtn:hover { background: var(--surface-2); border-color: var(--border-2); }
.iconbtn:focus-visible { outline: none; box-shadow: var(--focus); }
.iconbtn--sm { width: 32px; height: 32px; border-radius: var(--r-8); }
.iconbtn__icon { width: 16px; height: 16px; fill: currentColor; }

/* =========================
   Inputs / Forms
   ========================= */

.field { display: grid; gap: var(--s-6); }
.label { font-size: var(--fs-12); color: var(--muted); font-weight: 600; }
.hint { font-size: var(--fs-12); color: var(--muted); }

.input, .select, .textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--r-8);
  padding: 9px 12px;
  font-size: var(--fs-14);
  font-family: inherit;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), background var(--t) var(--ease);
}
.textarea { min-height: 110px; resize: vertical; }

/* ── Modern select ── */
.select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%235b5f66' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  text-overflow: ellipsis;
}
.select:hover {
  border-color: var(--border-2);
  background-color: var(--surface);
}
.select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Dark theme chevron */
:root[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23a8acb3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: var(--focus);
  background-color: var(--surface);
}

.input[aria-invalid="true"],
.select[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(229,72,77,0.18);
}

.input-group {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s-10);
  align-items: center;
}

/* =========================
   Map UI
   ========================= */

.map-card {
  max-width: var(--maxw);
  margin: 0 auto var(--s-24);
  padding: var(--s-16) var(--s-24);
  border: 1px solid var(--border);
  border-radius: var(--r-16);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  display: grid;
  gap: var(--s-16);
}

.map-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-16);
  align-items: end;
}

@media (max-width: 900px) {
  .map-controls { grid-template-columns: 1fr; }
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(280px, 1fr);
  gap: var(--s-16);
  align-items: start;
}

@media (max-width: 1024px) {
  .map-layout {
    grid-template-columns: 1fr;
  }
}

.map-shell {
  position: relative;
}

.map {
  width: 100%;
  height: 420px;
  border-radius: var(--r-16);
  overflow: hidden;
  border: 1px solid var(--border);
}

.map-side-panel {
  display: grid;
  gap: var(--s-16);
  padding: var(--s-12);
  border: 1px solid var(--border);
  border-radius: var(--r-12);
  background: var(--surface-2);
}

.status-pill-list {
  display: grid;
  gap: var(--s-8);
}

.status-pill {
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  font-size: var(--fs-12);
  font-weight: 600;
}

.status-pill--ok {
  background: color-mix(in srgb, var(--success) 16%, var(--surface));
  border-color: color-mix(in srgb, var(--success) 32%, var(--border));
  color: var(--brand-700);
}

.status-pill--alert {
  background: color-mix(in srgb, var(--danger) 16%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 32%, var(--border));
  color: var(--danger);
}

.status-pill--neutral {
  background: color-mix(in srgb, var(--info) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--info) 24%, var(--border));
  color: var(--text);
}

.law-clearance-banner {
  margin-top: var(--s-12);
  border-radius: var(--r-12);
  padding: var(--s-10) var(--s-12);
  border: 1px solid color-mix(in srgb, var(--warning) 40%, var(--border));
  background: color-mix(in srgb, var(--warning) 18%, var(--surface));
  color: color-mix(in srgb, var(--text) 85%, var(--warning));
  font-weight: 700;
  letter-spacing: 0.01em;
}

.district-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
  background: rgba(0, 191, 99, 0.12);
  color: var(--brand-700);
  border: 1px solid rgba(0, 191, 99, 0.2);
}

/* =========================
   Regulation entry page
   ========================= */

.reg-page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--s-24);
}

.reg-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-16);
  margin-bottom: var(--s-16);
}

.reg-form {
  display: grid;
  gap: var(--s-16);
}

.reg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-16);
}

@media (max-width: 900px) {
  .reg-grid { grid-template-columns: 1fr; }
}

.constraint-list {
  display: grid;
  gap: var(--s-12);
}

.constraint-row {
  border: 1px solid var(--border);
  border-radius: var(--r-16);
  padding: var(--s-16);
  display: grid;
  gap: var(--s-12);
  background: var(--surface);
}

.constraint-row__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s-12);
}

@media (max-width: 900px) {
  .constraint-row__grid { grid-template-columns: 1fr; }
}

.constraint-row__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-8);
}

.band-row {
  border: 1px dashed var(--border-2);
  border-radius: var(--r-12);
  padding: var(--s-12);
  display: grid;
  gap: var(--s-8);
  background: color-mix(in srgb, var(--surface) 70%, var(--surface-2));
}

.band-row__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--s-12);
}

@media (max-width: 900px) {
  .band-row__grid { grid-template-columns: 1fr; }
}

.reg-list {
  display: grid;
  gap: var(--s-12);
}

.reg-item {
  border: 1px solid var(--border);
  border-radius: var(--r-16);
  padding: var(--s-16);
  display: grid;
  gap: var(--s-8);
  background: var(--surface);
}

.reg-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-12);
  color: var(--muted);
  font-size: var(--fs-12);
}

.reg-item__actions {
  display: flex;
  gap: var(--s-10);
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-6);
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: var(--fs-12);
  font-weight: 600;
}

/* =========================
   Cards
   ========================= */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-16);
  box-shadow: var(--shadow-1);
}

.card__hd {
  padding: var(--s-16) var(--s-16) var(--s-12);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-12);
}

.card__title { margin: 0; font-size: var(--fs-16); font-weight: 700; }
.card__sub { margin: 0; font-size: var(--fs-12); color: var(--muted); }

.card__bd { padding: var(--s-16); }
.card__ft {
  padding: var(--s-12) var(--s-16);
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 70%, var(--surface-2));
  border-bottom-left-radius: var(--r-16);
  border-bottom-right-radius: var(--r-16);
}

/* =========================
   Badges (PASS/FAIL etc.)
   ========================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-6);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: var(--fs-12);
  font-weight: 700;
  border: 1px solid transparent;
  letter-spacing: 0.02em;
}

.badge--ok {
  background: rgba(0, 191, 99, 0.12);
  color: var(--brand-700);
  border-color: rgba(0, 191, 99, 0.20);
}

.badge--bad {
  background: rgba(229, 72, 77, 0.10);
  color: #b42328;
  border-color: rgba(229, 72, 77, 0.20);
}

.badge--warn {
  background: rgba(245, 158, 11, 0.12);
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.20);
}

/* =========================
   Alerts
   ========================= */

.alert {
  border-radius: var(--r-16);
  border: 1px solid var(--border);
  background: var(--surface-2);
  padding: var(--s-12) var(--s-16);
  display: flex;
  gap: var(--s-12);
  align-items: flex-start;
}

.alert--ok { border-color: rgba(0,191,99,0.25); background: rgba(0,191,99,0.06); }
.alert--bad { border-color: rgba(229,72,77,0.25); background: rgba(229,72,77,0.06); }
.alert--warn { border-color: rgba(245,158,11,0.25); background: rgba(245,158,11,0.06); }

.alert__title { font-weight: 800; margin: 0 0 var(--s-4); }
.alert__body { margin: 0; color: var(--muted); }

/* =========================
   Tables (clean + compliance-friendly)
   ========================= */

.tablewrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-16);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 720px; /* ensures columns don't crush */
  font-size: var(--fs-14);
}

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-size: var(--fs-12);
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 70%, var(--surface-2));
  border-bottom: 1px solid var(--border);
  padding: var(--s-12) var(--s-12);
  white-space: nowrap;
}

.table tbody td {
  border-bottom: 1px solid var(--border);
  padding: var(--s-12) var(--s-12);
  vertical-align: top;
}

.table tbody tr:hover td { background: var(--surface-2); }

.table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }

.cell--right { text-align: right; }
.cell--muted { color: var(--muted); }
.cell--tight { white-space: nowrap; }

.row--bad td { background: rgba(229,72,77,0.03); }
.row--ok td { background: rgba(0,191,99,0.03); }

.status-PASS { color: var(--brand-700); font-weight: 700; }
.status-FAIL { color: var(--danger); font-weight: 700; }
.status-NEEDS_MORE_INPUT { color: var(--warning); font-weight: 700; }

.verdict-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-12);
  padding: var(--s-12) var(--s-16);
  border: 1px solid var(--border);
  border-radius: var(--r-16);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  margin-bottom: var(--s-16);
}

.verdict-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-8);
}

.verdict-pill {
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.verdict-COMPLIES { background: rgba(0,191,99,0.15); color: var(--brand-700); border-color: rgba(0,191,99,0.35); }
.verdict-DEFICIENT { background: rgba(229,72,77,0.12); color: #b42328; border-color: rgba(229,72,77,0.3); }
.verdict-NEEDS_MORE_INPUT { background: rgba(245,158,11,0.12); color: #92400e; border-color: rgba(245,158,11,0.3); }

.top-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s-16);
  margin-bottom: var(--s-20);
}

.top-card {
  border: 1px solid var(--border);
  border-radius: var(--r-16);
  padding: var(--s-16);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  display: grid;
  gap: var(--s-8);
}

.top-card__head {
  display: flex;
  justify-content: space-between;
  gap: var(--s-8);
  align-items: baseline;
}

.top-card__title { font-weight: 800; }
.top-card__status { font-size: var(--fs-12); text-transform: uppercase; letter-spacing: 0.04em; }
.top-card__summary { color: var(--text); }
.top-card__verbatim { color: var(--muted); font-size: var(--fs-12); font-style: italic; margin-top: 4px; }
.top-card__fix { color: var(--muted); font-size: var(--fs-12); }
.top-card__refs { color: var(--muted); font-size: var(--fs-12); }

/* Verbatim by-law clause styling */
.cell--verbatim { color: var(--muted); font-size: var(--fs-12); max-width: 320px; }
.verbatim-text { color: var(--muted); font-size: var(--fs-12); margin-top: 2px; }

/* Conditions of Evaluation section */
.conditions-of-evaluation {
  background: color-mix(in srgb, var(--brand-500) 6%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--brand-500) 20%, var(--surface));
  border-radius: var(--r-8);
  padding: var(--s-4) var(--s-12) var(--s-12);
  margin-bottom: var(--s-16);
}
.conditions-of-evaluation p { margin: var(--s-4) 0 var(--s-8); font-size: var(--fs-14); }
.conditions-list { margin: 0; padding-left: var(--s-20); }
.conditions-list li {
  font-size: var(--fs-14);
  margin-bottom: var(--s-4);
  line-height: 1.5;
}
.conditions-list li em { font-style: italic; }

.constraints-summary {
  font-weight: 800;
  cursor: pointer;
  padding: var(--s-10) var(--s-12);
}

.rule-table thead th {
  background: color-mix(in srgb, var(--brand-500) 12%, var(--surface));
  color: var(--text);
}

.table-section td {
  background: color-mix(in srgb, var(--brand-500) 20%, var(--surface));
  color: var(--text);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: var(--fs-12);
}

/* Sort button inside header (optional) */
.thbtn {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--s-6);
}
.thbtn:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

/* =========================
   Tabs
   ========================= */

.tabs { display: flex; gap: var(--s-8); border-bottom: 1px solid var(--border); }
.tab {
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  padding: var(--s-10) var(--s-12);
  border-radius: var(--r-12) var(--r-12) 0 0;
  cursor: pointer;
  font-weight: 700;
  transition: color var(--t) var(--ease), background var(--t) var(--ease), border-color var(--t) var(--ease);
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--brand-500);
}

/* =========================
   Accordion (progressive disclosure)
   ========================= */

.acc {
  border: 1px solid var(--border);
  border-radius: var(--r-16);
  overflow: hidden;
  background: var(--surface);
}
.acc__item + .acc__item { border-top: 1px solid var(--border); }

.acc__btn {
  width: 100%;
  background: transparent;
  border: 0;
  text-align: left;
  padding: var(--s-14) var(--s-16);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-12);
  font-weight: 800;
}
.acc__btn:hover { background: var(--surface-2); }
.acc__btn:focus-visible { outline: none; box-shadow: var(--focus); }

.acc__panel {
  padding: 0 var(--s-16) var(--s-16);
  color: var(--muted);
}

/* =========================
   Tooltip (CSS-only via data-tip)
   ========================= */

.tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--s-6);
  border-bottom: 1px dashed var(--border-2);
  cursor: help;
}

.tip::after {
  content: attr(data-tip);
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  width: min(320px, 70vw);
  padding: var(--s-16) var(--s-20, 20px);
  border-radius: var(--r-12);
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-2);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
  font-size: var(--fs-12);
  line-height: var(--lh-normal);
}

.tip:hover::after,
.tip:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

/* =========================
   Modal (simple)
   ========================= */

.modalbackdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--s-24);
  z-index: 1000;
}
.modalbackdrop[data-open="true"] { display: flex; }

.modal {
  width: min(720px, 96vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-16);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.modal__hd, .modal__bd, .modal__ft { padding: var(--s-16); }
.modal__hd { border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: var(--s-12); }
.modal__ft { border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--s-10); }

/* =========================
   Mode Toggle / Tab Buttons
   ========================= */

.mode-toggle {
  display: flex;
  justify-content: center;
  gap: var(--s-12);
  margin-bottom: var(--s-24);
  flex-wrap: wrap;
}

.mode-toggle input[type="radio"] {
  display: none;
}

.mode-toggle label {
  margin: 0;
  padding: 10px 20px;
  border-radius: var(--r-12);
  background: var(--brand-500);
  color: #0b0b0c;
  font-weight: 600;
  font-size: var(--fs-14);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--t) var(--ease), filter var(--t) var(--ease);
  opacity: 0.75;
}

.mode-toggle input[type="radio"]:checked + label {
  background: var(--brand-700);
  opacity: 1;
  filter: brightness(0.85);
}

.mode-toggle input[type="radio"]:not(:checked) + label {
  opacity: 0.75;
}

/* =========================
   Small utilities
   ========================= */

.kpi {
  display: grid;
  gap: var(--s-6);
}
.kpi__label { color: var(--muted); font-size: var(--fs-12); font-weight: 700; }
.kpi__value { font-size: var(--fs-20); font-weight: 900; letter-spacing: -0.01em; }

.sep { height: 1px; background: var(--border); }
.muted { color: var(--muted); }
.right { margin-left: auto; }
