/* Cairo font — self-hosted for full offline capability */
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('../fonts/Cairo/Cairo-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('../fonts/Cairo/Cairo-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Cairo';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('../fonts/Cairo/Cairo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

  :root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #e8f0fe;
    --success: #34a853;
    --warning: #fbbc04;
    --danger: #ea4335;
    --bg: #f8f9fa;
    --card: #ffffff;
    --text: #202124;
    --text-secondary: #5f6368;
    --border: #dadce0;
    --border-color: #dadce0;
    --text-muted: #9e9e9e;
    --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
    --radius: 12px;

    /* Sprint 3: Spacing tokens */
    --space-1: 4px;  --space-2: 8px;   --space-3: 12px;
    --space-4: 16px; --space-6: 24px;  --space-8: 32px; --space-12: 48px;

    /* Sprint 3: Typography tokens */
    --text-xs: 11px; --text-sm: 13px; --text-base: 15px;
    --text-lg: 17px; --text-xl: 20px; --text-2xl: 24px; --text-3xl: 32px;

    /* Sprint 3: Z-index scale */
    --z-base: 1; --z-dropdown: 100; --z-modal: 200; --z-toast: 300;
  }

  * { margin: 0; padding: 0; box-sizing: border-box; }

  body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    direction: rtl;
  }

  /* Sidebar */
  .sidebar {
    position: fixed;
    right: 0; top: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, #1a237e 0%, #283593 100%);
    color: white;
    padding: 0;
    z-index: 100;
    overflow-y: auto;
    transition: width 0.3s;
    display: flex;
    flex-direction: column;
  }

  .sidebar-header {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.15);
  }

  .sidebar-header h2 { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
  .sidebar-header small { font-size: 12px; opacity: 0.8; }

  .sidebar-logo {
    font-size: 40px;
    margin-bottom: 8px;
    display: block;
  }

  .nav-menu { padding: 12px 0; flex: 1; }

  .nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 600;
    border-right: 3px solid transparent;
  }

  .nav-item:hover, .nav-item:focus-visible { background: rgba(255,255,255,0.1); }
  .nav-item.active {
    background: rgba(255,255,255,0.15);
    border-right-color: #64b5f6;
  }

  .nav-item .icon { font-size: 20px; width: 28px; text-align: center; }

  /* Main content */
  .main-content {
    margin-right: 260px;
    padding: 24px 32px;
    min-height: 100vh;
  }

  .page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
  }

  .page-header h1 { font-size: 24px; font-weight: 700; }

  /* Cards */
  .card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
  }

  .card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    gap: 8px;
  }

  /* Stats */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
  }

  .stat-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
  }

  .stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
  }

  .stat-icon.blue { background: #e3f2fd; }
  .stat-icon.green { background: #e8f5e9; }
  .stat-icon.orange { background: #fff3e0; }
  .stat-icon.purple { background: #f3e5f5; }

  .stat-value { font-size: 28px; font-weight: 800; }
  .stat-label { font-size: 13px; color: var(--text-secondary); }

  /* Forms */
  .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
  }

  .form-group { margin-bottom: 16px; }
  .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
  }

  .form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    transition: border-color 0.2s;
    direction: rtl;
  }

  .form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
  }

  .btn:focus-visible,
  button:focus-visible,
  a:focus-visible,
  input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
  }

  /* Buttons */
  .btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }

  .btn-primary { background: var(--primary); color: white; }
  .btn-primary:hover { background: var(--primary-dark); }
  .btn-success { background: var(--success); color: white; }
  .btn-success:hover { background: #2d9249; }
  .btn-danger { background: var(--danger); color: white; }
  .btn-danger:hover { background: #d33426; }
  .btn-secondary { background: #e8eaed; color: var(--text); }
  .btn-secondary:hover { background: #d2d5da; }
  .btn-sm { padding: 6px 14px; font-size: 12px; min-height: 44px; }

  .btn-group { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

  /* Table */
  .table-container { overflow-x: auto; }

  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
  }

  table th {
    background: #f1f3f4;
    padding: 12px 14px;
    text-align: right;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 12px;
    white-space: nowrap;
  }

  table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f3f4;
  }

  table tr:hover { background: #f8f9fa; }

  .badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
  }

  .badge-pending { background: #fff3e0; color: #e65100; }
  .badge-entered { background: #e3f2fd; color: #1565c0; }
  .badge-done { background: #e8f5e9; color: #2e7d32; }
  .badge-rejected { background: #fce4ec; color: #c62828; }
  .badge-paid { background: #e3f2fd; color: #1565c0; }
  .badge-partial { background: #fff8e1; color: #f57f17; }
  .badge-high { background: #fce4ec; color: #c62828; }
  .badge-low { background: #e8f5e9; color: #2e7d32; }

  /* Critical Value Alerts */
  .critical-banner {
    background: #fce4ec; border: 2px solid #ef9a9a; border-radius: 10px;
    padding: 14px 18px; margin-bottom: 16px; font-size: 13px;
  }
  .critical-item {
    padding: 6px 0; border-bottom: 1px solid #ef9a9a;
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
  }
  .critical-item:last-child { border-bottom: none; }
  .critical-alert {
    display: inline-block; background: #c62828; color: #fff;
    padding: 1px 8px; border-radius: 4px; font-size: 11px; font-weight: 700;
    animation: critBlink 1s infinite;
  }
  @keyframes critBlink { 50% { opacity: 0.6; } }
  .critical-input { border-color: #c62828 !important; background: #fff5f5 !important; }
  .critical-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: #c62828; margin-right: 4px; animation: critBlink 1s infinite;
  }
  .critical-alerts-card { border: 2px solid #ef9a9a; }
  .row-critical { background: #fff5f5 !important; }
  .stat-icon.red { background: #fce4ec; color: #c62828; }

  /* Rejection Banner */
  .rejection-banner {
    background: #fce4ec; border: 1px solid #ef9a9a; border-radius: 8px;
    padding: 10px 14px; margin-top: 8px; color: #c62828; font-size: 13px;
  }

  /* Delta-check */
  .delta-info { font-size: 11px; color: var(--text-secondary); margin-top: 2px; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
  .delta-label { color: #666; }
  .delta-pct { margin-right: 6px; font-weight: 600; color: var(--primary); }
  .delta-pct.delta-warn { color: #c62828; font-weight: 800; }

  /* Sparkline */
  .sparkline-container { display: inline-flex; align-items: center; flex-shrink: 0; }
  .sparkline-svg { vertical-align: middle; border-radius: 3px; background: #fafafa; }

  /* Amended badge */
  .amended-badge {
    display: inline-block; background: #fff3e0; color: #e65100;
    padding: 0 6px; border-radius: 4px; font-size: 10px; font-weight: 700; margin-right: 4px;
  }
  .badge-normal { background: #f5f5f5; color: #616161; }

  /* Test panels */
  .test-panel {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
  }

  .test-panel-header {
    background: #f1f3f4;
    padding: 10px 16px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .test-panel-header:hover { background: #e8eaed; }

  .test-panel-body { padding: 16px; display: none; }
  .test-panel.open .test-panel-body { display: block; }

  .test-row {
    display: grid;
    grid-template-columns: 1fr 120px 150px 80px;
    gap: 12px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
    font-size: 13px;
  }

  .test-row:last-child { border-bottom: none; }
  .test-name { font-weight: 600; }
  .test-range { color: var(--text-secondary); font-size: 11px; }

  .result-input {
    padding: 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    width: 100%;
    text-align: center;
  }

  .result-flag { font-weight: 700; font-size: 12px; text-align: center; }

  /* Modal */
  .modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding: 40px;
    z-index: 200;
    overflow-y: auto;
  }

  .modal-overlay.show { display: flex; }

  .modal {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 900px;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
  }

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

  .modal-header h3 { font-size: 18px; }

  .modal-close {
    width: 32px; height: 32px;
    min-width: 44px; min-height: 44px;
    border: none; background: #f1f3f4;
    border-radius: 50%; cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .modal-body { padding: 24px; }

  /* Search */
  .search-box {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
  }

  .search-box input {
    flex: 1;
    padding: 10px 16px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-size: 14px;
  }

  /* Tabs */
  .tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
  }

  .tab {
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
  }

  .tab:hover, .tab:focus-visible { color: var(--primary); }
  .tab.active { color: var(--primary); border-bottom-color: var(--primary); }

  /* Page sections */
  .page-section { display: none; }
  .page-section.active { display: block; }

  /* Checkbox group */
  .checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
  }

  .checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
  }

  .checkbox-item:hover, .checkbox-item:focus-within { background: var(--primary-light); }
  .checkbox-item.checked { background: var(--primary-light); border-color: var(--primary); }
  .checkbox-item input { margin: 0; }

  /* Print styles */
  @media print {
    .sidebar, .nav-menu, .btn, .search-box, .page-header .btn, .no-print { display: none !important; }
    .main-content { margin-right: 0 !important; padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd; page-break-inside: avoid; }
    .modal-overlay { position: static !important; display: block !important; padding: 0 !important; background: none !important; }
    .modal { max-height: none !important; box-shadow: none !important; }
    body { font-size: 11px; }
    .print-header { display: block !important; text-align: center; margin-bottom: 20px; }
    .result-flag.high-flag { color: red !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  }

  .print-header { display: none; }

  /* Toast */
  .toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    z-index: 300;
    opacity: 0;
    transition: opacity 0.3s;
    font-family: 'Cairo', sans-serif;
  }

  .toast.show { opacity: 1; }
  .toast-success { background: var(--success); }
  .toast-error { background: var(--danger); }

  /* Charts area */
  .chart-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  .mini-chart {
    height: 200px;
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 16px;
  }

  .chart-bar {
    flex: 1;
    background: var(--primary);
    border-radius: 4px 4px 0 0;
    min-height: 8px;
    position: relative;
    transition: height 0.5s;
  }

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

  .chart-label {
    font-size: 10px;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 6px;
  }

  /* Settings */
  .settings-section {
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
  }

  .settings-section:last-child { border: none; }
  .settings-section h3 { margin-bottom: 12px; font-size: 16px; }

  /* Empty state */
  .empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
  }

  .empty-state .icon { font-size: 48px; margin-bottom: 12px; }
  .empty-state p { font-size: 14px; }

  /* Pagination */
  .pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
  }
  .pagination-controls button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
  }

  /* Responsive */
  @media (max-width: 768px) {
    .sidebar { width: 60px; }
    .sidebar .nav-item span, .sidebar-header h2, .sidebar-header small { display: none; }
    .main-content { margin-right: 60px; padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .chart-container { grid-template-columns: 1fr; }
    .test-row { grid-template-columns: 1fr 1fr; }
  }

  /* Quick actions */
  .quick-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
  }

  .quick-action {
    padding: 16px 24px;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    min-width: 160px;
  }

  .quick-action:hover, .quick-action:focus-visible {
    border-color: var(--primary);
    background: var(--primary-light);
  }

  .quick-action .icon { font-size: 32px; margin-bottom: 8px; display: block; }
  .quick-action .label { font-weight: 700; font-size: 14px; }

  /* Gender selector */
  .gender-selector {
    display: flex;
    gap: 8px;
  }

  .gender-option {
    flex: 1;
    padding: 10px;
    text-align: center;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
  }

  .gender-option:hover, .gender-option:focus-within { border-color: var(--primary); }
  .gender-option.selected { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

  /* Export buttons */
  .export-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-family: 'Cairo', sans-serif;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
  }
  .export-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
  .export-btn.pdf { background: #dc2626; color: white; }
  .export-btn.excel { background: #16a34a; color: white; }
  .export-btn.excel-all { background: #2563eb; color: white; }

  @media print {
    .no-print { display: none !important; }
  }

  /* Test Info Button */
  .test-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    min-width: 44px;
    min-height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
    margin-right: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
    line-height: 1;
    font-family: serif;
  }
  .test-info-btn:hover, .test-info-btn:focus-visible {
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(59,130,246,0.4);
    background: linear-gradient(135deg, #2563eb, #1e40af);
  }

  /* Test Info Modal */
  .info-modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 10000;
    justify-content: center;
    align-items: flex-start;
    padding: 30px;
    overflow-y: auto;
    backdrop-filter: blur(3px);
  }
  .info-modal-overlay.active {
    display: flex;
  }
  .info-modal {
    background: white;
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    animation: infoSlideIn 0.3s ease;
  }
  @keyframes infoSlideIn {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .info-modal-header {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: white;
    padding: 20px 24px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1;
  }
  .info-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
  }
  .info-modal-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
  }
  .info-modal-close:hover {
    background: rgba(255,255,255,0.35);
    transform: rotate(90deg);
  }
  .info-modal-body {
    padding: 24px;
  }
  .info-section {
    margin-bottom: 18px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 14px;
  }
  .info-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
  }
  .info-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .info-section-content {
    font-size: 14px;
    color: #374151;
    line-height: 1.8;
  }
  .info-tag {
    display: inline-block;
    background: #eff6ff;
    color: #1e40af;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    margin: 2px 4px 2px 0;
    border: 1px solid #bfdbfe;
  }
  .info-tag.danger {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
  }
  .info-tag.success {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #bbf7d0;
  }
  .info-tag.warning {
    background: #fffbeb;
    color: #d97706;
    border-color: #fde68a;
  }
  .info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .info-grid-item {
    background: #f8fafc;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
  }
  .info-grid-item .label {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 4px;
  }
  .info-grid-item .value {
    font-size: 14px;
    color: #1e293b;
    font-weight: 600;
  }
  .info-critical-box {
    background: linear-gradient(135deg, #fef2f2, #fff1f2);
    border: 2px solid #fca5a5;
    border-radius: 12px;
    padding: 14px 18px;
    margin-top: 8px;
  }
  .info-critical-box .title {
    color: #dc2626;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
  }
  .info-prep-list {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  .info-prep-list li {
    padding: 6px 0;
    border-bottom: 1px dashed #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .info-prep-list li:last-child { border-bottom: none; }
  .info-prep-list li::before {
    content: '✓';
    color: #16a34a;
    font-weight: 700;
  }

  /* Checkbox item with info button layout */
  .checkbox-item {
    display: flex;
    align-items: center;
  }

  /* ===========================
     H2: BUTTON LOADING STATE
     =========================== */
  @keyframes spin {
    to { transform: rotate(360deg); }
  }

  .btn--loading {
    opacity: 0.75;
    pointer-events: none;
    cursor: not-allowed;
    position: relative;
  }

  .btn--loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
  }

  /* ===========================
     H5: TOAST CONTAINER (stacking, RTL)
     =========================== */
  #toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    left: auto;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 340px;
    pointer-events: none;
  }

  .toast-item {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: #323232;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    pointer-events: auto;
    animation: toastSlideIn 0.25s ease;
    transition: opacity 0.3s ease;
    cursor: default;
  }

  .toast-item.success { background: var(--success, #2e7d32); }
  .toast-item.error   { background: var(--danger,  #e53935); }
  .toast-item.warning { background: #e65100; }

  @keyframes toastSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* ===========================
     H3/H4: MODAL FOCUS TRAP STYLES (visual indicator)
     =========================== */
  /* Already handled by focus-visible in existing CSS */

  /* ===========================
     Sprint 3: CSS DESIGN TOKENS
     =========================== */
  /* Tokens added to :root below — new rules should use var(--space-*), var(--z-*) */

  /* ===========================
     Sprint 3: FORM ERROR STATES
     =========================== */
  .input--error {
    border-color: var(--danger, #e53935) !important;
    box-shadow: 0 0 0 2px rgba(229, 57, 53, 0.15);
  }

  .field-error {
    color: var(--danger, #e53935);
    font-size: 11px;
    margin-top: 4px;
    display: block;
  }

  /* ===========================
     Sprint 3: BADGE PARTIAL CONTRAST FIX (WCAG AA)
     =========================== */
  .badge-partial {
    background: #fff8e1;
    color: #7a3c00; /* was #f57f17 — 3.4:1 contrast → now ≥7:1 */
    border: 1px solid #ffe082;
  }

  /* ===========================
     Sprint 3: RTL NAV ACTIVE BORDER FIX
     =========================== */
  .nav-item.active,
  .sidebar a.active {
    border-right: none !important;
    border-left: 4px solid var(--primary, #1976d2);
  }

  /* ===========================
     Sprint 3: LOADING / SKELETON
     =========================== */
  .page-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
  }

  .page-loading::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color, #e0e0e0);
    border-top-color: var(--primary, #1976d2);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }

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

  .skeleton-row td {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
    border-radius: 4px;
    color: transparent;
  }

  /* ===========================
     Sprint 3: 480px MOBILE BREAKPOINT
     =========================== */
  @media (max-width: 480px) {
    .layout { flex-direction: column; }
    .sidebar { display: none; }
    .main-content { padding: 12px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .modal-content { width: 95vw; max-height: 90vh; overflow-y: auto; }
    .btn-group { flex-direction: column; }
    .btn-group .btn { width: 100%; }
    th, td { font-size: 11px; padding: 6px 4px; }
    .page-header { flex-direction: column; gap: 8px; }
    .page-header h2 { font-size: 18px; }
    .form-grid { grid-template-columns: 1fr !important; }
  }

  /* ===========================
     Sprint 3: EMPTY STATE
     =========================== */
  .empty-state {
    text-align: center;
    padding: 48px 16px;
    color: #9e9e9e;
  }

  .empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
  }

  /* ===========================
     Sprint 3: REDUCED MOTION
     =========================== */
  /* Skip navigation link — visible only on keyboard focus */
  .skip-link {
    position: absolute;
    top: -100%;
    right: 0;
    background: var(--primary);
    color: #fff;
    padding: 8px 16px;
    z-index: 10000;
    font-size: 14px;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
  }
  .skip-link:focus {
    top: 0;
  }

  @media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }

