/* IC-FOODS E2C Prototype — design tokens + base styles
 *
 * Aligned with ic-foods-cms canonical theming:
 *   - Inter (Google Fonts) as primary
 *   - Aggie palette (#022851 / #FFBF00 / #1b4a7a) as core colors
 *   - .ucd-gradient = linear-gradient(135deg, #022851 0%, #1b4a7a 100%)
 *   - Sticky h-20 nav, gold-accent active state with bottom border
 */

:root {
  /* Shared horizontal page rhythm — appbar + content share these so edges align */
  --page-max: 1320px;
  --page-pad-x: 28px;

  /* IC-FOODS Aggie Blue + Gold (canonical from ic-foods-cms) */
  --aggie-blue: #022851;
  --aggie-blue-light: #1b4a7a;
  --aggie-gold: #FFBF00;
  --aggie-gray: #f5f5f5;

  /* Aliases for backwards compat */
  --ic-navy-900: var(--aggie-blue);
  --ic-navy-700: #0a3567;
  --ic-navy-500: var(--aggie-blue-light);
  --ic-navy-200: rgba(27, 74, 122, 0.12);
  --ic-navy-100: rgba(27, 74, 122, 0.06);
  --ic-gold-500: var(--aggie-gold);
  --ic-gold-200: rgba(255, 191, 0, 0.18);

  /* Greys */
  --bg-page: #f6f7f9;
  --bg-card: #ffffff;
  --bg-subtle: #f1f3f6;
  --border: #e4e7ec;
  --border-strong: #cdd3dc;
  --text-1: #022851;
  --text-2: #475467;
  --text-3: #6b7280;
  --text-muted: #98a2b3;

  /* Status colors */
  --st-pass: #137333;
  --st-pass-bg: #e6f4ea;
  --st-fail: #b42318;
  --st-fail-bg: #fde7e6;
  --st-pending: #b54708;
  --st-pending-bg: #fef0c7;
  --st-na: #475467;
  --st-na-bg: #eef0f4;
  --st-info: #0a3567;
  --st-info-bg: #e7eef7;

  /* Role accents (used in identity card, login picker, etc.) */
  --role-producer: #0a6b5b;
  --role-producer-bg: #e0f3ef;
  --role-auditor: #5b21b6;
  --role-auditor-bg: #f0e8fb;
  --role-developer: #c2410c;
  --role-developer-bg: #ffe9d6;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 2px 4px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 12px 24px rgba(2, 40, 81, 0.10), 0 4px 8px rgba(2, 40, 81, 0.06);

  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#root { min-height: 100vh; }

button { font-family: inherit; }

a { color: var(--ic-navy-500); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }

.ucd-gradient { background: linear-gradient(135deg, var(--aggie-blue) 0%, var(--aggie-blue-light) 100%); }

/* ──────────────────────────────────────────────────────────────────
   Layout primitives
   ────────────────────────────────────────────────────────────────── */
.container {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 24px var(--page-pad-x);
}
@media (max-width: 900px) {
  .container { padding: 18px 14px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 560px) {
  .container { padding: 14px 12px; }
  .stat-grid { grid-template-columns: 1fr !important; }
  .page-h1 { font-size: 19px !important; }
}

.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }

.spacer { flex: 1 1 auto; }

/* ──────────────────────────────────────────────────────────────────
   App bar — Aggie Blue, sticky, height 64px
   ────────────────────────────────────────────────────────────────── */
.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--aggie-blue);
  color: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.06);
}
.appbar-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--page-pad-x);
  height: 64px;
  display: flex;
  align-items: center;
  gap: 24px;
}
@media (max-width: 900px) {
  .appbar-inner { padding: 0 14px; }
}
@media (max-width: 560px) {
  .appbar-inner { padding: 0 12px; gap: 12px; height: 56px; }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: left;
  border-radius: 8px;
  transition: opacity 0.12s, box-shadow 0.12s;
}
.brand:hover { opacity: 0.92; }
.brand:focus-visible {
  outline: 2px solid var(--aggie-gold);
  outline-offset: 3px;
}
.brand:hover .brand-mark { box-shadow: 0 0 0 3px rgba(255, 191, 0, 0.25); }
.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: var(--aggie-gold);
  color: var(--aggie-blue);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
}
.brand-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  line-height: 1.2;
  color: #fff;
}
.brand-sub {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.2;
  margin-top: 1px;
}

/* Desktop nav */
.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-tab {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  padding: 8px 10px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.nav-tab:hover { color: #fff; }
.nav-tab.active {
  color: var(--aggie-gold);
  border-bottom-color: var(--aggie-gold);
  font-weight: 600;
}
@media (max-width: 1024px) {
  .nav-tabs.desktop-only { display: none; }
}
@media (max-width: 1024px) {
  .hamburger { display: inline-flex; }
}

.appbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Scheme pill */
.scheme-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--aggie-blue-light);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 120ms ease;
}
.scheme-pill:hover { background: #245c8f; }
@media (max-width: 560px) {
  .scheme-pill .scheme-label { display: none; }
}

/* User menu (avatar dropdown) — mirrors ic-foods-cms pattern */
.user-menu {
  position: relative;
  flex-shrink: 0;
}
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 5px;
  border-radius: 999px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 120ms ease;
}
.user-menu-btn:hover { background: rgba(255,255,255,0.08); }
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--aggie-gold);
  color: var(--aggie-blue);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.user-menu-chev { color: rgba(255,255,255,0.6); }
.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 260px;
  background: #fff;
  color: var(--text-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 60;
}
.user-menu-id {
  padding: 14px 16px;
  background: var(--aggie-gray);
  border-bottom: 1px solid var(--border);
}
.user-menu-id .name { font-weight: 600; font-size: 14px; color: var(--text-1); }
.user-menu-id .email { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.user-menu-id .role-line { margin-top: 8px; }
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--text-1);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.user-menu-item:hover { background: var(--aggie-gray); }
.user-menu-item.danger { color: var(--st-fail); border-top: 1px solid var(--border); }

/* Mobile menu */
.hamburger {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.85);
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.hamburger:hover { background: rgba(255,255,255,0.08); }
.mobile-menu {
  display: none;
  background: var(--aggie-blue-light);
  border-top: 1px solid rgba(255,255,255,0.08);
  padding: 8px 14px 12px;
}
.mobile-menu.open { display: block; }
.mobile-menu .nav-tab {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 6px;
  border-bottom: none;
  margin-bottom: 0;
  color: rgba(255,255,255,0.85);
}
.mobile-menu .nav-tab:hover { background: rgba(255,255,255,0.08); }
.mobile-menu .nav-tab.active {
  background: rgba(255,191,0,0.16);
  color: var(--aggie-gold);
  border-bottom: none;
  font-weight: 600;
}

/* ──────────────────────────────────────────────────────────────────
   Login screen
   ────────────────────────────────────────────────────────────────── */
.login-shell {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 110% -10%, rgba(255,191,0,0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(27,74,122,0.35), transparent 55%),
    linear-gradient(135deg, var(--aggie-blue) 0%, #052744 65%, #02192f 100%);
  color: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  overflow-x: hidden;
}
.login-shell > * { min-width: 0; }
@media (max-width: 980px) {
  .login-shell { grid-template-columns: 1fr; }
}
.login-pitch {
  padding: 56px 56px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
}
@media (max-width: 980px) {
  .login-pitch { padding: 32px 24px; min-height: auto; }
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}
.login-brand .brand-mark { width: 40px; height: 40px; font-size: 14px; }
.login-pitch h1 {
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0 0 18px;
  color: #fff;
  text-wrap: balance;
}
.login-pitch p {
  font-size: 15px;
  line-height: 1.55;
  color: rgba(255,255,255,0.75);
  max-width: 480px;
  margin: 0;
}
.login-bullets {
  margin-top: 28px;
  display: grid;
  gap: 14px;
}
.login-bullet {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  color: rgba(255,255,255,0.82);
  font-size: 14px;
}
.login-bullet .b-icon {
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--aggie-gold);
}
.login-meta {
  margin-top: 40px;
  font-size: 11.5px;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-form-wrap {
  padding: 56px 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 980px) {
  .login-form-wrap { padding: 24px 20px 48px; }
}
.login-form {
  background: #fff;
  color: var(--text-1);
  border-radius: 14px;
  padding: 28px 28px 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-form h2 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 600;
}
.login-form .login-sub { color: var(--text-3); font-size: 13px; margin-bottom: 18px; }
.login-form .field-label { margin-top: 12px; }
.login-google {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #fff;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-1);
}
.login-google:hover { background: var(--aggie-gray); }
.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 16px 0;
}
.login-divider::before, .login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.login-submit {
  margin-top: 16px;
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  background: var(--aggie-blue);
  color: #fff;
  border: none;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
}
.login-submit:hover { background: var(--aggie-blue-light); }
.login-submit:disabled { opacity: 0.55; cursor: not-allowed; }

.demo-roles {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.demo-roles .demo-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}
.demo-role-grid { display: grid; gap: 8px; }
.demo-role-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.demo-role-card:hover { border-color: var(--aggie-blue-light); background: var(--aggie-gray); }
.demo-role-card .role-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.demo-role-card .role-name { font-size: 13.5px; font-weight: 600; color: var(--text-1); }
.demo-role-card .role-desc { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }

/* ──────────────────────────────────────────────────────────────────
   Cards
   ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text-1); }
.card-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.card-body { padding: 16px 18px; }
.card-tight .card-body { padding: 12px 14px; }
.card-padless .card-body { padding: 0; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}
.page-h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.015em;
  color: var(--text-1);
}
.page-sub {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 4px;
}

/* ──────────────────────────────────────────────────────────────────
   Status badges + chips
   ────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.badge.pass    { color: var(--st-pass);    background: var(--st-pass-bg); }
.badge.fail    { color: var(--st-fail);    background: var(--st-fail-bg); }
.badge.pending { color: var(--st-pending); background: var(--st-pending-bg); }
.badge.na      { color: var(--st-na);      background: var(--st-na-bg); }
.badge.info    { color: var(--st-info);    background: var(--st-info-bg); }
.badge.role-producer  { color: var(--role-producer);  background: var(--role-producer-bg); }
.badge.role-auditor   { color: var(--role-auditor);   background: var(--role-auditor-bg); }
.badge.role-developer { color: var(--role-developer); background: var(--role-developer-bg); }
.badge.outline { background: transparent; border-color: var(--border-strong); color: var(--text-2); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--bg-subtle);
  color: var(--text-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.chip.warning { background: #fffaeb; border-color: #fdebbf; color: #b54708; }
.chip code { font-family: var(--font-mono); font-size: 11px; }

/* ──────────────────────────────────────────────────────────────────
   Buttons
   ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--aggie-blue);
  color: #fff;
}
.btn-primary:hover { background: var(--aggie-blue-light); }
.btn-secondary {
  background: #fff;
  color: var(--text-1);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-subtle); }
.btn-accent {
  background: var(--aggie-gold);
  color: var(--aggie-blue);
}
.btn-accent:hover { filter: brightness(0.95); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg-subtle); }
.btn-success { background: var(--st-pass); color: #fff; }
.btn-success:hover { background: #0e6b29; }
.btn-danger { background: #fff; color: var(--st-fail); border-color: var(--st-fail-bg); }
.btn-danger:hover { background: var(--st-fail-bg); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Icon button */
.icon-btn {
  width: 30px; height: 30px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-2);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}
.icon-btn:hover { background: var(--bg-subtle); }
.icon-btn.on { background: var(--ic-navy-100); color: var(--aggie-blue); }

/* ──────────────────────────────────────────────────────────────────
   Tables
   ────────────────────────────────────────────────────────────────── */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 14px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #f8fafc; }
.table tr.selected td { background: var(--ic-navy-100); }
.table .num { font-variant-numeric: tabular-nums; }
.table .tight { width: 1%; white-space: nowrap; }
.table .mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }

/* Hide select columns on mobile */
@media (max-width: 760px) {
  .hide-mobile { display: none !important; }
}

/* ──────────────────────────────────────────────────────────────────
   Inputs
   ────────────────────────────────────────────────────────────────── */
.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
  display: block;
}
.input, .select, .textarea {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-1);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--aggie-blue-light);
  box-shadow: 0 0 0 3px rgba(27, 74, 122, 0.15);
}
.textarea { resize: vertical; min-height: 80px; line-height: 1.45; }
.select { appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3e%3cpath d='M3 4.5l3 3 3-3' stroke='%23475467' stroke-width='1.5' fill='none' stroke-linecap='round'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 10px center; }

/* ──────────────────────────────────────────────────────────────────
   Tree explorer
   ────────────────────────────────────────────────────────────────── */
.tree { font-size: 13px; }
.tree-node {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  margin-bottom: 8px;
}
.tree-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  user-select: none;
  flex-wrap: wrap;
}
.tree-row:hover { background: #f8fafc; }
.tree-node.selected > .tree-row { background: var(--ic-navy-100); }
.tree-disclosure {
  width: 18px; height: 18px;
  display: inline-grid;
  place-items: center;
  color: var(--text-3);
  flex-shrink: 0;
}
.tree-op {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--ic-navy-100);
  color: var(--aggie-blue);
  flex-shrink: 0;
}
.tree-op.leaf-template { background: var(--st-info-bg); color: var(--st-info); }
.tree-op.leaf-human    { background: var(--ic-gold-200); color: #6b4f00; }
.tree-label {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-1);
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.tree-kids {
  border-top: 1px solid var(--border);
  padding: 8px 8px 4px 24px;
  background: #fbfcfd;
}
@media (max-width: 560px) {
  .tree-kids { padding-left: 12px; }
  .tree-row { padding: 8px 10px; gap: 8px; }
}

/* ─────────────────────────────────────────────────────────────────
   Evaluations — scrollable Requirements list + per-row accordion body
   (prefixed `eval-req-*` to avoid collision with `.req-*` in farmer.css)
   ───────────────────────────────────────────────────────────────── */
.eval-req-list {
  max-height: calc(100vh - 320px);
  min-height: 480px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.eval-req-row {
  border-bottom: 1px solid var(--border);
}
.eval-req-row:last-child { border-bottom: none; }

.eval-req-row-head {
  width: 100%;
  display: grid;
  grid-template-columns: 18px 110px minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.eval-req-row-head:hover { background: #f8fafc; }
.eval-req-row.open > .eval-req-row-head {
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  /* Pin the open requirement's head so it stays in view while you scroll
     through its accordions — you can't scroll past the requirement you're on. */
  position: sticky;
  top: 0;
  z-index: 3;
}
.eval-req-id { font-size: 12px; color: var(--text-2); }
.eval-req-title-col { min-width: 0; }
.eval-req-title-col > .fw-500 {
  text-wrap: pretty;
}
.eval-req-status { min-width: 130px; display: inline-flex; justify-content: flex-start; }

.eval-req-row-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  padding: 14px 16px 18px;
  background: #fafbfc;
}
@media (max-width: 980px) {
  .eval-req-row-body { grid-template-columns: 1fr; }
}

.eval-req-accordions { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

.eval-req-verdict-col { position: relative; min-width: 0; }
.eval-req-verdict-sticky {
  position: sticky;
  /* Sit just below the sticky requirement head (~52px) */
  top: 64px;
}
.verdict-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}
.verdict-head {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}
.verdict-card .detail-h { margin-top: 0; }

/* Accordion (used inside expanded requirement rows) */
.accord {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.accord-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
}
.accord-head:hover { background: #fafbfc; }
.accord.open > .accord-head { border-bottom: 1px solid var(--border); }
.accord-title { font-size: 13px; font-weight: 600; color: var(--text-1); }
.accord-sub {
  font-size: 11px;
  color: var(--text-3);
  margin-left: 4px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.accord-body { padding: 12px; }
/* Tree sits flush inside its accordion */
.accord-body > .tree > .tree-node { margin-bottom: 0; }

/* Leaf detail panel (legacy — kept in case any other surface still uses it) */
.detail-panel { position: sticky; top: 80px; }
.detail-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.detail-section:last-child { border-bottom: none; }
.detail-h {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}
.kv-list { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 12.5px; }
.kv-list dt { color: var(--text-3); }
.kv-list dd { margin: 0; color: var(--text-1); font-family: var(--font-mono); font-size: 12px; word-break: break-word; }

.evidence-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  background: #fff;
}
/* Sortable column headers (used by evidence library, etc) */
.table th.sortable {
  cursor: pointer;
  user-select: none;
}
.table th.sortable:hover { background: var(--bg-subtle); color: var(--text-1); }
.sort-th { display: inline-flex; align-items: center; gap: 4px; }
.sort-ind { opacity: 0.3; transition: opacity 0.12s, transform 0.12s; }
.sort-ind.active { opacity: 1; color: var(--aggie-blue, var(--ic-navy-500)); }
.table th.is-sorted { color: var(--text-1); }

/* Submission chip in evidence library — slightly slimmer than the default */
.chip.submission-chip {
  background: var(--ic-navy-100, #eef3ff);
  color: var(--ic-navy-600, #1e3a8a);
  border: 1px solid rgba(30, 58, 138, 0.18);
  font-weight: 500;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.evidence-card.compact { padding: 8px 10px; margin-bottom: 6px; }
.evidence-card.clickable { cursor: pointer; transition: background 0.12s, border-color 0.12s; }
.evidence-card.clickable:hover { background: var(--bg-subtle); border-color: var(--ic-navy-300, #c7d2fe); }
.evidence-card.clickable:focus-visible {
  outline: 2px solid var(--aggie-blue-light, var(--ic-navy-400, #93c5fd));
  outline-offset: 1px;
}
.evidence-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.evidence-card .title { font-size: 13px; font-weight: 500; }
.evidence-card .meta  { font-size: 12px; color: var(--text-3); }
.evidence-card .snippet {
  font-size: 12px;
  color: var(--text-2);
  background: var(--bg-subtle);
  border-left: 2px solid var(--aggie-blue-light);
  padding: 6px 10px;
  margin-top: 6px;
  border-radius: 0 6px 6px 0;
  font-family: var(--font-mono);
  line-height: 1.45;
}

/* AI rationale */
.ai-block {
  background: #fffdf3;
  border: 1px solid var(--ic-gold-200);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.ai-block-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ai-block-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #6b4f00;
}
.confidence-bar {
  height: 6px;
  background: rgba(255,255,255,0.6);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--ic-gold-200);
}
.confidence-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #ffd966 0%, #ffbf00 100%);
}

/* Stat block */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-3);
}
.stat-value {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 4px;
}
.stat-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* Progress */
.progress {
  display: flex;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-subtle);
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress > div { height: 100%; }
.progress .pass { background: var(--st-pass); }
.progress .fail { background: var(--st-fail); }
.progress .pending { background: var(--st-pending); }
.progress .na { background: var(--st-na); }

/* Helpers */
.muted { color: var(--text-3); }
.mono { font-family: var(--font-mono); font-size: 12px; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.w-full { width: 100%; }
.flex-wrap { flex-wrap: wrap; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-xs { font-size: 11px; } .text-sm { font-size: 12px; } .text-md { font-size: 14px; } .text-lg { font-size: 16px; }
.fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; }

/* Two-column page layout (main + right rail) */
.layout-2col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1100px) {
  .layout-2col { grid-template-columns: 1fr; }
  .detail-panel { position: static; }
}

/* Tabs (inner) */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  overflow-x: auto;
}
.tab {
  background: transparent;
  border: none;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.tab.active { color: var(--aggie-blue); border-bottom-color: var(--aggie-gold); font-weight: 600; }

/* Empty state */
.empty {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--text-3);
  background: #fff;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--aggie-blue);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  animation: toast-in 200ms ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 40, 81, 0.45);
  backdrop-filter: blur(2px);
  z-index: 80;
  display: grid;
  place-items: center;
  animation: fade-in 140ms ease;
}
.modal {
  width: min(560px, 92vw);
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-body { padding: 18px 20px; max-height: 60vh; overflow: auto; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ─────────────────────────────────────────────────────────────────
   PDF preview modal — stand-in viewer for cited evidence
   ───────────────────────────────────────────────────────────────── */
.pdf-modal .modal-header { align-items: flex-start; }
.pdf-modal-body {
  padding: 0;
  max-height: 75vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  background: #e7eaf0;
}
@media (max-width: 720px) {
  .pdf-modal-body { grid-template-columns: 1fr; }
}
.pdf-page {
  background: #fff;
  margin: 20px;
  padding: 28px 36px;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 6px 18px rgba(0,0,0,0.08);
  font-family: Georgia, "Times New Roman", serif;
  color: #222;
  min-height: 540px;
  overflow: auto;
}
.pdf-page-header,
.pdf-page-footer {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pdf-page-footer {
  border-bottom: none;
  border-top: 1px solid var(--border);
  padding-bottom: 0;
  padding-top: 8px;
  margin-top: 18px;
  margin-bottom: 0;
}
.pdf-page-body { font-size: 13px; line-height: 1.7; }
.pdf-line { min-height: 1.7em; }
.pdf-line-blank { min-height: 1em; }
.pdf-line-highlight { margin: 4px 0; }
.pdf-highlight {
  background: #ffe46a;
  background: linear-gradient(180deg, transparent 8%, #fff070 8%, #fff070 92%, transparent 92%);
  padding: 2px 4px;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(180, 130, 0, 0.25);
}
.pdf-cite-aside {
  padding: 20px 18px;
  background: #fafbfc;
  border-left: 1px solid var(--border);
  font-size: 13px;
  overflow: auto;
}
.pdf-cite-snippet {
  background: #fff070;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 12.5px;
  color: var(--text-1);
  line-height: 1.5;
  box-shadow: inset 0 0 0 1px rgba(180, 130, 0, 0.25);
}
