/**
 * Enterprise Monochrome UI Design System & Data Table Styling
 * Strictly adhering to frontend_skill.md & ui_table_skill.md
 */

:root {
  color-scheme: light;

  /* Surfaces & Backgrounds */
  --bg: #f5f5f5;              /* Master page background */
  --bg-elevated: #ffffff;     /* Modals, elevated surfaces */
  --bg-panel: #ffffff;        /* Cards, sidebars, content containers */
  --bg-hover: #efefef;        /* Interactive hover states */
  --bg-input: #f8fafc;        /* Input fields and textarea backgrounds */
  --bg-soft: #ececec;         /* User bubbles, secondary badges */
  --bg-muted: #e6e6e6;        /* Inactive tabs, disabled fills */

  /* Borders & Dividers */
  --border: #e6e6e6;          /* Hairline card and panel dividers */
  --border-strong: #d4d4d4;   /* Active inputs, button outlines */

  /* Typography & Foregrounds */
  --fg: #0d0d0d;              /* Primary text (high-contrast black) */
  --fg-secondary: #2a2a2a;    /* Assistant prose, secondary body text */
  --fg-muted: #6e6e6e;        /* Metadata, timestamps, helper labels */
  --fg-dim: #9b9b9b;          /* Placeholders, disabled icons */

  /* Absolute Colors */
  --black: #0d0d0d;           /* Primary buttons, active pill backgrounds */
  --white: #ffffff;           /* Crisp card fills, text on black */

  /* Functional Status Accents */
  --accent-blue: #0284c7;
  --accent-blue-soft: #e0f2fe;
  --accent-green: #15803d;
  --accent-green-soft: #dcfce7;
  --accent-red: #ef4444;
  --accent-red-soft: #fee2e2;
  --accent-amber: #d97706;
  --accent-amber-soft: #fef3c7;

  /* Geometry & Radii */
  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius-md: 12px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  /* Elevation Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);

  /* Fonts */
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

/* Universal Reset & Base Styles */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Responsive text toggles (Desktop default) */
.badge-text-full { display: inline; }
.badge-text-short { display: none; }
.btn-text-full { display: inline; }
.btn-text-short { display: none; }

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

/* Custom Minimalist Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #d4d4d4;
  border-radius: var(--radius-pill);
}
::-webkit-scrollbar-thumb:hover {
  background: #a3a3a3;
}

/* Master Layout */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Sticky Glassmorphic Top Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--black);
  color: var(--white);
  display: grid;
  place-items: center;
}

.brand-mark svg {
  width: 16px;
  height: 16px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand-tag {
  font-size: 0.72rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

.hero-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--fg-secondary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 5px rgba(21, 128, 61, 0.5);
  animation: pulseAnimation 2s infinite ease-in-out;
}

@keyframes pulseAnimation {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

/* Container */
.app-container {
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 2rem 3rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* KPI Metrics Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.kpi-card {
  padding: 1rem 1.25rem;
}

.kpi-meta {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg);
}

.kpi-value.kpi-sm {
  font-size: 1.15rem;
}

.kpi-sub {
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: 0.25rem;
}

/* Card Containers (frontend_skill.md) */
.card {
  border: 1px solid var(--border);
  background: var(--bg-panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.card-head-title h3 {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.section-desc {
  font-size: 0.78rem;
  color: var(--fg-muted);
  margin-top: 0.1rem;
}

.card-head-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.card-body {
  padding: 1.25rem;
}

/* Button System (frontend_skill.md) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  letter-spacing: -0.01em;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s, transform 0.1s;
  white-space: nowrap;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--black);
  color: var(--white);
}

.btn-primary:hover:not(:disabled) {
  background: #262626;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.btn-ghost {
  background: var(--white);
  color: var(--fg);
  border-color: var(--border-strong);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  border-color: #b0b0b0;
}

.btn-soft {
  background: var(--bg-soft);
  color: var(--fg);
}

.btn-soft:hover:not(:disabled) {
  background: var(--bg-muted);
}

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

.btn-block {
  width: 100%;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-xs);
  display: grid;
  place-items: center;
  color: var(--fg-muted);
  border: 1px solid var(--border);
  background: var(--white);
  transition: background 0.12s, color 0.12s;
}

.icon-btn:hover {
  background: var(--bg-hover);
  color: var(--fg);
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Pills & Badges */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--fg-muted);
}

.pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fg-dim);
}

.pill.ok {
  color: var(--fg);
  border-color: var(--border-strong);
}

.pill.ok .dot {
  background: var(--black);
}

/* Form Primitives */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--fg-secondary);
}

.input {
  display: block;
  width: 100%;
  height: 38px;
  background: var(--bg-input);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  padding: 0 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="date"].input {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

input[type="date"]::-webkit-date-and-time-value {
  min-height: 1.4em;
  text-align: left;
  display: flex;
  align-items: center;
}

.input:focus {
  background: var(--white);
  border-color: var(--black);
  box-shadow: 0 0 0 2px rgba(13, 13, 13, 0.08);
}

.input-sm {
  height: 32px;
  padding: 0 0.6rem;
  font-size: 0.78rem;
  border-radius: var(--radius-xs);
}

select.input {
  cursor: pointer;
}

.slider {
  accent-color: var(--black);
  cursor: pointer;
  height: 6px;
}

/* Screening Console Layout */
.screen-form .form-row {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.flex-1 { flex: 1; min-width: 150px; }
.flex-2 { flex: 2; min-width: 220px; }
.flex-name { flex: 1; min-width: 200px; }

.field-dob {
  width: 145px;
  flex-shrink: 0;
}

.field-country {
  width: 115px;
  flex-shrink: 0;
}

.field-threshold {
  width: 155px;
  flex-shrink: 0;
}

.field-limit {
  width: 130px;
  flex-shrink: 0;
}

.btn-field { min-width: 130px; }
.btn-field-group {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-end !important;
  gap: 0.5rem !important;
  flex-shrink: 0 !important;
  width: auto !important;
}

.btn-field-group .btn {
  height: 38px;
  white-space: nowrap;
}

.screen-result-box {
  margin-top: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fafafa;
  overflow: hidden;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--white);
}

.verdict-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.88rem;
}

.verdict-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-green);
}

.verdict-banner.hit .verdict-indicator {
  background: var(--accent-red);
}

.score-badge {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
}

.result-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.result-body-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem;
  width: 100%;
}

.result-candidates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 0.75rem;
  width: 100%;
}

.match-item-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: var(--shadow-sm);
}

.match-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.match-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--fg);
}

.tag-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
  color: var(--fg-secondary);
}

.tag-badge.sanction {
  background: var(--accent-red-soft);
  color: var(--accent-red);
}

.confidence-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.confidence-pill.exact {
  background: #f5f3ff;
  color: #6366f1;
  border: 1px solid #c7d2fe;
}
.confidence-pill.very-high {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}
.confidence-pill.high {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}
.confidence-pill.medium {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}
.confidence-pill.low {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid #e2e8f0;
}
.confidence-pill.very-low {
  background: #f1f5f9;
  color: #94a3b8;
  border: 1px solid #cbd5e1;
}

.score-breakdown-tag {
  display: block;
  font-size: 0.65rem;
  color: var(--fg-muted);
  font-family: var(--font-mono, monospace);
  margin-top: 3px;
  cursor: help;
}

.screen-candidates-section {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.screen-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  gap: 1rem;
  flex-wrap: wrap;
}

.screen-table-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.screen-table-heading {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--fg);
}

/* ==========================================================================
   VSCode & Antigravity IDE Code Display Surface
   ========================================================================== */
.vscode-editor {
  background: #1e1e1e;
  border-radius: 12px;
  border: 1px solid #333333;
  overflow: hidden;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.45);
  font-family: var(--mono);
  width: 100%;
  display: flex;
  flex-direction: column;
}

.vscode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #252526;
  border-bottom: 1px solid #333333;
  gap: 1rem;
  flex-wrap: wrap;
}

.vscode-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.vscode-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
}

.vscode-dot.red { background: #ff5f56; }
.vscode-dot.yellow { background: #ffbd2e; }
.vscode-dot.green { background: #27c93f; }

.vscode-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #1e1e1e;
  border: 1px solid #383838;
  border-bottom: 1px solid #1e1e1e;
  border-radius: 6px 6px 0 0;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #e0e0e0;
  font-family: var(--mono);
  margin-bottom: -9px;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.2);
}

.vscode-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vscode-badge {
  font-size: 11px;
  color: #858585;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.vscode-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #d4d4d4;
  padding: 4px 11px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.vscode-copy-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

.vscode-copy-btn.copied {
  background: rgba(39, 201, 63, 0.2);
  color: #27c93f;
  border-color: rgba(39, 201, 63, 0.4);
}

.vscode-body {
  background: #1e1e1e;
  padding: 14px 0;
  margin: 0;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: #d4d4d4;
  overflow: auto;
  max-height: 520px;
}

.vscode-lines {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.vscode-line {
  display: flex;
  padding: 0 16px;
  min-height: 1.65em;
  width: 100%;
}

.vscode-line:hover {
  background: rgba(255, 255, 255, 0.04);
}

.vscode-editor .vscode-line-num,
.vscode-line-num {
  display: inline-block;
  width: 42px;
  padding-right: 18px;
  text-align: right;
  color: #6e7681 !important;
  user-select: none;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.vscode-editor .vscode-line-content,
.vscode-line-content {
  flex: 1;
  white-space: pre;
  word-break: normal;
  tab-size: 2;
  color: #d4d4d4 !important;
  font-size: 12.5px;
}

/* Syntax Highlighting Tokens (VSCode Dark+ Theme) */
.vscode-editor .syn-prop, .syn-prop { color: #9cdcfe !important; font-weight: 500; }
.vscode-editor .syn-str,  .syn-str  { color: #ce9178 !important; }
.vscode-editor .syn-num,  .syn-num  { color: #b5cea8 !important; }
.vscode-editor .syn-kw,   .syn-kw   { color: #569cd6 !important; font-weight: 600; }
.vscode-editor .syn-punct,.syn-punct{ color: #d4d4d4 !important; }
.vscode-editor .vscode-tab span { color: #e0e0e0 !important; }
.vscode-editor .vscode-badge { color: #858585 !important; }
.vscode-editor .vscode-copy-btn span { color: inherit !important; }

/* ==========================================================================
   Enterprise Data Table System (ui_table_skill.md)
   ========================================================================== */

.table-toolbar {
  padding: 0.85rem 1.25rem;
  background: #fafafa;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toolbar-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.toolbar-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--fg-muted);
}

.date-filter-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.date-inputs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.date-sep {
  font-size: 0.75rem;
  color: var(--fg-muted);
}

/* Quick Date Preset Buttons (ui_table_skill.md Section 2.3) */
.segmented-pills {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.pill-preset {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--fg-muted);
  transition: all 0.12s;
}

.pill-preset:hover {
  background: var(--bg-hover);
  color: var(--fg);
}

.pill-preset.active {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}

.pill-clear {
  color: var(--accent-red);
  border-color: var(--accent-red-soft);
}

/* 1-Click Page Size Selector (ui_table_skill.md Section 2.2) */
.page-size-selector {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.segmented-control {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 2px;
  background: var(--white);
}

.segmented-control .btn {
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  border-radius: var(--radius-pill);
  border: none;
}

.search-wrapper {
  flex: 1;
  min-width: 200px;
}

/* Table Surface (Relative positioning with Loading Backdrop) */
.table-surface-wrapper {
  position: relative;
  min-height: 250px;
}

/* Non-Blocking Loading Backdrop Overlay (ui_table_skill.md Section 2.5) */
.table-loading-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
  z-index: 10;
  display: grid;
  place-items: center;
}

.loading-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.95rem;
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow);
  font-size: 0.8rem;
  font-weight: 500;
}

/* Horizontal Responsive Scroller (ui_table_skill.md Section 2.6) */
.table-responsive {
  overflow-x: auto;
  width: 100%;
  -webkit-overflow-scrolling: touch;
}

#recordsTable {
  min-width: 840px;
}

#screenCandidatesTable {
  min-width: 700px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}

.data-table th {
  padding: 0.65rem 1rem;
  background: #fbfbfb;
  border-bottom: 1px solid var(--border);
  color: var(--fg-muted);
  font-weight: 600;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--fg-secondary);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.1s;
}

.data-table tbody tr:hover {
  background: #fcfcfc;
}

.source-badge {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-xs);
  background: var(--bg-soft);
  color: var(--fg);
}

.jurisdiction-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--white);
  line-height: 1;
  white-space: nowrap;
}

.pill .jurisdiction-tag {
  padding: 0.05rem 0.3rem;
  border: none;
  background: rgba(255, 255, 255, 0.75);
}

.flag-icon {
  width: 16px;
  height: 12px;
  border-radius: 2px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.35);
}

.flag-icon.square {
  width: 13px;
  height: 13px;
}

/* Card overflow visibility for floating dropdowns */
.table-card {
  overflow: visible !important;
}

.table-toolbar {
  position: relative;
  z-index: 25;
}

/* Custom Select Dropdown for Universal Flag Rendering */
.custom-select-wrapper {
  position: relative;
  min-width: 195px;
}

.custom-select-trigger {
  width: 100%;
  height: 32px;
  padding: 0 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
  color: var(--fg);
  text-align: left;
  user-select: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.custom-select-trigger:focus,
.custom-select-wrapper.is-open .custom-select-trigger {
  border-color: var(--black);
  box-shadow: 0 0 0 2px rgba(13, 13, 13, 0.08);
  outline: none;
}

.custom-select-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  flex: 1;
  min-width: 0;
}

.custom-select-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-chevron {
  flex-shrink: 0;
  color: var(--fg-muted);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.custom-select-wrapper.is-open .custom-select-chevron {
  transform: rotate(180deg);
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  width: max-content;
  max-width: 320px;
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.12), 0 8px 10px -6px rgba(0, 0, 0, 0.08);
  padding: 4px;
  max-height: 280px;
  overflow-y: auto;
  z-index: 1050;
  display: none;
  -webkit-overflow-scrolling: touch;
}

.custom-select-wrapper.is-open .custom-select-menu {
  display: block;
}

.custom-select-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.65rem;
  font-size: 0.78rem;
  color: var(--fg);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background 0.12s ease;
  user-select: none;
}

.custom-select-option:hover,
.custom-select-option:focus {
  background: var(--bg-soft);
  outline: none;
}

.custom-select-option.is-selected {
  background: #f1f5f9;
  font-weight: 600;
  color: var(--fg);
}

.custom-select-option .flag-icon {
  margin-right: 0.1rem;
}

.alias-count-pill {
  font-size: 0.72rem;
  font-family: var(--mono);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-pill);
  background: var(--bg-soft);
  font-weight: 600;
}

/* Empty State (ui_table_skill.md Section 6) */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  gap: 0.5rem;
}

.empty-title {
  font-weight: 600;
  font-size: 0.9rem;
}

.empty-desc {
  font-size: 0.78rem;
  color: var(--fg-muted);
  margin-bottom: 0.5rem;
}

/* Bottom Pagination Footer (ui_table_skill.md Section 4) */
.table-pagination-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--white);
  gap: 1rem;
  flex-wrap: wrap;
}

.pagination-info {
  font-size: 0.78rem;
  color: var(--fg-muted);
}

.pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 0.35rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--white);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--fg-secondary);
  transition: all 0.12s;
}

.page-btn:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--fg);
}

.page-btn.active {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-ellipsis {
  padding: 0 0.25rem;
  color: var(--fg-dim);
  font-size: 0.75rem;
}

/* Modal / Inspector Drawer */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 99;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.modal-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  max-width: 780px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-sub {
  font-size: 0.75rem;
  color: var(--fg-muted);
  font-family: var(--mono);
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.detail-row label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.detail-row > span {
  font-size: 0.88rem;
  color: var(--fg);
}

.alias-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* ==========================================================================
   API Specifications & Client Integration Modal (VS Code Themed)
   ========================================================================== */

.api-modal-card {
  max-width: 860px;
  width: 95%;
  max-height: 90vh;
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.api-modal-title-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.api-modal-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.6rem;
}

.http-badge {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.http-badge.post {
  background: #10b981;
  color: #ffffff;
}

.api-endpoint-text {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--fg);
}

.api-modal-body {
  padding: 1.15rem 1.35rem 1.35rem 1.35rem;
  gap: 1.15rem;
  overflow-y: auto;
}

/* Quick Info Bar */
.api-info-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
}

.api-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.api-info-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
}

.api-info-val {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.api-info-val.mono {
  font-family: var(--mono);
}

.tag-badge.ok {
  display: inline-block;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
}

/* VS Code Dark+ Window Surface */
.vscode-window {
  background: #1e1e1e;
  border: 1px solid #333333;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
}

.vscode-titlebar {
  background: #252526;
  border-bottom: 1px solid #181818;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.85rem;
  min-height: 40px;
  gap: 0.75rem;
  user-select: none;
}

.vscode-traffic-lights {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.vscode-traffic-lights .light {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.vscode-traffic-lights .light.red {
  background: #ff5f56;
}

.vscode-traffic-lights .light.yellow {
  background: #ffbd2e;
}

.vscode-traffic-lights .light.green {
  background: #27c93f;
}

.vscode-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}

.vscode-tabs::-webkit-scrollbar {
  display: none;
}

.vscode-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  background: #2d2d2d;
  color: #969696;
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  border: none;
  border-top: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.vscode-tab:hover {
  background: #232323;
  color: #cccccc;
}

.vscode-tab.active {
  background: #1e1e1e;
  color: #ffffff;
  border-top: 2px solid #007acc;
}

.tab-icon {
  color: #89d185;
}

.tab-badge-js {
  display: inline-block;
  background: #f7df1e;
  color: #000000;
  font-weight: 800;
  font-size: 9px;
  line-height: 1;
  padding: 2px 3px;
  border-radius: 2px;
}

.tab-badge-py {
  display: inline-block;
  background: #3572A5;
  color: #ffffff;
  font-weight: 800;
  font-size: 9px;
  line-height: 1;
  padding: 2px 3px;
  border-radius: 2px;
}

.tab-badge-json {
  display: inline-block;
  color: #e5c07b;
  font-weight: 800;
  font-size: 11px;
  line-height: 1;
}

.vscode-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.vscode-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cccccc;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.vscode-copy-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.vscode-copy-btn.copied {
  background: rgba(16, 185, 129, 0.25);
  border-color: #10b981;
  color: #10b981;
}

.vscode-editor-body {
  display: flex;
  background: #1e1e1e;
  min-height: 310px;
  max-height: 420px;
  overflow-y: auto;
  overflow-x: auto;
  font-family: 'JetBrains Mono', Consolas, Monaco, 'Courier New', monospace;
  font-size: 0.8125rem;
  line-height: 1.55;
  tab-size: 2;
}

.vscode-gutter {
  background: #1e1e1e;
  border-right: 1px solid #2d2d2d;
  color: #5a5a5a;
  text-align: right;
  padding: 0.85rem 0.65rem 0.85rem 0.5rem;
  user-select: none;
  font-size: 0.8125rem;
  line-height: 1.55;
  min-width: 44px;
  box-sizing: border-box;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.vscode-code {
  margin: 0;
  padding: 0.85rem 1rem;
  color: #d4d4d4;
  flex: 1;
  overflow-x: auto;
  white-space: pre;
  font-family: inherit;
  font-size: 0.8125rem;
  line-height: 1.55;
  tab-size: 2;
}

.vscode-code code {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* VS Code Dark+ Syntax Tokens */
.tk-kw { color: #c586c0; font-weight: 600; } /* Keywords: const, import, from, def, return */
.tk-fn { color: #dcdcaa; } /* Functions: fetch, log, post, dump */
.tk-str { color: #ce9178; } /* Strings */
.tk-prop { color: #9cdcfe; } /* Object keys / properties */
.tk-num { color: #b5cea8; } /* Numbers */
.tk-comment { color: #6a9955; font-style: italic; } /* Comments */
.tk-punct { color: #808080; } /* Delimiters */
.tk-cmd { color: #4ec9b0; font-weight: 600; } /* curl, python3 */
.tk-flag { color: #569cd6; } /* CLI flags */
.tk-var { color: #4fc1ff; } /* Variable names */
.tk-bool { color: #569cd6; font-weight: 600; } /* Booleans / null */

.api-modal-footer-note {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.95rem;
  font-size: 0.78rem;
  color: var(--fg-muted);
  line-height: 1.45;
}

.api-modal-footer-note strong {
  color: var(--fg);
}

.api-modal-footer-note code {
  font-family: var(--mono);
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  color: var(--primary);
  font-size: 0.76rem;
}

/* ==========================================================================
   Responsive Architecture for Tablets & Mobile Devices
   ========================================================================== */

/* Tablet & Landscape iPad Breakpoint (≤ 1024px) */
@media (max-width: 1024px) {
  .app-header {
    padding: 0.75rem 1.25rem;
  }

  .app-container {
    padding: 1.25rem 1.25rem 2.5rem 1.25rem;
    gap: 1.25rem;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }

  .kpi-card:nth-child(4),
  .kpi-card:nth-child(5) {
    grid-column: span 1;
  }

  .secondary-toolbar {
    flex-wrap: wrap;
  }

  .search-wrapper {
    min-width: 180px;
  }

  .modal-card {
    max-width: 90vw;
    max-height: 90vh;
  }
}

/* Portrait Tablets & Large Phones (≤ 768px) */
@media (max-width: 768px) {
  /* Toggle responsive text representations */
  .badge-text-full { display: none !important; }
  .badge-text-short { display: inline !important; }
  .btn-text-full { display: none !important; }
  .btn-text-short { display: inline !important; }

  /* Sticky Top Header */
  .app-header {
    padding: 0.6rem 1rem;
    gap: 0.5rem;
  }

  .brand-text .brand-tag {
    display: none;
  }

  .brand-title {
    font-size: 0.95rem;
  }

  .hero-badge-pill {
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    gap: 0.35rem;
  }

  .header-right {
    gap: 0.4rem;
  }

  .header-right .btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
  }

  /* App Container */
  .app-container {
    padding: 1rem 0.85rem 2.5rem 0.85rem;
    gap: 1.1rem;
  }

  /* KPI Grid */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }

  .kpi-card {
    padding: 0.85rem 1rem;
  }

  .kpi-card:last-child {
    grid-column: span 2;
  }

  .kpi-value {
    font-size: 1.45rem;
  }

  .kpi-value.kpi-sm {
    font-size: 1.05rem;
  }

  /* Card Headers */
  .card-head {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .card-head-title h3 {
    font-size: 0.92rem;
  }

  .section-desc {
    font-size: 0.74rem;
  }

  .card-body {
    padding: 1rem;
  }

  /* Screening Console Form */
  .screen-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    align-items: start !important;
  }

  .screen-form .field {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    gap: 0.35rem !important;
    width: 100% !important;
  }

  .screen-form .field-label {
    display: block !important;
    min-height: 18px !important;
    line-height: 18px !important;
    margin: 0 0 0.2rem 0 !important;
  }

  .flex-name {
    grid-column: 1 / -1;
    min-width: 0;
    width: 100%;
  }

  .field-dob,
  .field-country,
  .field-threshold,
  .field-limit {
    width: 100% !important;
    flex-shrink: 1 !important;
  }

  /* Exact uniform input dimensions across all fields on mobile */
  .screen-form .input,
  .screen-form select.input,
  .screen-form input[type="text"],
  .screen-form input[type="date"] {
    display: block !important;
    width: 100% !important;
    height: 46px !important;
    min-height: 46px !important;
    max-height: 46px !important;
    box-sizing: border-box !important;
    font-size: 16px !important; /* Prevents Safari auto-zoom */
    padding: 0 0.85rem !important;
    line-height: 44px !important;
    border-radius: var(--radius-sm) !important;
    border: 1px solid var(--border-strong) !important;
    background: var(--bg-input) !important;
    color: var(--fg) !important;
    -webkit-appearance: none !important;
    appearance: none !important;
  }

  /* Date input internal WebKit element reset for iOS Safari */
  .screen-form input[type="date"]::-webkit-date-and-time-value {
    min-height: 44px !important;
    line-height: 44px !important;
    height: 44px !important;
    text-align: left !important;
    display: flex !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  /* Threshold slider container & alignment */
  .field-threshold .slider {
    width: 100% !important;
    height: 46px !important;
    margin: 0 !important;
    cursor: pointer;
  }

  .btn-field-group {
    grid-column: 1 / -1;
    display: flex !important;
    flex-direction: row !important;
    gap: 0.65rem !important;
    width: 100% !important;
    margin-top: 0.35rem;
  }

  .btn-field-group .btn {
    flex: 1;
    height: 46px !important;
    min-height: 46px !important;
    font-size: 0.88rem;
    font-weight: 600;
  }

  /* Live Screening Results */
  .result-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
  }

  .result-header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .result-body-stack {
    padding: 0.85rem;
    gap: 1rem;
  }

  /* Candidates Table Toolbar */
  .screen-table-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem;
  }

  .screen-table-meta {
    width: 100%;
    justify-content: space-between;
  }

  .screen-candidates-section .page-size-selector {
    width: 100%;
    justify-content: space-between;
  }

  /* VSCode Code Surface */
  .vscode-editor {
    border-radius: 10px;
  }

  .vscode-header {
    padding: 6px 10px;
    gap: 0.5rem;
  }

  .vscode-badge {
    display: none;
  }

  .vscode-tab {
    padding: 3px 8px;
    font-size: 11px;
    margin-bottom: -7px;
  }

  .vscode-copy-btn {
    padding: 3px 8px;
    font-size: 11px;
  }

  .vscode-body {
    font-size: 11.5px;
    padding: 10px 0;
    max-height: 400px;
  }

  .vscode-line-num {
    width: 32px;
    padding-right: 10px;
    font-size: 11px;
  }

  .vscode-line-content {
    font-size: 11.5px;
  }

  /* Table Toolbars */
  .table-toolbar {
    padding: 0.75rem;
    gap: 0.85rem;
  }

  .date-filter-group {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    width: 100%;
  }

  .date-inputs {
    display: grid;
    grid-template-columns: auto 1fr auto 1fr;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
  }

  .date-inputs .input-sm,
  .date-inputs input[type="date"] {
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    font-size: 14px !important;
    box-sizing: border-box !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    padding: 0 0.65rem !important;
    line-height: 38px !important;
    width: 100% !important;
  }

  .date-inputs input[type="date"]::-webkit-date-and-time-value {
    min-height: 38px !important;
    line-height: 38px !important;
    height: 38px !important;
    text-align: left !important;
    display: flex !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .segmented-pills {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    width: 100%;
    scrollbar-width: none;
  }

  .segmented-pills::-webkit-scrollbar {
    display: none;
  }

  .pill-preset {
    flex-shrink: 0;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    min-height: 32px;
  }

  .secondary-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    width: 100%;
  }

  .search-wrapper {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
  }

  .jurisdiction-filter {
    grid-column: 1 / 2;
  }

  .category-filter {
    grid-column: 2 / 3;
  }

  .type-filter {
    grid-column: 1 / 2;
  }

  .secondary-toolbar .page-size-selector {
    grid-column: 2 / 3;
    justify-content: flex-end;
  }

  .secondary-toolbar .input-sm {
    min-height: 38px;
    font-size: 15px;
    width: 100%;
  }

  .secondary-toolbar .custom-select-trigger {
    min-height: 38px;
    font-size: 15px;
    width: 100%;
  }

  .custom-select-wrapper {
    width: 100%;
    min-width: 0;
  }

  .custom-select-menu {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
  }

  .custom-select-option {
    padding: 0.6rem 0.75rem;
    font-size: 0.84rem;
  }

  /* Pagination Footers */
  .table-pagination-footer {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.75rem;
    gap: 0.65rem;
  }

  .pagination-info {
    font-size: 0.75rem;
    order: 1;
  }

  .pagination-controls {
    order: 2;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3rem;
  }

  .page-btn {
    min-width: 34px;
    height: 34px;
    font-size: 0.8rem;
  }
}

/* Mobile Phones (≤ 640px) */
@media (max-width: 640px) {
  /* Minimal Top Header */
  .app-header {
    padding: 0.5rem 0.75rem;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .brand-mark svg {
    width: 14px;
    height: 14px;
  }

  .brand-title {
    font-size: 0.9rem;
  }

  .hero-badge-pill {
    padding: 0.2rem 0.5rem;
    font-size: 0.68rem;
  }

  .header-right .btn-sm {
    padding: 0.3rem 0.5rem;
    font-size: 0.72rem;
  }

  /* Main Container */
  .app-container {
    padding: 0.65rem 0.65rem 2rem 0.65rem;
    gap: 0.85rem;
  }

  /* Compact KPI 2-Column Grid */
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .kpi-card {
    padding: 0.65rem 0.75rem;
  }

  .kpi-meta {
    font-size: 0.68rem;
    margin-bottom: 0.15rem;
  }

  .kpi-value {
    font-size: 1.25rem;
  }

  .kpi-sub {
    font-size: 0.68rem;
    line-height: 1.3;
  }

  .kpi-card:last-child {
    grid-column: span 2;
  }

  .kpi-card:last-child .kpi-value.kpi-sm {
    font-size: 0.95rem;
  }

  /* Form Fields */
  .screen-form .form-row {
    gap: 0.5rem;
    align-items: start !important;
  }

  .field-label {
    font-size: 0.74rem;
  }

  /* Detail Inspector Drawer (Bottom Sheet) */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal-card {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-height: 92vh;
    margin: auto 0 0 0;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
  }

  .modal-head {
    padding: 0.85rem 1rem;
  }

  .modal-head h3 {
    font-size: 0.95rem;
  }

  #btnCloseModal,
  #btnCloseApiDocs {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    flex-shrink: 0;
  }

  .api-modal-card {
    max-height: 94vh;
  }

  .api-info-bar {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
  }

  .vscode-titlebar {
    padding: 0 0.5rem;
  }

  .vscode-tab {
    padding: 0.4rem 0.6rem;
    font-size: 0.72rem;
  }

  .modal-body {
    padding: 1rem;
    gap: 0.85rem;
    -webkit-overflow-scrolling: touch;
  }

  .alias-chips .pill {
    font-size: 0.72rem;
    padding: 0.25rem 0.5rem;
  }
}

/* Small / Compact Phones (≤ 480px) */
@media (max-width: 480px) {
  .app-header {
    padding: 0.45rem 0.5rem;
  }

  .header-left {
    gap: 0.4rem;
  }

  /* Extremely compact status pill for narrowest screens */
  .hero-badge-pill {
    padding: 0.2rem 0.35rem;
  }

  .hero-badge-pill .badge-text-short {
    display: none !important;
  }

  .header-right {
    gap: 0.3rem;
  }

  .header-right .btn svg {
    display: none;
  }

  .header-right .btn-sm {
    padding: 0.25rem 0.45rem;
    font-size: 0.7rem;
  }

  /* Stack Date Inputs on narrow mobile */
  .date-inputs {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .date-sep {
    display: none;
  }

  /* Stack secondary filters neatly */
  .secondary-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .jurisdiction-filter {
    grid-column: 1 / -1;
  }

  .secondary-toolbar .page-size-selector {
    grid-column: 1 / -1;
    justify-content: space-between;
  }

  .page-btn {
    min-width: 30px;
    height: 30px;
    font-size: 0.74rem;
    padding: 0 0.2rem;
  }

  .verdict-text {
    font-size: 0.8rem;
  }

  .score-badge {
    font-size: 0.74rem;
    padding: 0.2rem 0.45rem;
  }
}
