/* ============================================================
   UNICEF Kenya DocAuth - "Examination Bench" Design System v3
   Paper artifacts on an archival desk; ink-stamp verdicts;
   machine-read data in mono. Bootstrap 5.3 underneath.

   Voice rules:
   - Archivo (sans) = human prose, headings, navigation.
   - IBM Plex Mono  = anything the machine read or computed:
     stat values, reference numbers, statuses, hashes, code.
   - Statuses render as ink-stamp impressions (border + tint),
     never as soft filled pills.
   ============================================================ */

/* ── 1. CSS CUSTOM PROPERTIES ────────────────────────────── */
:root {
  /* UNICEF Brand */
  --unicef-blue: #00aeef;
  --unicef-blue-dark: #0086c3;
  --unicef-blue-darker: #1c4f8b;
  --unicef-navy: #002a5c;
  --ink: #001d3f; /* sidebar / login ink */

  /* Light theme surfaces - cool archival gray desk, paper cards */
  --bg: #eef1f1;
  --bg-secondary: #e4e9e9;
  --surface: #ffffff;
  --surface-2: #f5f7f7;
  --surface-hover: #edf2f3;
  --border: #d9dfe0;
  --border-strong: #b6c1c3;

  /* Typography */
  --text: #16232b;
  --text-secondary: #45565f;
  --muted: #7c8b91;
  --link: var(--unicef-blue-dark);

  --font-sans: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", Consolas, monospace;

  /* Brand primary */
  --primary: var(--unicef-blue);
  --primary-dark: var(--unicef-blue-dark);
  --primary-rgb: 0, 174, 239;

  /* Semantic - ink tones (ledger green, stamp ochre, red ink) */
  --success: #12805c;
  --success-bg: #e2f2ea;
  --success-text: #0b5c42;
  --warning: #eda12f;
  --warning-bg: #fbf0da;
  --warning-text: #8a5a06;
  --danger: #c92a2a;
  --danger-bg: #fbe7e7;
  --danger-text: #97201f;
  --info: #1c6fb8;
  --info-bg: #e3eef8;
  --info-text: #155289;
  --purple: #6d4fc4;

  /* Layout - crisp, document-like */
  --sidebar-width: 256px;
  --sidebar-collapsed: 64px;
  --topbar-height: 60px;
  --footer-height: 48px;
  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 2px rgba(22, 35, 43, 0.06);
  --shadow: 0 1px 2px rgba(22, 35, 43, 0.06), 0 3px 8px rgba(22, 35, 43, 0.06);
  --shadow-lg: 0 2px 4px rgba(22, 35, 43, 0.06), 0 10px 24px rgba(22, 35, 43, 0.1);
  --shadow-xl: 0 4px 8px rgba(22, 35, 43, 0.08), 0 20px 40px rgba(22, 35, 43, 0.14);

  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  /* Examination room after hours: deep ink, paper under lamplight */
  --bg: #0c1418;
  --bg-secondary: #080e12;
  --surface: #141f26;
  --surface-2: #101a20;
  --surface-hover: #1b2a33;
  --border: #263640;
  --border-strong: #3a4f5b;

  --text: #e8eef1;
  --text-secondary: #93a6ae;
  --muted: #64777f;
  --link: #38bdf8;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.35);
  --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 4px 10px rgba(0,0,0,0.3);
  --shadow-lg: 0 2px 4px rgba(0,0,0,0.45), 0 12px 28px rgba(0,0,0,0.45);
  --shadow-xl: 0 4px 8px rgba(0,0,0,0.5), 0 24px 48px rgba(0,0,0,0.55);

  --success-bg: rgba(24, 158, 113, 0.16);
  --success-text: #4ccb9c;
  --warning-bg: rgba(237, 161, 47, 0.16);
  --warning-text: #f0b45c;
  --danger-bg: rgba(224, 82, 82, 0.16);
  --danger-text: #ef8080;
  --info-bg: rgba(56, 143, 214, 0.16);
  --info-text: #6cb0e8;
}

/* ── 2. GLOBAL RESET & BASE ──────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  transition: background 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  letter-spacing: -0.015em;
}

/* Visible keyboard focus, everywhere */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Bootstrap overrides for theme compatibility */
.bg-body-tertiary { background: var(--bg) !important; }
.text-muted { color: var(--muted) !important; }
.border { border-color: var(--border) !important; }

/* ── 3. LAYOUT SHELL ─────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── 4. SIDEBAR ──────────────────────────────────────────── */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: var(--sidebar-width);
  background: var(--ink);
  border-right: 3px solid var(--unicef-blue);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

[data-theme="dark"] .app-sidebar {
  background: #08111c;
  border-right: 3px solid var(--unicef-blue);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  text-decoration: none;
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--unicef-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-icon i {
  font-size: 1.1rem;
  color: #fff;
}

.sidebar-logo-text {
  flex: 1;
  overflow: hidden;
}

.sidebar-logo-title {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}

.sidebar-logo-sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Nav sections */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Section labels read like file-folder tabs */
.sidebar-section-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.38);
  padding: 1.1rem 1rem 0.35rem;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  margin: 0.1rem 0.5rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.68);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 450;
  transition: var(--transition-fast);
  position: relative;
  white-space: nowrap;
}

.sidebar-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.07);
  text-decoration: none;
}

.sidebar-item.active {
  color: #fff;
  background: rgba(0,174,239,0.16);
  font-weight: 600;
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: -0.5rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 70%;
  background: var(--unicef-blue);
  border-radius: 0;
}

.sidebar-item i {
  font-size: 1rem;
  width: 1.25rem;
  flex-shrink: 0;
  opacity: 0.8;
}

.sidebar-item.active i { opacity: 1; }

.sidebar-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  background: var(--warning);
  color: #221500;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-sm);
  min-width: 1.25rem;
  text-align: center;
}

.sidebar-badge.danger {
  background: var(--danger);
  color: #fff;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.sidebar-user:hover {
  background: rgba(255,255,255,0.07);
}

.sidebar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--unicef-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-username {
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255,255,255,0.85);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 5. TOPBAR ───────────────────────────────────────────── */
.app-topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  z-index: 1030;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
}

.topbar-breadcrumb {
  flex: 1;
  min-width: 0;
}

/* Breadcrumb reads like a file path */
.breadcrumb {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  flex-wrap: nowrap;
  overflow: hidden;
}

.breadcrumb-item {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breadcrumb-item a {
  color: var(--muted);
  text-decoration: none;
  transition: var(--transition-fast);
}

.breadcrumb-item a:hover { color: var(--text); }

.breadcrumb-item.active { color: var(--text); font-weight: 600; }

.breadcrumb-item + .breadcrumb-item::before {
  content: '/';
  color: var(--border-strong);
  margin-right: 0.4rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Mobile menu toggle */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* Quiet ghost buttons - no boxed borders in the topbar */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.theme-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* Notification bell */
.topbar-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
  text-decoration: none;
  position: relative;
}

.topbar-icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.topbar-icon-btn .badge-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--danger);
  border: 1.5px solid var(--surface);
}

/* User menu - separated from the icon cluster by a hairline rule */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 36px;
  padding: 0 0.5rem 0 0.35rem;
  margin-left: 0.65rem;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  position: relative;
  cursor: pointer;
  transition: var(--transition-fast);
}

.topbar-user::before {
  content: '';
  position: absolute;
  left: -0.65rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 20px;
  background: var(--border);
}

.topbar-user:hover {
  background: var(--surface-hover);
}

.topbar-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--unicef-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.topbar-username {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 6. MAIN CONTENT AREA ────────────────────────────────── */
/* Sole scroll container between the fixed topbar and footer.
   Scrollbar hidden by request - wheel/touch/keys still scroll. */
.app-main {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  height: calc(100vh - var(--topbar-height) - var(--footer-height));
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 1.75rem 1.75rem;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-main::-webkit-scrollbar { display: none; }

/* Page header */
.page-header {
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.3;
}

.page-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0.25rem 0 0;
}

/* ── 7. CARDS ────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

.card:hover { box-shadow: var(--shadow); }

.card-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius) var(--radius) 0 0;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-header i { color: var(--primary); opacity: 0.9; }

.card-body {
  padding: 1.25rem;
  color: var(--text);
}

.card-footer {
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 var(--radius) var(--radius);
  color: var(--text-secondary);
  font-size: 0.82rem;
}

/* Stat / KPI cards - ledger register entries: mono values,
   verdict rule along the top edge like an inked tab */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--primary);
}

.stat-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}

.stat-card.pass::before { background: var(--success); }
.stat-card.review::before { background: var(--warning); }
.stat-card.hold::before { background: var(--danger); }
.stat-card.purple::before { background: var(--purple); }

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 0.875rem;
  flex-shrink: 0;
}

.stat-icon.blue   { background: rgba(var(--primary-rgb), 0.12); color: var(--primary-dark); }
.stat-icon.green  { background: var(--success-bg); color: var(--success); }
.stat-icon.amber  { background: var(--warning-bg); color: var(--warning-text); }
.stat-icon.red    { background: var(--danger-bg); color: var(--danger); }
.stat-icon.purple { background: rgba(109,79,196,0.12); color: var(--purple); }

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.stat-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
}

/* Metric tile (simpler) */
.metric-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
}

.metric-tile:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.metric-tile .value {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.metric-tile .label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

/* ── 8. TABLES ───────────────────────────────────────────── */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.table {
  margin: 0;
  color: var(--text);
}

.table > :not(caption) > * > * {
  padding: 0.75rem 1rem;
  border-bottom-color: var(--border);
  background: transparent;
  vertical-align: middle;
}

.table thead th {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border) !important;
  white-space: nowrap;
}

.table-hover tbody tr {
  transition: var(--transition-fast);
}

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

.table-clickable tbody tr { cursor: pointer; }

/* Sticky table header */
.table-sticky thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* ── 9. FORMS ────────────────────────────────────────────── */
.form-control, .form-select {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.875rem;
  font-size: 0.875rem;
  transition: var(--transition-fast);
}

.form-control:focus, .form-select:focus {
  background: var(--surface);
  color: var(--text);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
  outline: none;
}

.form-control::placeholder { color: var(--muted); }

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-text {
  font-size: 0.78rem;
  color: var(--muted);
}

.input-group-text {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}

.form-check-input {
  border-color: var(--border-strong);
  background-color: var(--surface);
}

.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

.form-section {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.form-section-title {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--unicef-blue-dark);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── 10. BUTTONS ─────────────────────────────────────────── */
.btn {
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 0.5rem 1rem;
  transition: var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  line-height: 1.4;
}

.btn-primary, .btn-unicef {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.btn-primary:hover, .btn-unicef:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

.btn-outline-primary, .btn-outline-unicef {
  color: var(--primary-dark);
  border-color: var(--primary);
  background: transparent;
}

.btn-outline-primary:hover, .btn-outline-unicef:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-outline-secondary {
  color: var(--text-secondary);
  border-color: var(--border-strong);
  background: transparent;
}

.btn-outline-secondary:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-outline-warning {
  color: var(--warning-text);
  border-color: var(--warning);
}

.btn-outline-warning:hover {
  background: var(--warning);
  border-color: var(--warning);
  color: #221500;
}

.btn-outline-danger {
  color: var(--danger);
  border-color: var(--danger);
}

.btn-outline-danger:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
}

.btn-lg {
  padding: 0.7rem 1.5rem;
  font-size: 0.95rem;
}

/* Loading button state */
.btn.loading {
  pointer-events: none;
  opacity: 0.75;
}

/* ── 11. BADGES & STAMPS ─────────────────────────────────────
   SIGNATURE ELEMENT. Verdicts are stamped in ink: current-color
   border, faint tint, uppercase letterspaced mono. */
.badge {
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: var(--radius-sm);
  padding: 0.28rem 0.55rem;
}

/* Decision stamps */
.decision-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.6rem;
  border-radius: 3px;
  border: 1.5px solid currentColor;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.decision-pill.pass, .decision-pill.resolved {
  background: var(--success-bg);
  color: var(--success-text);
}
.decision-pill.review {
  background: var(--warning-bg);
  color: var(--warning-text);
}
.decision-pill.hold, .decision-pill.escalated {
  background: var(--danger-bg);
  color: var(--danger-text);
}
.decision-pill.pending {
  background: transparent;
  color: var(--muted);
  border-style: dashed;
  border-width: 1px;
}

/* Per-document verification statuses (DocumentSubmission.verification_status) */
.decision-pill.auto_approved { background: var(--success-bg); color: var(--success-text); }
.decision-pill.needs_review { background: var(--warning-bg); color: var(--warning-text); }
.decision-pill.rejected { background: var(--danger-bg); color: var(--danger-text); }

/* Status stamps */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  border-radius: 3px;
  border: 1.5px solid currentColor;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge-status-pending   { background: transparent; color: var(--muted); border-style: dashed; border-width: 1px; }
.badge-status-processing{ background: var(--info-bg); color: var(--info-text); }
.badge-status-extracted { background: var(--success-bg); color: var(--success-text); }
.badge-status-validated { background: var(--success-bg); color: var(--success-text); }
.badge-status-pass      { background: var(--success-bg); color: var(--success-text); }
.badge-status-review    { background: var(--warning-bg); color: var(--warning-text); }
.badge-status-hold      { background: var(--danger-bg); color: var(--danger-text); }
.badge-status-escalated { background: var(--danger-bg); color: var(--danger-text); }
.badge-status-resolved  { background: var(--success-bg); color: var(--success-text); }
.badge-status-failed    { background: var(--danger-bg); color: var(--danger-text); }
.badge-status-error     { background: var(--danger-bg); color: var(--danger-text); }
.badge-status-warn      { background: var(--warning-bg); color: var(--warning-text); }
.badge-status-fail      { background: var(--danger-bg); color: var(--danger-text); }

/* Severity dots */
.severity-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 1px;
  flex-shrink: 0;
}
.severity-dot-pass { background: var(--success); }
.severity-dot-warn { background: var(--warning); }
.severity-dot-fail { background: var(--danger); }

/* Risk stamps */
.risk-low    { background: var(--success-bg); color: var(--success-text); }
.risk-medium { background: var(--warning-bg); color: var(--warning-text); }
.risk-high   { background: var(--danger-bg); color: var(--danger-text); }

/* ── 12. ALERTS ──────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  border-left-width: 3px;
  padding: 0.875rem 1.125rem;
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.alert i { flex-shrink: 0; margin-top: 0.1rem; }

.alert-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-left-color: var(--success);
}
.alert-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
  border-left-color: var(--warning);
}
.alert-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-left-color: var(--danger);
}
.alert-info {
  background: var(--info-bg);
  color: var(--info-text);
  border-left-color: var(--info);
}

.alert-dismissible .btn-close {
  filter: none;
  opacity: 0.6;
}

/* ── 13. DROPZONE ────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  background: var(--surface-2);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.04);
}

.dropzone-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: rgba(var(--primary-rgb), 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.dropzone-icon i {
  font-size: 1.75rem;
  color: var(--primary);
}

.dropzone h5 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.dropzone p {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}

/* ── 14. PROGRESS BARS ───────────────────────────────────── */
.progress {
  background: var(--border);
  border-radius: 2px;
  height: 6px;
  overflow: hidden;
}

.progress-bar {
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-bar.bg-success { background: var(--success) !important; }
.progress-bar.bg-warning { background: var(--warning) !important; }
.progress-bar.bg-danger  { background: var(--danger) !important; }
.progress-bar.bg-unicef  { background: var(--primary) !important; }

/* Confidence bar (inline) */
.confidence-bar {
  height: 5px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  display: inline-block;
}

.confidence-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ── 15. VALIDATION RESULT ROWS ──────────────────────────── */
.vr-row {
  border-left: 3px solid transparent;
  padding-left: 0.875rem;
}
.vr-row.sev-pass { border-left-color: var(--success); }
.vr-row.sev-warn { border-left-color: var(--warning); }
.vr-row.sev-fail { border-left-color: var(--danger); }

/* ── 16. LIST GROUP ──────────────────────────────────────── */
.list-group-item {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
  padding: 0.85rem 1.25rem;
}

.list-group-item-action:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.list-group-flush .list-group-item:last-child {
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

/* ── 17. DROPDOWNS ───────────────────────────────────────── */
.dropdown-menu {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 0.35rem;
  min-width: 160px;
}

.dropdown-item {
  color: var(--text-secondary);
  border-radius: 3px;
  padding: 0.5rem 0.75rem;
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.dropdown-item i { width: 1rem; opacity: 0.7; }

.dropdown-divider {
  border-color: var(--border);
  margin: 0.25rem 0;
}

.dropdown-header {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.5rem 0.75rem;
}

/* ── 18. LOGIN PAGE ──────────────────────────────────────────
   Credential check at the archive door: flat ink field, one
   paper-edge card ruled in UNICEF cyan. No glass, no blobs. */
.login-page {
  background: var(--ink);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

/* Faint ledger grid on the ink field */
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.login-page::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--unicef-blue);
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #0a2547;
  border: 1px solid rgba(255,255,255,0.14);
  border-top: 3px solid var(--unicef-blue);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  padding: 2.5rem;
  position: relative;
  z-index: 1;
}

.login-logo-wrap {
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  background: var(--unicef-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
}

.login-logo-wrap i {
  font-size: 1.9rem;
  color: #fff;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  text-align: center;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.login-subtitle {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.6);
  text-align: center;
  margin-bottom: 2rem;
}

.login-card .form-label {
  color: rgba(255,255,255,0.75);
  font-size: 0.8rem;
}

.login-card .form-control {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.18);
  color: #fff;
}

.login-card .form-control::placeholder { color: rgba(255,255,255,0.35); }

.login-card .form-control:focus {
  background: rgba(255,255,255,0.1);
  border-color: var(--unicef-blue);
  box-shadow: 0 0 0 3px rgba(0,174,239,0.25);
  color: #fff;
}

.login-card .input-group-text {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.5);
}

.login-footer-text {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.45);
  text-align: center;
  margin-top: 1.5rem;
}

/* ── 19. PIPELINE VISUALIZATION ──────────────────────────── */
.pipeline-track {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pipeline-step {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.875rem 0;
  position: relative;
}

.pipeline-step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 1.25rem;
  top: 3rem;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.pipeline-step-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  border: 2px solid transparent;
}

.pipeline-step-icon.pass    { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.pipeline-step-icon.warn    { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning); }
.pipeline-step-icon.fail    { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.pipeline-step-icon.pending { background: var(--surface-2); color: var(--muted); border-color: var(--border-strong); }
.pipeline-step-icon.active  { background: rgba(var(--primary-rgb),0.12); color: var(--primary); border-color: var(--primary); animation: pulse-ring 1.5s infinite; }

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(var(--primary-rgb), 0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--primary-rgb), 0); }
}

/* ── 20. EMPTY STATES ────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}

.empty-state-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.empty-state-icon i {
  font-size: 2rem;
  color: var(--muted);
  opacity: 0.5;
}

.empty-state h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.84rem;
  color: var(--muted);
  max-width: 320px;
  margin: 0 auto 1.25rem;
}

/* Fallback for old empty-state usage */
td.empty-state, .list-group-item.empty-state {
  padding: 3rem 1rem;
}

/* ── 21. FILTER CHIPS ─────────────────────────────────────────
   Chips stay rounded on purpose: rounded = toggle, stamped = verdict. */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.875rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: var(--transition-fast);
  cursor: pointer;
}

.filter-chip:hover {
  background: var(--surface-hover);
  color: var(--text);
  text-decoration: none;
}

.filter-chip.active {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}

.filter-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  white-space: nowrap;
}

/* ── 22. CODE BLOCKS ─────────────────────────────────────── */
code {
  font-size: 0.8em;
  font-family: var(--font-mono);
  background: var(--surface-2);
  color: var(--unicef-blue-dark);
  border-radius: 3px;
  padding: 0.1em 0.4em;
  border: 1px solid var(--border);
}

[data-theme="dark"] code { color: var(--link); }

pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--text);
  overflow: auto;
  font-family: var(--font-mono);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

/* ── 23. UTILITY / BRAND ─────────────────────────────────── */
.text-unicef { color: var(--unicef-blue-dark) !important; }
.bg-unicef   { background-color: var(--primary) !important; }
.border-unicef { border-color: var(--primary) !important; }

[data-theme="dark"] .text-unicef { color: var(--unicef-blue) !important; }

.text-muted-stronger { color: var(--text-secondary) !important; }

/* Reference numbers, hashes, PINs, amounts - machine voice */
.mono, .ref {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* Truncation helpers */
.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Action bar */
.action-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.875rem 1.25rem;
  z-index: 10;
  box-shadow: 0 -4px 12px rgba(22,35,43,0.06);
  margin: 0 -1.75rem -1.75rem;
}

/* Scrollable section */
.overflow-panel {
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1039;
  backdrop-filter: blur(2px);
}

/* ── 24. ANIMATIONS ──────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes countUp {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* Verdict lands like a rubber stamp */
@keyframes stampIn {
  0%   { opacity: 0; transform: scale(1.12) rotate(-1.5deg); }
  60%  { opacity: 1; transform: scale(0.98) rotate(0.3deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.fade-in { animation: fadeIn 0.3s ease forwards; }
.slide-in { animation: slideInRight 0.3s ease forwards; }
.stamp-in { animation: stampIn 0.35s cubic-bezier(0.2, 0.8, 0.3, 1) forwards; }

/* Staggered children */
.stagger-children > * { opacity: 0; animation: fadeIn 0.35s ease forwards; }
.stagger-children > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8) { animation-delay: 0.4s; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-hover) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Trend bar */
.trend-bar {
  transition: height 0.3s ease, opacity 0.2s ease;
}

.trend-bar:hover { opacity: 0.8; }

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .stagger-children > * { opacity: 1; }
}

/* ── 25. FOOTER ──────────────────────────────────────────── */
/* Pinned to the viewport bottom, mirrors the topbar */
.app-footer {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--footer-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0 1.75rem;
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  z-index: 1020;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s ease;
}

/* ── 26. RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .app-topbar {
    left: 0;
  }

  .app-main {
    margin-left: 0;
    padding: 1.25rem;
  }

  .app-footer {
    left: 0;
    padding: 0 1.25rem;
  }

  .sidebar-toggle {
    display: flex;
  }

  .action-bar {
    margin: 0 -1.25rem -1.25rem;
  }
}

@media (max-width: 575.98px) {
  .app-main { padding: 1rem; }
  .app-footer { padding: 0 1rem; }
  .app-footer > :last-child { display: none; }
  .stat-value { font-size: 1.5rem; }
  .page-title { font-size: 1.15rem; }
  .action-bar { margin: 0 -1rem -1rem; }
  .topbar-username { display: none; }
}

/* ── 27. PRINT ───────────────────────────────────────────── */
@media print {
  .app-sidebar, .app-topbar, .app-footer, .action-bar, .no-print { display: none !important; }
  .app-main { margin: 0 !important; padding: 0 !important; height: auto !important; overflow: visible !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* ── 29. DOCUMENT DETAIL v2 ──────────────────────────────── */

/* Decision banner (per-document AI verdict) - the big stamp.
   Double rule like an official impression; lands with stampIn. */
.decision-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  outline: 1px solid var(--border);
  outline-offset: 3px;
  margin-bottom: 1.25rem;
  animation: stampIn 0.35s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
.decision-banner-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.decision-banner.auto_approved { background: var(--success-bg); border-color: var(--success); outline-color: var(--success); }
.decision-banner.auto_approved .decision-banner-icon { background: var(--success); color: #fff; }
.decision-banner.auto_approved .decision-banner-title { color: var(--success-text); }

.decision-banner.needs_review { background: var(--warning-bg); border-color: var(--warning); outline-color: var(--warning); }
.decision-banner.needs_review .decision-banner-icon { background: var(--warning); color: #221500; }
.decision-banner.needs_review .decision-banner-title { color: var(--warning-text); }

.decision-banner.rejected { background: var(--danger-bg); border-color: var(--danger); outline-color: var(--danger); }
.decision-banner.rejected .decision-banner-icon { background: var(--danger); color: #fff; }
.decision-banner.rejected .decision-banner-title { color: var(--danger-text); }

.decision-banner.pending { background: var(--surface-2); border-color: var(--border); border-style: dashed; outline: none; animation: none; }
.decision-banner.pending .decision-banner-icon { background: var(--border-strong); color: var(--surface); }
.decision-banner.pending .decision-banner-title { color: var(--text-secondary); }

.decision-banner-title {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.decision-banner-meta { font-size: 0.82rem; color: var(--text-secondary); margin-top: 0.15rem; }

/* Document Ingestion Checks */
.ingestion-check { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.75rem 0; }
.ingestion-check + .ingestion-check { border-top: 1px solid var(--border); }
.ingestion-check-dot {
  width: 1.75rem; height: 1.75rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 0.85rem; margin-top: 0.1rem;
}
.ingestion-check-dot.pass { background: var(--success-bg); color: var(--success); }
.ingestion-check-dot.warn { background: var(--warning-bg); color: var(--warning-text); }
.ingestion-check-dot.fail { background: var(--danger-bg); color: var(--danger); }
.ingestion-check-dot.pending { background: var(--surface-2); color: var(--muted); }

.ingestion-check-result {
  font-family: var(--font-mono);
  font-size: 0.64rem; font-weight: 600; padding: 0.15rem 0.5rem;
  border-radius: 3px; border: 1.5px solid currentColor;
  text-transform: uppercase; letter-spacing: 0.08em;
  white-space: nowrap;
}
.ingestion-check-result.pass { background: var(--success-bg); color: var(--success-text); }
.ingestion-check-result.warn { background: var(--warning-bg); color: var(--warning-text); }
.ingestion-check-result.fail { background: var(--danger-bg); color: var(--danger-text); }
.ingestion-check-result.pending { background: transparent; color: var(--muted); border-style: dashed; border-width: 1px; }

/* Copy-to-clipboard button */
.copy-btn {
  background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: var(--radius-sm); width: 1.75rem; height: 1.75rem;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition-fast); flex-shrink: 0;
}
.copy-btn:hover { color: var(--text); border-color: var(--border-strong); }
.copy-btn.copy-btn-flash { background: var(--success-bg); border-color: var(--success); color: var(--success); }

/* eTIMS certificate-style card */
.etims-card { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.etims-card-header {
  padding: 0.875rem 1.25rem; display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between; gap: 0.5rem; color: #fff;
}
.etims-card-header.valid { background: var(--success); }
.etims-card-header.invalid { background: var(--danger); }
.etims-card-body { padding: 1.25rem; background: var(--surface); }

/* Signer avatar */
.signer-avatar {
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  background: var(--unicef-navy);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.8rem; flex-shrink: 0;
}

/* Anomaly score ring */
.anomaly-ring {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.anomaly-ring-value {
  width: 50px; height: 50px; border-radius: 50%; background: var(--surface);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.74rem; font-weight: 700; color: var(--text);
}

/* Document preview (pdf.js / image) */
.preview-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  padding: 0.6rem 1rem; background: var(--surface-2); border-bottom: 1px solid var(--border);
}
.preview-viewport {
  max-height: 640px; overflow: auto; background: var(--bg-secondary);
  display: flex; align-items: flex-start; justify-content: center; padding: 1rem;
}
.preview-viewport canvas, .preview-viewport img {
  max-width: 100%; box-shadow: var(--shadow); border-radius: 2px;
}
.zoom-input {
  width: 4.5rem; text-align: center; padding: 0.3rem 0.4rem;
  font-family: var(--font-mono);
}

/* KRA eTIMS verification status tile */
.kra-status-tile { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0.75rem; text-align: center; }
.kra-status-tile .kra-status-icon { font-size: 1.3rem; margin-bottom: 0.35rem; }
.kra-status-tile.ok .kra-status-icon { color: var(--success); }
.kra-status-tile.invalid .kra-status-icon { color: var(--danger); }
.kra-status-tile.unchecked .kra-status-icon { color: var(--muted); }

/* ── 28. BOOTSTRAP DARK MODE OVERRIDES ───────────────────── */
[data-theme="dark"] .table { --bs-table-color: var(--text); --bs-table-bg: transparent; --bs-table-border-color: var(--border); }
[data-theme="dark"] .modal-content { background: var(--surface); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .form-select option { background: var(--surface); color: var(--text); }

/* Card with colored left border on dark */
[data-theme="dark"] .border-warning { border-color: var(--warning) !important; }
[data-theme="dark"] .border-danger  { border-color: var(--danger) !important; }
[data-theme="dark"] .border-success { border-color: var(--success) !important; }
[data-theme="dark"] .border-info    { border-color: var(--info) !important; }

[data-theme="dark"] .bg-warning-subtle { background: rgba(237,161,47,0.12) !important; }
[data-theme="dark"] .bg-danger-subtle  { background: rgba(224,82,82,0.12) !important; }
[data-theme="dark"] .bg-success-subtle { background: rgba(24,158,113,0.12) !important; }
[data-theme="dark"] .bg-info-subtle    { background: rgba(56,143,214,0.12) !important; }
[data-theme="dark"] .bg-secondary-subtle { background: rgba(147,166,174,0.1) !important; }
[data-theme="dark"] .bg-light          { background: var(--surface-2) !important; }

[data-theme="dark"] .text-success-emphasis { color: #4ccb9c !important; }
[data-theme="dark"] .text-danger-emphasis  { color: #ef8080 !important; }
[data-theme="dark"] .text-warning-emphasis { color: #f0b45c !important; }
[data-theme="dark"] .text-info-emphasis    { color: #6cb0e8 !important; }
[data-theme="dark"] .text-secondary-emphasis { color: var(--text-secondary) !important; }
