@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;600;700&display=swap');

:root {
  --primary-navy: #0d2847;
  --primary-navy-dark: #07192d;
  --primary-navy-light: #163d6b;
  --corporate-slate: #0f172a;
  --bg-slate: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-light: #e2e8f0;
  --border-subtle: #f1f5f9;
  --border-focus: #0d2847;

  --gold: #c59b27;
  --gold-hover: #b0891f;
  --gold-light: #dfb744;

  --danger-red: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fca5a5;
  --success-green: #10b981;
  --success-bg: #f0fdf4;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.03);
  --shadow-modal: 0 20px 45px rgba(15, 23, 42, 0.25);

  --font-sans: 'Cairo', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-card: 14px;
}

* {
  box-sizing: border-box;
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
}


/* ==========================================================================
   Smooth Institutional Scrollbars (Webkit & Firefox)
   ========================================================================== */
* {
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 #f1f5f9;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
  transition: background 0.15s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

html {
  overflow-x: hidden;
  max-width: 100vw;
  box-sizing: border-box;
}

body {
  background-color: var(--bg-slate);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  direction: rtl;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

.font-mono {
  font-family: var(--font-mono) !important;
}

/* ==========================================================================
   Header & Institutional Branding
   ========================================================================== */
.institutional-header {
  background: var(--primary-navy);
  border-bottom: 2px solid var(--gold);
  color: #ffffff;
  padding: 0.75rem 2rem;
  box-shadow: 0 4px 12px rgba(13, 40, 71, 0.15);
  width: 100%;
  box-sizing: border-box;
}

.header-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.brand-logo {
  height: 52px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-logo-card {
  background: #ffffff;
  padding: 4px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  height: 48px;
  flex-shrink: 0;
}

.brand-logo-jsmo {
  height: 40px;
  width: auto;
  object-fit: contain;
  display: block;
}

.brand-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
  color: #ffffff;
  letter-spacing: -0.2px;
}

.brand-text p {
  font-size: 0.8rem;
  margin: 0.2rem 0 0;
  color: #94a3b8;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.gov-badge {
  background: rgba(197, 155, 39, 0.15);
  border: 1px solid var(--gold);
  color: var(--gold-light);
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-block;
  white-space: nowrap;
}

/* ==========================================================================
   Main Layout & KPI Grid
   ========================================================================== */
.main-content {
  max-width: 1400px;
  margin: 1.5rem auto;
  padding: 0 1.5rem 3rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-card);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border-right: 4px solid #94a3b8;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px -2px rgba(15, 23, 42, 0.08);
}

.kpi-card-defects {
  border-right: 4px solid var(--danger-red);
  background: linear-gradient(135deg, #ffffff, #fffdfd);
}

.kpi-card-clean {
  border-right: 4px solid var(--success-green);
  background: linear-gradient(135deg, #ffffff, #fcfdfc);
}

.kpi-card-sampled {
  border-right: 4px solid var(--gold);
  background: linear-gradient(135deg, #ffffff, #fffefc);
}

.kpi-content {
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--corporate-slate);
  margin-top: 0.25rem;
  font-family: var(--font-mono);
  line-height: 1.1;
}

.kpi-icon {
  font-size: 2.2rem;
  opacity: 0.9;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.06));
}

.text-green {
  color: #10b981 !important;
}

.text-red {
  color: #ef4444 !important;
}

.text-gold {
  color: #d97706 !important;
}

.kpi-card-clean .kpi-value {
  color: #10b981;
}

.kpi-card-defects .kpi-value {
  color: #ef4444;
}

.kpi-card-sampled .kpi-value {
  color: #d97706;
}

.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem !important;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--bg-slate);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-light);
}

.empty-state::before {
  content: "📂";
  display: block;
  font-size: 2.25rem;
  margin-bottom: 0.75rem;
  opacity: 0.7;
}

.font-bold {
  font-weight: 700 !important;
}

.font-semibold {
  font-weight: 600 !important;
}

.text-xs {
  font-size: 0.75rem !important;
}

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

/* ==========================================================================
   Controls Bar & Action Panel
   ========================================================================== */
.controls-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-card);
  padding: 1.25rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 1.5rem;
}

/* ==========================================================================
   Government Portal Dynamic Filter Card
   ========================================================================== */
.gov-filter-card {
  padding: 1.25rem 1.5rem;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-top: 4px solid var(--primary-navy);
}

.gov-filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid #f1f5f9;
}

.gov-filter-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.filter-header-icon {
  font-size: 1.5rem;
  color: var(--primary-navy);
}

.gov-filter-heading {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary-navy);
}

.gov-filter-subheading {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.gov-filter-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.status-dot.offline {
  background: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

.controls-grid-filter {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.label-with-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-text-action {
  background: none;
  border: none;
  color: var(--primary-navy-light);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  transition: color 0.15s ease;
}

.btn-text-action:hover {
  color: var(--gold-dark);
}

.select-wrapper {
  position: relative;
  width: 100%;
}

.form-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230d2847' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: left 0.75rem center;
  background-size: 1rem;
  padding-left: 2rem !important;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

.form-input-sm {
  height: 32px;
  margin-top: 4px;
  font-size: 0.8rem;
}

/* Custom Gov Portal Importer Popover */
.custom-dropdown-container {
  position: relative;
  width: 100%;
}

.form-select-custom {
  width: 100%;
  height: 38px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0 0.85rem 0 2rem;
  font-size: 0.88rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--text-main);
  text-align: right;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230d2847' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: left 0.75rem center;
  background-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.form-select-custom:focus, .form-select-custom.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.importer-popover {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.18), 0 8px 10px -6px rgba(0, 0, 0, 0.12);
  z-index: 10000;
  overflow: hidden;
  direction: rtl;
}

.popover-search-box {
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
}

.search-icon {
  font-size: 0.95rem;
  color: #64748b;
}

.search-importer-input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
}

.search-importer-input:focus {
  border-color: #2563eb;
}

.importer-list-scroll {
  max-height: 280px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.importer-item {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background-color 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: right;
}

.importer-item:hover, .importer-item.active {
  background-color: #f1f5f9;
}

.importer-item-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
}

.importer-item-badges {
  display: flex;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 600;
}

.badge-pending {
  color: #2563eb;
}

.badge-transferred {
  color: #059669;
}

.btn-load-more {
  width: 100%;
  background: #f8fafc;
  border: none;
  border-top: 1px solid #e2e8f0;
  padding: 10px 0;
  color: #0d2847;
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  text-align: center;
  transition: background-color 0.12s ease;
}

.btn-load-more:hover {
  background: #e2e8f0;
}


.filter-actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.25rem;
  padding: 1rem;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
  margin-bottom: 1.25rem;
}

.token-compact-wrapper {
  flex: 1;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.btn-save-token-compact {
  height: 38px;
  margin-right: 0.5rem;
  white-space: nowrap;
}

.action-buttons-wrapper {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.btn-dynamic-pull {
  background: #0d2847 !important;
  border: 1px solid #c59b27 !important;
  box-shadow: 0 4px 12px rgba(13, 40, 71, 0.2);
  white-space: nowrap;
  font-weight: 800;
}

.btn-dynamic-pull:hover {
  background: #163d6b !important;
  box-shadow: 0 6px 16px rgba(13, 40, 71, 0.28);
}

.btn-mobile-sync {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: var(--primary-navy);
  font-weight: 700;
  white-space: nowrap;
  height: 38px;
  border-radius: var(--radius-sm);
  padding: 0 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.btn-mobile-sync:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.btn-gov-import {
  background: #ecfdf5;
  border: 1px solid #10b981;
  color: #065f46;
  font-weight: 700;
  white-space: nowrap;
  height: 38px;
  border-radius: var(--radius-sm);
  padding: 0 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.btn-gov-import:hover {
  background: #d1fae5;
  border-color: #059669;
}

.btn-paste-clipboard {
  background: #f5f3ff;
  border: 1px solid #8b5cf6;
  color: #5b21b6;
  font-weight: 700;
  white-space: nowrap;
  font-size: 0.85rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.btn-paste-clipboard:hover {
  background: #ede9fe;
  border-color: #7c3aed;
}

.data-source-indicator {
  display: inline-flex;
  align-items: center;
}

.source-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}

.pill-demo {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.pill-live {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.pill-gov-file {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #7dd3fc;
}

.secondary-tools-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-end;
  padding-top: 0.5rem;
}

.btn-sm {
  height: 32px;
  padding: 0 0.85rem;
  font-size: 0.78rem;
}

.hidden {
  display: none !important;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  align-items: flex-end;
}


.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.control-group-supplier {
  flex: 1;
  min-width: 180px;
}

.control-group-token {
  flex: 2;
  min-width: 280px;
}

.btn-spec-matcher {
  background: #163d6b !important;
  white-space: nowrap;
}

.control-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-navy);
}

.form-input {
  height: 38px;
  padding: 0 0.85rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--text-main);
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus {
  border-color: var(--primary-navy);
  box-shadow: 0 0 0 2px rgba(13, 40, 71, 0.1);
}

.token-input-wrapper {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.token-field-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.token-input {
  width: 100%;
  padding-left: 2.2rem;
}

.btn-toggle-token {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  font-size: 1rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.btn-toggle-token:hover {
  color: var(--primary-navy);
  background-color: rgba(0, 0, 0, 0.06);
}

.btn-primary {
  height: 38px;
  background: var(--primary-navy);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 1.25rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: var(--primary-navy-light);
}

.btn-gold {
  height: 38px;
  background: var(--gold);
  color: var(--primary-navy-dark);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 1.25rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.15s ease;
}

.btn-gold:hover {
  background: var(--gold-hover);
}

.sample-control {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-slate);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.sample-control input[type=range] {
  accent-color: var(--gold);
  cursor: pointer;
}

/* ==========================================================================
   Table & Tabs Section
   ========================================================================== */
.table-card {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.table-toolbar {
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
}

.tabs-group {
  display: inline-flex;
  gap: 0.35rem;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0.45rem 1.15rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  line-height: 1.2;
}

.tab-btn:hover {
  color: var(--primary-navy);
  background: rgba(255, 255, 255, 0.7);
}

.tab-btn.active {
  background: #ffffff;
  color: var(--primary-navy);
  border-color: rgba(0, 0, 0, 0.05);
  box-shadow: 0 2px 6px rgba(13, 40, 71, 0.08), 0 1px 2px rgba(13, 40, 71, 0.04);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.jsmo-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 0.88rem;
}

.jsmo-table th {
  background: #f1f5f9;
  color: var(--primary-navy);
  font-weight: 800;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.jsmo-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.row-defect {
  background: #fffafa;
}

.row-defect:hover {
  background: #fee2e2;
}

.row-clean:hover {
  background: #f8fafc;
}

.cell-center {
  text-align: center;
}

.cell-vin {
  font-size: 0.95rem;
  color: var(--corporate-slate);
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-gold {
  background: #fef3c7;
  color: #92400e;
  margin-right: 0.4rem;
}


.cell-findings {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-start;
  justify-content: center;
  min-height: 38px;
}

.cell-note {
  min-width: 220px;
  max-width: 340px;
}

.deck-btn-sm {
  background: #163d6b;
  color: #ffffff;
  border: 1px solid #163d6b;
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.deck-btn-sm:hover {
  background: #1e528f;
  transform: translateY(-1px);
}

.deck-btn-sm.deck-btn-gold {
  background: var(--gold);
  color: #07192d;
  border-color: #b0891f;
}

.deck-btn-sm.deck-btn-gold:hover {
  background: var(--gold-hover);
}

.btn-action-primary {
  background: var(--primary-navy);
  color: #ffffff;
  border: none;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.15s ease;
}

.btn-action-primary:hover {
  background: var(--primary-navy-light);
  transform: translateY(-1px);
}

.btn-action-secondary {
  background: #e2e8f0;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.15s ease;
}

.btn-action-secondary:hover {
  background: #cbd5e1;
  transform: translateY(-1px);
}

.suggest-badge {
  font-size: 0.75rem;
  color: #0369a1;
  background: #e0f2fe;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
  display: inline-block;
}

.finding-tag {
  color: #b91c1c;
  font-weight: 700;
  font-size: 0.8rem;
}

.note-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  font-size: 0.82rem;
  color: #334155;
}

.btn-copy-note {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.cell-actions {
  white-space: nowrap;
}

.actions-group {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #f1f5f9;
  padding: 3px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.btn-action {
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.btn-action:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.btn-action-ov,
.btn-open-ov {
  background: var(--primary-navy);
  color: #ffffff;
}

.btn-action-edit,
.btn-open-edit {
  background: #334155;
  color: #ffffff;
}

.btn-action-drawer,
.btn-open-drawer {
  background: #1e3a8a;
  color: #ffffff;
}

.btn-action-gold,
.btn-open-gov {
  background: var(--gold);
  color: #07192d;
}

/* ==========================================================================
   4-Tile Visual Canvas Overlay (#_ov)
   ========================================================================== */
#_ov {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: rgba(7, 25, 45, 0.97);
  display: flex;
  flex-direction: column;
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  box-sizing: border-box;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.visual-overlay-hidden {
  display: none !important;
}

.ov-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.ov-header-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.ov-badge-seq {
  background: var(--gold);
  color: #07192d;
  font-weight: 900;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  font-size: 0.95rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ov-title-vin {
  font-size: 1.15rem;
}

.ov-counter {
  color: #94a3b8;
  font-size: 0.88rem;
}

.ov-header-actions {
  display: flex;
  gap: 0.5rem;
}

.deck-btn {
  background: #163d6b;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.45rem 0.95rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.deck-btn:hover:not(:disabled) {
  background: #1e528f;
  transform: translateY(-1px);
}

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

.deck-btn-gold {
  background: var(--gold);
  color: #07192d;
  border: none;
}

.deck-btn-gold:hover:not(:disabled) {
  background: var(--gold-hover);
}

.deck-btn-danger {
  background: #dc2626;
  border: none;
}

.deck-btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.ov-deck-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  flex: 1;
  min-height: 0;
  margin-top: 0.75rem;
  overflow: hidden;
}

.deck-tile {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tile-bar {
  padding: 0.5rem 0.85rem;
  background: rgba(13, 40, 71, 0.95);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.tile-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
}

.tile-tag-red {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dc2626;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.tile-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tile-tools {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  flex-shrink: 0;
}

.tool-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  backdrop-filter: blur(4px);
  transition: all 0.15s ease;
  user-select: none;
}

.tool-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

.tool-btn:active {
  transform: translateY(0);
  background: rgba(255, 255, 255, 0.3);
}

.tile-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #050b14;
  min-height: 0;
}

.deck-canvas {
  width: 100%;
  height: 100%;
  cursor: grab;
  display: block;
}

.no-img-placeholder {
  color: #94a3b8;
  font-size: 0.85rem;
  text-align: center;
  padding: 2rem;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
}

.deck-tile-report {
  background: #ffffff;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.deck-tile-report .tile-bar {
  background: #0d2847;
  color: #ffffff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.forensic-card-body {
  flex: 1;
  min-height: 0;
  padding: 1rem 1.25rem;
  overflow-y: auto;
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
}

.forensic-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid #f1f5f9;
  border-radius: 4px;
  transition: background 0.12s ease;
}

.forensic-item:hover {
  background: #f8fafc;
}

.forensic-item .lbl {
  color: #64748b;
  font-weight: 600;
  font-size: 0.85rem;
}

.forensic-item .val {
  font-weight: 700;
  color: #0f172a;
  font-size: 0.92rem;
  text-align: left;
}

.proposal-box {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border-width: 1.5px;
  border-style: solid;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.proposal-box-issue {
  background: #fff5f5;
  border-color: #fca5a5;
}

.proposal-box-clean {
  background: #f0fdf4;
  border-color: #86efac;
}

.proposal-title {
  font-weight: 800;
  font-size: 0.88rem;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.proposal-box-issue .proposal-title {
  color: #b91c1c;
}

.proposal-box-clean .proposal-title {
  color: #15803d;
}

.proposal-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
  background: #ffffff;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  border: 1px dashed #cbd5e1;
  margin-bottom: 0.75rem;
  word-break: break-word;
}

.proposal-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.btn-deck-copy {
  flex: 1;
  min-width: 135px;
  background: #163d6b;
  color: #ffffff;
  border: 1px solid #163d6b;
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(22, 61, 107, 0.2);
}

.btn-deck-copy:hover {
  background: #1e528f;
  transform: translateY(-1px);
  box-shadow: 0 3px 6px rgba(22, 61, 107, 0.25);
}

.btn-deck-copy:active {
  transform: translateY(0);
}

.btn-deck-edit-vin {
  flex: 1.2;
  min-width: 175px;
  background: linear-gradient(135deg, #c59b27, #dfb744);
  color: #07192d;
  border: 1px solid #b0891f;
  padding: 0.55rem 0.85rem;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
  box-shadow: 0 1px 3px rgba(197, 155, 39, 0.25);
}

.btn-deck-edit-vin:hover {
  background: linear-gradient(135deg, #dfb744, #e8c65e);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(197, 155, 39, 0.35);
}

.btn-deck-edit-vin:active {
  transform: translateY(0);
}

/* Adaptive Layout for Overlay on Tablets & Mobile */
@media (max-width: 1024px) {
  #_ov {
    overflow-y: auto;
    height: 100vh;
    padding: 0.75rem;
  }

  .ov-deck-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    overflow-y: visible;
    flex: none;
    min-height: auto;
    gap: 1rem;
  }

  .deck-tile {
    min-height: 380px;
    height: 400px;
  }
}

@media (max-width: 640px) {
  #_ov {
    padding: 0.5rem;
  }

  .ov-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .ov-header-info {
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: space-between;
  }

  .ov-header-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
  }

  .deck-btn {
    padding: 0.45rem 0.5rem;
    font-size: 0.8rem;
    text-align: center;
    justify-content: center;
  }

  .deck-tile {
    min-height: 340px;
    height: 360px;
  }
}

/* ==========================================================================
   Modals Common System & Accessibility
   ========================================================================== */
.modal-backdrop,
#modal-17box,
#modal-action-drawer,
#modal-spec-matcher {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.modal-backdrop-hidden,
#modal-17box.modal-backdrop-hidden,
#modal-action-drawer.modal-backdrop-hidden,
#modal-spec-matcher.modal-backdrop-hidden,
.modal-backdrop-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.modal-card {
  background: #ffffff;
  border-radius: 14px;
  width: 900px;
  max-width: 96vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
  border: 1px solid var(--border-light);
  transform: scale(1) translateY(0);
  opacity: 1;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.modal-backdrop-hidden .modal-card {
  transform: scale(0.95) translateY(12px);
  opacity: 0;
}

.modal-header {
  background: var(--primary-navy);
  color: #fff;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  border-bottom: 2px solid var(--gold);
}

.modal-title {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-close-modal {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.35rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
  line-height: 1;
}

.btn-close-modal:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-desc {
  font-size: 0.88rem;
  color: #475569;
  margin: 0 0 1rem 0;
  line-height: 1.6;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background: #f8fafc;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* ==========================================================================
   17-Box VIN Editor Modal
   ========================================================================== */
.vin-17-container {
  width: 100%;
  overflow-x: auto;
  padding: 0.5rem 0.25rem 0.75rem;
  margin: 1rem 0;
  -webkit-overflow-scrolling: touch;
}

.vin-17-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 10px;
  min-width: min-content;
}

.vin-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 8px 10px 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 0.15s ease;
}

.vin-group:hover {
  border-color: #cbd5e1;
}

.vin-group-wmi {
  border-top: 3px solid #64748b;
}

.vin-group-vds {
  border-top: 3px solid var(--gold);
  background: #fdfdf9;
}

.vin-group-vis {
  border-top: 3px solid var(--primary-navy-light);
}

.vin-group-label {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--primary-navy-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  font-family: var(--font-mono);
}

.vin-group-boxes {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.vin-box-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 38px;
  position: relative;
}

.vin-box-idx {
  font-size: 0.72rem;
  color: #94a3b8;
  font-weight: 700;
  font-family: var(--font-mono);
}

.vin-char-input {
  width: 40px;
  height: 48px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
  border: 2px solid var(--border-light);
  border-radius: 6px;
  outline: none;
  text-transform: uppercase;
  background: #ffffff;
  color: var(--text-main);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.vin-char-input:focus {
  border-color: var(--primary-navy);
  box-shadow: 0 0 0 3px rgba(13, 40, 71, 0.15);
  background: #ffffff;
}

/* 9th Check Digit Distinct Highlight */
.vin-check-digit-wrapper {
  position: relative;
}

.vin-check-digit-idx {
  color: #b45309 !important;
  font-weight: 900 !important;
}

.vin-char-input.vin-check-digit-box {
  border-color: var(--gold) !important;
  background: #fffbeb !important;
  color: #92400e !important;
  box-shadow: 0 0 0 2px rgba(197, 155, 39, 0.35);
}

.vin-char-input.vin-check-digit-box:focus {
  border-color: #b45309 !important;
  box-shadow: 0 0 0 3px rgba(197, 155, 39, 0.55);
}

.vin-check-digit-indicator {
  font-size: 0.65rem;
  font-weight: 800;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 4px;
  padding: 1px 5px;
  margin-top: 2px;
  white-space: nowrap;
  letter-spacing: -0.2px;
}

.vin-validation-banner {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.check-digit-badge {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border: 1px solid transparent;
  line-height: 1.4;
}

.check-digit-badge.badge-success {
  background: #f0fdf4;
  color: #166534;
  border-color: #86efac;
}

.check-digit-badge.badge-danger {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fca5a5;
}

.check-digit-badge.badge-warning {
  background: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}

.suggestion-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
}

.suggestion-pill:empty {
  display: none !important;
}

.btn-apply-suggestion {
  background: #0284c7;
  color: #ffffff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.btn-apply-suggestion:hover {
  background: #0369a1;
  transform: translateY(-1px);
}

.gov-nav-tip {
  margin-top: 1.25rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.85rem;
  color: #475569;
}

.tip-title {
  font-weight: 800;
  color: var(--primary-navy);
  margin-bottom: 0.4rem;
}

.tip-steps {
  margin: 0;
  padding-right: 1.25rem;
  line-height: 1.6;
}

/* ==========================================================================
   Action Drawer Modal (#modal-action-drawer)
   ========================================================================== */
.anti-approval-banner {
  background: linear-gradient(135deg, #0d2847 0%, #07192d 100%);
  border: 2px solid var(--gold);
  border-radius: var(--radius-md);
  color: #ffffff;
  padding: 0.85rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 4px 12px rgba(13, 40, 71, 0.18);
}

.anti-approval-icon {
  font-size: 1.35rem;
  flex-shrink: 0;
}

.anti-approval-banner strong {
  color: var(--gold-light);
}

.action-section {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.action-section:last-child {
  margin-bottom: 0;
}

.action-section h4 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary-navy);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.action-section.action-section-danger {
  background: #fffafa;
  border: 1.5px solid var(--danger-border);
  border-right: 4px solid var(--danger-red);
}

.action-section-danger h4 {
  color: #b91c1c;
}

.action-note-box {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: #f8fafc;
  border: 1px dashed #94a3b8;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

#_drawerNoteText {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.92rem;
  line-height: 1.4;
  word-break: break-word;
}

.rejection-warning {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  border-right: 4px solid var(--danger-red);
  color: #991b1b;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.action-rejection-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* ==========================================================================
   Spec Matcher Modal (#modal-spec-matcher) & Utility Classes
   ========================================================================== */
.spec-kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
  gap: 0.75rem !important;
  margin-bottom: 1rem !important;
}

.spec-table-container {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: #ffffff;
}

.spec-table-container thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f1f5f9;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Color utility classes */
.text-green {
  color: var(--success-green) !important;
}

.text-yellow {
  color: #d97706 !important;
}

.text-red {
  color: var(--danger-red) !important;
}

.text-blue {
  color: #0284c7 !important;
}

/* Disabled button states */
button:disabled,
.btn-gold:disabled,
.btn-primary:disabled,
.deck-btn:disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  filter: grayscale(60%) !important;
  box-shadow: none !important;
}

/* Responsive Breakpoints for Modals */
@media (max-width: 768px) {
  .modal-card {
    width: 100% !important;
    max-width: 98vw !important;
    border-radius: 10px;
  }
  .modal-body {
    padding: 1rem;
  }
  .vin-char-input {
    width: 36px;
    height: 44px;
    font-size: 1.15rem;
  }
  .vin-box-wrapper {
    min-width: 34px;
  }
  .vin-group {
    padding: 6px 6px 8px;
  }
  .vin-group-boxes {
    gap: 4px;
  }
}

/* ==========================================================================
   Focus Visible Rings & Interactive States
   ========================================================================== */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(13, 40, 71, 0.25) !important;
}

.btn-gold:focus-visible,
.deck-btn-gold:focus-visible,
.btn-action-gold:focus-visible {
  box-shadow: 0 0 0 3px rgba(197, 155, 39, 0.45) !important;
}

.deck-btn-danger:focus-visible {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.45) !important;
}

.btn-primary:active,
.btn-gold:active,
.deck-btn:active,
.btn-action:active,
.btn-action-primary:active,
.btn-action-secondary:active,
.btn-action-gold:active {
  transform: translateY(1px);
}

/* ==========================================================================
   Comprehensive Responsive Breakpoints (Tablet < 1024px & Mobile < 768px)
   ========================================================================== */
@media (max-width: 1024px) {
  .institutional-header {
    padding: 0.75rem 1.25rem;
  }

  .main-content {
    padding: 0 1rem 2.5rem;
    margin: 1.25rem auto;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .controls-row {
    gap: 1rem;
  }

  .modal-card {
    width: 94vw;
  }
}

@media (max-width: 768px) {
  .institutional-header {
    padding: 0.75rem 1rem;
    width: 100%;
    box-sizing: border-box;
  }

  .header-container {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    width: 100%;
  }

  .header-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
  }

  .brand-logo {
    height: 38px;
    width: auto;
    flex-shrink: 0;
  }

  .brand-logo-card {
    height: 34px;
    padding: 2px 6px;
    flex-shrink: 0;
  }

  .brand-logo-jsmo {
    height: 28px;
  }

  .brand-text {
    flex: 1;
    min-width: 0;
  }

  .brand-text h1 {
    font-size: 0.95rem;
    line-height: 1.35;
    margin: 0;
    white-space: normal;
  }

  .brand-text p {
    font-size: 0.68rem;
    line-height: 1.25;
    margin: 2px 0 0;
  }

  .header-meta {
    width: 100%;
    display: flex;
    justify-content: stretch;
  }

  .gov-badge {
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    padding: 0.45rem 0.65rem;
    white-space: normal;
    display: block;
    box-sizing: border-box;
    line-height: 1.35;
    border-radius: 8px;
  }

  .main-content {
    padding: 0 0.75rem 2rem;
    margin: 1rem auto;
    width: 100%;
    box-sizing: border-box;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .modal-body .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .controls-card {
    padding: 1rem;
  }

  .gov-filter-card {
    padding: 1rem;
  }

  .gov-filter-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .controls-grid-filter {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .filter-actions-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 0.85rem;
  }

  .token-compact-wrapper {
    max-width: 100%;
    width: 100%;
  }

  .action-buttons-wrapper {
    flex-direction: column;
    width: 100%;
    gap: 0.65rem;
  }

  .btn-dynamic-pull,
  .btn-mobile-sync,
  .btn-gov-import,
  .btn-paste-clipboard {
    width: 100%;
    justify-content: center;
  }

  .secondary-tools-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .controls-row {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .control-group {
    width: 100% !important;
    min-width: 0 !important;
  }


  .control-group-supplier,
  .control-group-token {
    width: 100% !important;
    min-width: 0 !important;
    flex: none !important;
  }

  .token-input-wrapper {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    width: 100%;
  }

  .token-field-container {
    width: 100%;
  }

  .token-input-wrapper #btnSaveToken {
    width: 100%;
    justify-content: center;
  }

  .sample-control {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .table-toolbar {
    flex-direction: column;
    gap: 0.75rem;
    align-items: stretch;
    padding: 0.75rem 1rem;
  }

  .tabs-group {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .tab-btn {
    white-space: nowrap;
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
  }

  .jsmo-table th,
  .jsmo-table td {
    padding: 0.65rem 0.65rem;
  }

  .cell-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
  }

  .actions-group {
    flex-wrap: wrap;
    justify-content: center;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer .deck-btn,
  .modal-footer .btn-primary {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .action-note-box {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .action-note-box button {
    width: 100%;
  }
}
