  :root {
    --bg: #eef0f5;
    --surface: #ffffff;
    --surface2: #e8edf2;
    --border: #d0d8e4;
    --text: #1e2533;
    --text2: #4a5568;
    --text3: #8a96aa;
    --accent: #2ec4b6;
    --accent2: #26a89c;
    --accent-light: #e0f7f5;
    --green: #5ecba1;
    --green-dark: #3a9e78;
    --green-light: #e0f7ec;
    --sage: #5ecba1;
    --sage-light: #e0f7ec;
    --orange: #f5a453;
    --orange-light: #fff0e0;
    --red: #e05a6a;
    --red-light: #fde8ec;
    --blue: #7ab8d4;
    --blue-light: #e0f0fa;
    --purple: #b39ddb;
    --tan: #f5c842;
    --tan-light: #fff8d6;
    --cream: #f8f5ee;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.10);
    --radius: 10px;
    --font: 'IBM Plex Sans Thai', sans-serif;
    --mono: 'IBM Plex Mono', monospace;
    --oc-ice: #7ab8d4;       --oc-ice-text: #0d2e3f;
    --oc-mint: #5ecba1;      --oc-mint-text: #0a3626;
    --oc-carnation: #f4a7b9; --oc-carnation-text: #5c0f22;
    --oc-lavender: #b39ddb;  --oc-lavender-text: #2d1b5e;
    --oc-yellow: #f5c842;    --oc-yellow-text: #3d2800;
    --oc-turquoise: #2ec4b6; --oc-turquoise-text: #032e2c;
    --oc-celadon: #a8c5a0;   --oc-celadon-text: #1a3318;
    --oc-powder: #a8c8e8;    --oc-powder-text: #0c2840;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }

  /* Layout */
  .app { display: flex; min-height: 100vh; }
  .sidebar {
    width: 240px; height: 100vh;
    background: #eef4ee;
    border-right: 1px solid #c8dcc8;
    color: #1e4a32; display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; z-index: 100;
    transition: transform 0.3s; overflow: hidden;
  }
  .sidebar-logo {
    padding: 16px 14px 14px;
    background: #2e6b4f;
    border-bottom: none;
  }
  .sidebar-logo .logo-icon {
    width: 36px; height: 36px; background: var(--gold);
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    margin-bottom: 10px; font-size: 18px;
  }
  .sidebar-logo .logo-name { font-weight: 700; font-size: 15px; line-height: 1.3; color: #d4eede; }
  .sidebar-logo .logo-sub { font-size: 11px; color: rgba(212,238,222,0.6); margin-top: 2px; }
  .sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; overflow-x: hidden; }
  .nav-section { padding: 12px 16px 4px; font-size: 10px; font-weight: 600; color: #2e6b4f; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; }
  .nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 20px; cursor: pointer; border-radius: 0;
    font-size: 13px; font-weight: 500; color: #1e4a32;
    transition: all 0.15s; border-left: 3px solid transparent;
  }
  .nav-item:hover { background: rgba(46,107,79,0.12); color: #14532d; }
  .nav-item.active { background: #2e6b4f; color: #d4eede; border-left-color: #a3d9a5; font-weight: 600; }
  .nav-item .icon { width: 18px; text-align: center; font-size: 15px; }
  .sidebar-footer { padding: 16px 20px; border-top: 1px solid #c8dcc8; font-size: 12px; color: #3a6b4f; font-weight: 500; }

  .main { margin-left: 240px; min-height: 100vh; }
  .topbar {
    background: #2e6b4f; border-bottom: 1px solid #265e43;
    padding: 0 24px; height: 56px; display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 50; box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  }
  .page-title { font-size: 16px; font-weight: 600; color: #d4eede; }
  .topbar-right { display: flex; align-items: center; gap: 12px; color: #d4eede; }
  .topbar-date { font-size: 12px; color: rgba(212,238,222,0.6); font-family: var(--mono); }
  .btn {
    padding: 7px 16px; border-radius: 7px; border: none; cursor: pointer;
    font-family: var(--font); font-size: 13px; font-weight: 500; transition: all 0.15s;
    display: inline-flex; align-items: center; gap: 6px;
  }
  .btn-primary { background: #2ec4b6; color: #032e2c; font-weight: 600; }
  .btn-primary:hover { background: #26a89c; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(46,196,182,0.35); }
  .btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
  .btn-secondary:hover { background: var(--border); }
  .btn-ghost { background: transparent; color: var(--text2); border: 1px solid var(--border); }
  .btn-ghost:hover { background: var(--surface2); color: var(--text); }
  .btn-danger { background: var(--red); color: white; }
  .btn-success { background: var(--green); color: white; }
  .btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 5px; }

  /* Toggle Switch */
  .toggle-switch { position:relative; display:inline-block; width:44px; height:24px; flex-shrink:0; }
  .toggle-switch input { opacity:0; width:0; height:0; }
  .toggle-slider { position:absolute; cursor:pointer; inset:0; background:#ccc; border-radius:24px; transition:.3s; }
  .toggle-slider:before { content:''; position:absolute; width:18px; height:18px; left:3px; bottom:3px; background:white; border-radius:50%; transition:.3s; }
  .toggle-switch input:checked + .toggle-slider { background:var(--green); }
  .toggle-switch input:checked + .toggle-slider:before { transform:translateX(20px); }

  /* Checkbox row */
  .checkbox-row { display:flex; align-items:flex-start; gap:12px; padding:10px 14px; border:1px solid var(--border); border-radius:8px; cursor:pointer; transition:background .15s; }
  .checkbox-row:hover { background:var(--surface2); }
  .checkbox-row input[type=checkbox] { margin-top:3px; width:16px; height:16px; accent-color:var(--accent); flex-shrink:0; cursor:pointer; }

  /* Guide modal */
  .guide-step { display:flex; gap:10px; align-items:flex-start; font-size:13px; }
  .guide-num { background:var(--accent); color:white; border-radius:50%; width:22px; height:22px; display:inline-flex; align-items:center; justify-content:center; font-size:11px; font-weight:700; flex-shrink:0; margin-top:1px; }



  .content { padding: 28px; }

  /* Cards & Panels */
  .card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
  }
  .card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.08), 0 6px 20px rgba(0,0,0,0.06); }
  .card-header {
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
  }
  .card-title { font-size: 15px; font-weight: 600; }
  .card-body { padding: 20px; }

  /* Stats Grid */
  .stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
  .stat-card {
    border-radius: var(--radius); padding: 18px 16px; position: relative; overflow: hidden;
    border: none; box-shadow: none;
  }
  .stat-card::before { display: none; }
  .stat-card.orange { background: #a8c5a0; }
  .stat-card.orange .stat-label, .stat-card.orange .stat-sub { color: #1a3318; opacity: 0.8; }
  .stat-card.orange .stat-value, .stat-card.orange .stat-icon { color: #1a3318; }
  .stat-card.red { background: #f4a7b9; }
  .stat-card.red .stat-label, .stat-card.red .stat-sub { color: #5c0f22; opacity: 0.8; }
  .stat-card.red .stat-value, .stat-card.red .stat-icon { color: #5c0f22; }
  .stat-card.green { background: #5ecba1; }
  .stat-card.green .stat-label, .stat-card.green .stat-sub { color: #0a3626; opacity: 0.8; }
  .stat-card.green .stat-value, .stat-card.green .stat-icon { color: #0a3626; }
  .stat-card.blue { background: #7ab8d4; }
  .stat-card.blue .stat-label, .stat-card.blue .stat-sub { color: #0d2e3f; opacity: 0.8; }
  .stat-card.blue .stat-value, .stat-card.blue .stat-icon { color: #0d2e3f; }
  .stat-card.purple { background: #b39ddb; }
  .stat-card.purple .stat-label, .stat-card.purple .stat-sub { color: #2d1b5e; opacity: 0.8; }
  .stat-card.purple .stat-value, .stat-card.purple .stat-icon { color: #2d1b5e; }
  .stat-card.yellow { background: #f5c842; }
  .stat-card.yellow .stat-label, .stat-card.yellow .stat-sub { color: #3d2800; opacity: 0.85; }
  .stat-card.yellow .stat-value, .stat-card.yellow .stat-icon { color: #3d2800; }
  .stat-card.teal { background: #2ec4b6; }
  .stat-card.teal .stat-label, .stat-card.teal .stat-sub { color: #032e2c; opacity: 0.85; }
  .stat-card.teal .stat-value, .stat-card.teal .stat-icon { color: #032e2c; }
  .stat-card.powder { background: #a8c8e8; }
  .stat-card.powder .stat-label, .stat-card.powder .stat-sub { color: #0c2840; opacity: 0.85; }
  .stat-card.powder .stat-value, .stat-card.powder .stat-icon { color: #0c2840; }
  .stat-value { font-size: 26px; font-weight: 700; font-family: var(--mono); line-height: 1; }
  .stat-sub { font-size: 10px; margin-top: 4px; opacity: 0.7; }
  .stat-sub { font-size: 11px; color: var(--text3); margin-top: 4px; }
  .stat-icon { position: absolute; top: auto; bottom: 10px; right: 10px; font-size: 28px; opacity: 0.85; pointer-events: none; }

  /* Table */
  .table-wrap { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; }
  th {
    background: var(--surface2); font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em; color: var(--text2);
    padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border);
    white-space: nowrap;
  }
  td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
  tr:last-child td { border-bottom: none; }
  tr:hover td { background: var(--bg); }

  /* Badges */
  .badge {
    display: inline-block; padding: 2px 9px; border-radius: 12px;
    font-size: 11px; font-weight: 600;
  }
  .badge-red { background: var(--red-light); color: var(--red); }
  .badge-orange { background: var(--tan-light); color: var(--tan); }
  .badge-green { background: var(--green-light); color: var(--green); }
  .badge-blue { background: var(--blue-light); color: var(--blue); }
  .badge-purple { background: #f0e8fa; color: var(--purple); }
  .badge-gray { background: var(--surface2); color: var(--text2); }

  /* Stock level bar */
  .stock-bar { height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; margin-top: 4px; }
  .stock-fill { height: 100%; border-radius: 3px; transition: width 0.5s; }

  /* Modal */
  .modal-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,0.55);
    display: none; align-items: center; justify-content: center; z-index: 200;
    backdrop-filter: blur(2px);
  }
  .modal-overlay.open { display: flex; }
  .modal, .modal-box {
    background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
    width: 540px; max-width: 95vw; max-height: 90vh; overflow-y: auto;
    animation: slideUp 0.2s ease;
  }
  @keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }
  .modal-header {
    padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
  }
  .modal-title { font-size: 16px; font-weight: 700; }
  .modal-close { background: none; border: none; cursor: pointer; font-size: 20px; color: var(--text2); padding: 2px 6px; border-radius: 4px; }
  .modal-close:hover { background: var(--surface2); }
  .modal-body { padding: 20px 24px; }
  .modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

  /* Form */
  .form-group { margin-bottom: 16px; }
  .form-label { font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 6px; display: block; }
  .form-label .required { color: var(--red); margin-left: 2px; }
  .form-control {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border); border-radius: 7px;
    font-family: var(--font); font-size: 13.5px; background: var(--surface);
    color: var(--text); transition: border-color 0.15s, box-shadow 0.15s;
  }
  .form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46,196,182,0.18); }
  .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .form-row { display: flex; gap: 12px; align-items: flex-end; }
  .form-row .form-group { flex: 1; margin-bottom: 0; }

  /* Alert */
  .alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; }
  .alert-warning { background: var(--orange-light); border: 1px solid #f5c97a; color: #8a4d00; }
  .alert-danger { background: var(--red-light); border: 1px solid #f5a0a0; color: var(--red); }
  .alert-success { background: var(--green-light); border: 1px solid #7dd4a0; color: var(--green); }

  /* Search */
  .search-wrap { position: relative; }
  .search-wrap input { padding-left: 36px; }
  .search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 14px; }

  /* Tabs */
  .tabs { display: flex; gap: 2px; background: var(--surface2); padding: 4px; border-radius: 8px; margin-bottom: 20px; }
  .tab { padding: 6px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text2); transition: all 0.15s; }
  .tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
  .tab.tab-alert { color: var(--red); font-weight: 700; }

  /* Category color dots */
  .cat-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 6px; }
  .cat-red { background: #e05050; }
  .cat-orange { background: #e07040; }
  .cat-blue { background: #4070c0; }
  .cat-black { background: #555; }
  .cat-purple { background: #9060c0; }

  /* Timeline */
  .timeline { }
  .tl-item { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .tl-item:last-child { border-bottom: none; }
  .tl-dot { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; margin-top: 2px; }
  .tl-content { flex: 1; }
  .tl-title { font-size: 13.5px; font-weight: 500; }
  .tl-meta { font-size: 12px; color: var(--text2); }

  /* Empty state */
  .empty { text-align: center; padding: 48px 24px; color: var(--text3); }
  .empty-icon { font-size: 40px; margin-bottom: 12px; }
  .empty-text { font-size: 14px; }

  /* Toast */
  .toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
  .toast {
    background: var(--text); color: #f0ede6; padding: 12px 18px; border-radius: 8px;
    font-size: 13px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px;
    animation: slideIn 0.25s ease; min-width: 240px;
  }
  .toast.success { background: var(--green); }
  .toast.warning { background: var(--orange); }
  .toast.error { background: var(--red); }
  @keyframes slideIn { from { transform: translateX(100%); opacity:0; } to { transform: translateX(0); opacity:1; } }

  /* Responsive */
  @media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s ease; z-index: 1100; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .stats-grid { grid-template-columns: repeat(2,1fr); }
    .topbar { padding: 0 12px; }
  }
  #sidebarOverlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.45); z-index: 1099;
  }
  #sidebarOverlay.show { display: block; }
  #hamburgerBtn {
    display: none; background: none; border: none;
    font-size: 22px; cursor: pointer; padding: 4px 8px;
    color: #d4eede; margin-right: 8px;
  }
  @media (max-width: 768px) {
    #hamburgerBtn { display: inline-block; }
  }

  .tag { display: inline-block; background: var(--surface2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 7px; font-size: 11px; color: var(--text2); font-family: var(--mono); }

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

  .divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

  .low-stock { background: var(--orange-light) !important; }
  .critical-stock { background: var(--red-light) !important; }
  .row-highlight td { font-weight: 500; }

  /* ── LOGIN SCREEN ── */
  #loginScreen {
    position: fixed; inset: 0; z-index: 9000;
    background: #2e6b4f;
    display: flex; align-items: center; justify-content: center;
  }
  .login-box {
    background: var(--surface); border-radius: 16px;
    padding: 40px 44px; width: 400px; max-width: 95vw;
    box-shadow: 0 24px 64px rgba(0,0,0,0.4), 0 0 0 1px rgba(46,107,79,0.3);
    border-top: 3px solid #2e6b4f;
  }
  .login-logo {
    text-align: center; margin-bottom: 28px;
  }
  .login-logo .ico {
    width: 60px; height: 60px; background: #2e6b4f;
    border-radius: 14px; display: inline-flex; align-items: center;
    justify-content: center; font-size: 28px; margin-bottom: 12px;
  }
  .login-logo h1 { font-size: 17px; font-weight: 700; }
  .login-logo p { font-size: 12.5px; color: var(--text2); margin-top: 2px; }
  .login-error {
    background: var(--red-light); border: 1px solid #f5a0a0;
    color: var(--red); border-radius: 7px; padding: 9px 13px;
    font-size: 13px; margin-bottom: 14px; display: none;
  }
  .login-footer {
    margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border);
    font-size: 11.5px; color: var(--text3); text-align: center; line-height: 1.6;
  }

  /* user chip in topbar */
  .user-chip {
    display: flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px; padding: 4px 12px 4px 6px; cursor: pointer;
    font-size: 13px; font-weight: 500; color: #d4eede; transition: background .15s;
  }
  .user-chip:hover { background: rgba(255,255,255,0.18); }
  .user-avatar {
    width: 26px; height: 26px; border-radius: 50%; background: var(--accent);
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
  }

  /* ── REQUISITION FORM (screen) ── */
  .req-form-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    max-width: 820px;
  }
  .req-form-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 22px; border-bottom: 1px solid var(--border);
  }
  .req-form-title { font-size: 15px; font-weight: 700; }
  .req-item-row {
    display: flex; gap: 10px; align-items: flex-end;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 8px; padding: 12px 14px; margin-bottom: 8px;
  }
  .req-item-row .form-group { margin: 0; }

  /* ── PRINT STYLES / REQUISITION FORM ── */
  @media print {
    body * { visibility: hidden; }
    #printArea, #printArea * { visibility: visible; }
    #printArea { position: fixed; inset: 0; background: white; padding: 0; }
    .no-print { display: none !important; }
  }

  /* Requisition print layout */
  .rq-print {
    font-family: 'IBM Plex Sans Thai', 'Sarabun', sans-serif;
    width: 210mm; min-height: 148mm; margin: 0 auto;
    padding: 18mm 18mm 14mm; background: white; color: #000;
    font-size: 13px; line-height: 1.6;
  }
  .rq-print-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 12px; padding-bottom: 10px; border-bottom: 2px solid #b8860b;
  }
  .rq-hospital-name { font-size: 16px; font-weight: 700; }
  .rq-hospital-sub { font-size: 11px; color: #444; margin-top: 2px; }
  .rq-doc-title {
    text-align: center; font-size: 16px; font-weight: 700;
    margin: 10px 0 14px; letter-spacing: 0.03em;
  }
  .rq-doc-ref {
    display: flex; justify-content: space-between; font-size: 12px;
    margin-bottom: 12px; gap: 20px;
  }
  .rq-doc-ref span { display: block; }
  .rq-doc-ref strong { font-weight: 600; }
  .rq-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 12.5px; }
  .rq-table th {
    background: #f0f0f0; border: 1px solid #bbb;
    padding: 6px 10px; text-align: center; font-weight: 700;
  }
  .rq-table td { border: 1px solid #bbb; padding: 6px 10px; }
  .rq-table .center { text-align: center; }
  .rq-sign-row {
    display: grid; grid-template-columns: 1fr 1fr 1fr;
    gap: 20px; margin-top: 24px;
  }
  .rq-sign-box { text-align: center; }
  .rq-sign-line {
    border-bottom: 1px solid #000; margin: 32px 10px 6px;
  }
  .rq-sign-label { font-size: 11.5px; color: #444; }
  .rq-sign-name { font-size: 12px; font-weight: 600; margin-top: 2px; }
  .rq-status-badge {
    display: inline-block; padding: 3px 12px; border-radius: 20px;
    font-size: 11.5px; font-weight: 700; border: 1.5px solid;
  }
  .rq-status-pending { color: #d4760a; border-color: #d4760a; background: #fef3e0; }
  .rq-status-approved { color: #2a7a4f; border-color: #2a7a4f; background: #e8f5ee; }
  .rq-status-rejected { color: #c0392b; border-color: #c0392b; background: #fdecea; }
  .rq-note-box {
    border: 1px solid #ccc; border-radius: 4px;
    padding: 8px 10px; min-height: 36px; margin-top: 10px;
    font-size: 12px; color: #444;
  }

  /* workflow timeline in print */
  .rq-timeline {
    display: flex; align-items: center; gap: 0; margin: 12px 0;
    font-size: 11px;
  }
  .rq-tl-step {
    flex: 1; text-align: center; position: relative;
  }
  .rq-tl-step:not(:last-child)::after {
    content: ''; position: absolute;
    top: 10px; left: 50%; width: 100%; height: 1.5px;
    background: #bbb; z-index: 0;
  }
  .rq-tl-circle {
    width: 20px; height: 20px; border-radius: 50%;
    background: #eee; border: 1.5px solid #bbb; color: #888;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; position: relative; z-index: 1;
    margin-bottom: 4px;
  }
  .rq-tl-circle.done { background: #2a7a4f; border-color: #2a7a4f; color: white; }
  .rq-tl-circle.active { background: #d4760a; border-color: #d4760a; color: white; }

/* ── MOBILE RESPONSIVE IMPROVEMENTS (max-width: 768px) ── */
@media (max-width: 768px) {

  /* Content padding */
  .content { padding: 12px 10px; }

  /* Page header buttons — stack vertically on very small screens */
  .page-header { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* Tables — horizontal scroll always on */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 480px; }
  th, td { font-size: 12px; padding: 8px 10px; }

  /* Cards */
  .card { border-radius: 8px; }
  .card-header { flex-wrap: wrap; gap: 6px; }
  .card-title { font-size: 13px; }

  /* Stats grid — 2 cols already but shrink padding */
  .stat-card { padding: 12px 10px; }
  .stat-value { font-size: 26px; }

  /* Modals — full width on mobile */
  .modal-box {
    width: 96vw !important;
    max-width: 96vw !important;
    max-height: 90vh;
    overflow-y: auto;
    margin: 5vh auto;
  }
  .modal-body { padding: 14px 12px; }

  /* Forms */
  .form-row { flex-direction: column; gap: 8px; }
  .form-group { width: 100% !important; }
  .form-control { font-size: 14px; }

  /* Buttons in header — smaller */
  .page-header .btn { font-size: 12px; padding: 6px 10px; }

  /* Tabs — scrollable horizontal */
  .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  .tab { font-size: 12px; padding: 7px 12px; flex-shrink: 0; }

  /* Topbar */
  .topbar-date { display: none; }
  #userDisplayName { display: none; }
  .topbar { height: 52px; }

  /* Notification bell panel */
  #notif-panel { width: 90vw; right: -8px; }

  /* Billing/report grids */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .stat-value { font-size: 22px; }
  table { min-width: 380px; }
  .tab { font-size: 11px; padding: 6px 9px; }
}
