@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --brand-red: #E8231A;
  --brand-yellow: #F5C518;
  --sidebar-bg: #111827;
  --sidebar-hover: #1F2937;
  --sidebar-text: #9CA3AF;
  --sidebar-width: 260px;
  --header-height: 64px;
  --main-bg: #F3F4F6;
  --card-bg: #FFFFFF;
  --text-primary: #111827;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --border: #E5E7EB;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.12), 0 4px 10px rgba(0,0,0,0.08);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--main-bg);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

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

/* ── SIDEBAR ─────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  box-shadow: 2px 0 8px rgba(0,0,0,0.2);
}

.sidebar-logo {
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.sidebar-logo img { height: 38px; width: auto; }
.sidebar-logo-text { color: #fff; font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.sidebar-logo-sub  { color: var(--sidebar-text); font-size: 10.5px; font-weight: 500; letter-spacing: 0.8px; text-transform: uppercase; margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.nav-section { margin-bottom: 4px; }
.nav-section-label {
  padding: 10px 20px 4px;
  color: rgba(156,163,175,0.6);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 450;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
  cursor: pointer;
  position: relative;
}
.nav-item:hover { background: var(--sidebar-hover); color: #E5E7EB; }
.nav-item.active {
  background: rgba(232,35,26,0.12);
  color: #FFFFFF;
  border-left-color: var(--brand-red);
  font-weight: 500;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.65; }
.nav-item.active svg, .nav-item:hover svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  background: var(--brand-red);
  color: white;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-red), #c0392b);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.user-avatar.admin { background: linear-gradient(135deg, #D97706, var(--brand-yellow)); color: #fff; }
.user-name { color: #F3F4F6; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: var(--sidebar-text); font-size: 11px; }

.btn-logout {
  width: 100%; padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: all 0.15s; font-family: inherit;
}
.btn-logout:hover { background: rgba(232,35,26,0.15); border-color: rgba(232,35,26,0.4); color: #FCA5A5; }

/* ── MAIN CONTENT ────────────────────────── */
.main-content { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.page-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: var(--header-height);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.page-title { font-size: 17px; font-weight: 650; color: var(--text-primary); }
.page-subtitle { font-size: 12.5px; color: var(--text-secondary); margin-top: 1px; }
.page-body { padding: 28px 32px; flex: 1; }

/* ── CARDS ───────────────────────────────── */
.card { background: var(--card-bg); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.card-header { padding: 16px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-size: 14.5px; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 22px; }

/* ── STAT CARDS ──────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex; align-items: flex-start; justify-content: space-between;
  transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-label { font-size: 11.5px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text-primary); margin-top: 6px; letter-spacing: -0.5px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.stat-icon { width: 44px; height: 44px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.red    { background: rgba(232,35,26,0.1);  color: var(--brand-red); }
.stat-icon.yellow { background: rgba(245,197,24,0.15); color: #D97706; }
.stat-icon.green  { background: rgba(16,185,129,0.1);  color: var(--success); }
.stat-icon.blue   { background: rgba(59,130,246,0.1);  color: var(--info); }

/* ── TABLES ──────────────────────────────── */
.table-container { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table thead th {
  text-align: left; padding: 10px 14px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-secondary); background: #F9FAFB;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
.table tbody tr:last-child { border-bottom: none; }
.table tfoot tr:last-child td, .table tfoot tr:last-child th { padding-bottom: 16px; }
.table-container { overflow: hidden; border-radius: 0 0 var(--radius-md) var(--radius-md); }
.table tbody tr:hover { background: #FAFAFA; }
.table tbody td { padding: 12px 14px; color: var(--text-primary); vertical-align: middle; }
.table-amount { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.table-muted { color: var(--text-secondary); font-size: 12.5px; }

/* ── BADGES ──────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.2px; white-space: nowrap;
}
.badge-pending  { background: rgba(245,158,11,0.1);  color: #D97706; border: 1px solid rgba(245,158,11,0.25); }
.badge-approved { background: rgba(16,185,129,0.1);  color: #059669; border: 1px solid rgba(16,185,129,0.25); }
.badge-rejected { background: rgba(239,68,68,0.1);   color: #DC2626; border: 1px solid rgba(239,68,68,0.2); }

/* ── FORMS ───────────────────────────────── */
.form-grid   { display: grid; grid-template-columns: repeat(2,1fr); gap: 18px; }
.form-grid-3 { grid-template-columns: repeat(3,1fr); }
.form-group  { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }

label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.2px; }

.form-control {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit;
  color: var(--text-primary); background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-control:focus { border-color: var(--brand-red); box-shadow: 0 0 0 3px rgba(232,35,26,0.08); }
.form-control::placeholder { color: var(--text-muted); }
.form-control:disabled { background: #F9FAFB; color: var(--text-secondary); cursor: not-allowed; }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

/* ── BUTTONS ─────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; font-family: inherit;
  cursor: pointer; border: none;
  transition: all 0.15s; text-decoration: none;
  white-space: nowrap; line-height: 1;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: var(--brand-red); color: white; }
.btn-primary:hover:not(:disabled) { background: #c91d15; box-shadow: 0 4px 12px rgba(232,35,26,0.3); }

.btn-secondary { background: #F3F4F6; color: var(--text-primary); border: 1px solid var(--border); }
.btn-secondary:hover { background: #E5E7EB; }

.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #059669; box-shadow: 0 4px 12px rgba(16,185,129,0.3); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #DC2626; }

.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover:not(:disabled) { background: #D97706; }

.btn-ghost { background: transparent; color: var(--text-secondary); padding: 6px 10px; }
.btn-ghost:hover { background: #F3F4F6; color: var(--text-primary); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-sm svg { width: 13px; height: 13px; }

/* ── TABS ────────────────────────────────── */
.tabs {
  display: inline-flex; gap: 2px;
  background: #F3F4F6; padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 22px;
}
.tab {
  padding: 8px 20px; border-radius: 5px;
  font-size: 13.5px; font-weight: 500;
  cursor: pointer; color: var(--text-secondary);
  background: transparent; border: none;
  font-family: inherit; transition: all 0.15s;
}
.tab.active { background: white; color: var(--text-primary); box-shadow: 0 1px 4px rgba(0,0,0,0.1); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── MODAL ───────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200; display: none;
  align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-overlay.active { display: flex; }
.modal {
  background: white; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.96) translateY(-8px); } to { opacity: 1; transform: none; } }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 15.5px; font-weight: 650; }
.modal-close {
  width: 30px; height: 30px; border-radius: 6px;
  background: #F3F4F6; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 18px; transition: all 0.15s;
}
.modal-close:hover { background: #E5E7EB; color: var(--text-primary); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── FILTER BAR ──────────────────────────── */
.filter-bar {
  display: flex; gap: 12px; align-items: flex-end;
  flex-wrap: wrap; padding: 16px 22px;
  background: #F9FAFB; border-bottom: 1px solid var(--border);
}
.filter-bar .form-group { min-width: 140px; }
.filter-bar label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; }

/* ── EMPTY STATE ─────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }
.empty-state svg { width: 48px; height: 48px; color: #D1D5DB; margin: 0 auto 14px; display: block; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.empty-state p { font-size: 13.5px; }

/* ── LOGIN PAGE ──────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; position: relative; overflow: hidden;
  --s: 600px;
  --c1: #0a1628;
  --c2: #1a3a5c;
  --c3: #0f2040;
  background:
    repeating-conic-gradient(
        from 30deg,
        #0000 0 120deg,
        var(--c3) 0 180deg
      )
      calc(0.5 * var(--s)) calc(0.5 * var(--s) * 0.577),
    repeating-conic-gradient(
      from 30deg,
      var(--c1) 0 60deg,
      var(--c2) 0 120deg,
      var(--c3) 0 180deg
    );
  background-size: var(--s) calc(var(--s) * 0.577);
}
.login-page::before {
  content: ''; position: absolute; top: -80px; right: -80px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(232,35,26,0.14) 0%, transparent 65%);
  pointer-events: none;
}
.login-page::after {
  content: ''; position: absolute; bottom: -80px; left: -80px;
  width: 450px; height: 450px;
  background: radial-gradient(circle, rgba(245,197,24,0.1) 0%, transparent 65%);
  pointer-events: none;
}
.login-card {
  background: white; border-radius: var(--radius-lg);
  padding: 44px 40px; width: 100%; max-width: 400px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.05);
  position: relative; z-index: 1;
}
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo img { height: 68px; width: auto; }
.login-logo-sub { margin-top: 10px; font-size: 12px; color: var(--text-muted); letter-spacing: 0.8px; text-transform: uppercase; font-weight: 500; }
.login-heading { font-size: 21px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.login-sub { font-size: 13.5px; color: var(--text-secondary); margin-bottom: 26px; }
.login-form .form-group { margin-bottom: 15px; }
.btn-login { width: 100%; justify-content: center; padding: 11px; font-size: 15px; margin-top: 6px; border-radius: var(--radius-sm); }
.login-error { margin-top: 12px; display: none; font-size: 13px; color: #DC2626; background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2); padding: 10px 14px; border-radius: var(--radius-sm); }

/* ── FILLER PAGES ────────────────────────── */
.coming-soon {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 400px; text-align: center; padding: 40px;
}
.coming-soon-icon {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--brand-red), #c91d15);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 24px; box-shadow: 0 8px 24px rgba(232,35,26,0.25);
}
.coming-soon-icon svg { width: 40px; height: 40px; color: white; }
.coming-soon h2 { font-size: 22px; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; }
.coming-soon p { font-size: 14px; color: var(--text-secondary); max-width: 320px; }
.coming-soon .tag {
  margin-top: 20px; display: inline-block;
  background: rgba(245,197,24,0.12); color: #B45309;
  border: 1px solid rgba(245,197,24,0.3);
  padding: 4px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}

/* ── REPORT ──────────────────────────────── */
.report-totals-bar {
  background: linear-gradient(135deg, #1C1C2E, #2D1B1B);
  border-radius: var(--radius-md); padding: 20px 24px;
  display: flex; align-items: center; justify-content: center;
  gap: 0; margin-bottom: 20px; flex-wrap: wrap;
}
.report-total-item { text-align: center; flex: 1; min-width: 100px; }
.report-total-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; opacity: 0.7; color: #E5E7EB; }
.report-total-value { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.report-total-value.white   { color: white; }
.report-total-value.green   { color: #6EE7B7; }
.report-total-value.amber   { color: #FCD34D; }
.report-total-value.red     { color: #FCA5A5; }

/* ── UTILS ───────────────────────────────── */
.flex             { display: flex; }
.items-center     { align-items: center; }
.justify-between  { justify-content: space-between; }
.gap-2            { gap: 8px; }
.gap-3            { gap: 12px; }
.gap-4            { gap: 16px; }
.mt-1             { margin-top: 4px; }
.mt-4             { margin-top: 16px; }
.mb-4             { margin-bottom: 16px; }
.mb-6             { margin-bottom: 24px; }
.text-sm          { font-size: 12.5px; }
.text-muted       { color: var(--text-muted); }
.text-right       { text-align: right; }
.font-semibold    { font-weight: 600; }
.hidden           { display: none !important; }
.w-full           { width: 100%; }

/* ── TOAST ───────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  display: flex; align-items: center; gap: 8px;
  max-width: 340px; color: white;
  animation: toastIn 0.3s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── MOBILE MENU BUTTON (hidden on desktop) ─ */
.mobile-menu-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text-secondary); transition: background 0.15s;
  margin-right: 4px;
}
.mobile-menu-btn:hover { background: #F3F4F6; }
.mobile-menu-btn svg { width: 18px; height: 18px; }

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

/* ── MOBILE ──────────────────────────────── */
@media (max-width: 768px) {
  /* Sidebar becomes slide-in drawer */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 300;
  }
  body.sidebar-open .sidebar  { transform: translateX(0); }
  body.sidebar-open .sidebar-overlay { display: block; }
  body.sidebar-open { overflow: hidden; }

  /* Main content fills full width */
  .main-content { margin-left: 0; }

  /* Fix heights — 100vh includes browser chrome on mobile, dvh is the real visible height */
  .sidebar      { height: 100dvh; }
  .app-layout   { min-height: 100dvh; }
  .main-content { min-height: 100dvh; }

  /* Show hamburger */
  .mobile-menu-btn { display: flex; }

  /* Tighter header and body */
  .page-header { padding: 0 14px; gap: 8px; height: auto; min-height: var(--header-height); padding-top: 10px; padding-bottom: 10px; }
  .page-body   { padding: 14px; }

  /* Form grids → single column */
  .form-grid   { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }

  /* Dashboard shortcuts → single column */
  .shortcuts-grid { grid-template-columns: 1fr !important; }

  /* Suppliers side-by-side layout → stack */
  #suppliersGrid { grid-template-columns: 1fr !important; }

  /* Stat cards → 2 per row */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-value { font-size: 20px; }
  .stat-card  { padding: 14px 16px; }

  /* Filter bar: 2-per-row grid on mobile */
  .filter-bar {
    padding: 12px 14px;
    gap: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .filter-bar .form-group { min-width: unset; }
  /* Buttons span full width at bottom */
  .filter-bar > .btn { grid-column: span 1; align-self: end; }
  .filter-bar > .btn-primary { grid-column: 1 / -1; }

  /* Card header wraps on mobile */
  .card-header { flex-wrap: wrap; padding: 13px 16px; gap: 8px; }
  .card-body   { padding: 16px; }

  /* Tabs: scrollable horizontally */
  .tabs {
    display: flex; overflow-x: auto; width: 100%;
    -webkit-overflow-scrolling: touch; gap: 2px;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex-shrink: 0; padding: 8px 14px; font-size: 13px; }

  /* Modals slide up from bottom */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92dvh;
    overflow-y: auto;
  }
  .modal-body   { padding: 18px 16px; }
  .modal-footer { padding: 12px 16px; }

  /* Typography */
  .page-title    { font-size: 15px; }
  .page-subtitle { font-size: 11.5px; display: none; }

  /* Touch-friendly inputs and buttons */
  .form-control { padding: 11px 12px; font-size: 16px; /* prevents iOS zoom */ }
  .btn { padding: 10px 16px; }
  .btn-sm { padding: 8px 12px; }

  /* Table: scroll with touch, bigger tap targets */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Fade hint on right edge showing more content */
    background: linear-gradient(to right, transparent calc(100% - 32px), rgba(0,0,0,0.04)) no-repeat right;
  }
  .table tbody td { padding: 11px 12px; }
  .table thead th { padding: 9px 12px; }

  /* Actions col: stack buttons */
  .table .flex.gap-2 { gap: 6px; flex-wrap: wrap; }

  /* Toast: full width */
  #toast { left: 12px; right: 12px; bottom: 12px; max-width: none; }

  /* Report totals bar: 2-per-row */
  .report-totals-bar { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 12px 24px; }
  .report-total-item { min-width: 120px; }
  .report-total-value { font-size: 18px; }

  /* Agent-page filter tabs: scrollable horizontally (matches .tabs treatment) */
  .filter-tabs {
    display: flex !important; overflow-x: auto; width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filter-tabs::-webkit-scrollbar { display: none; }
  .filter-tab { flex-shrink: 0; }

  /* Agent-page table wrap: touch scroll */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .data-table tbody td { padding: 10px 12px; }
  .data-table thead th { padding: 8px 12px; }
}

/* Very small screens: stats single column */
@media (max-width: 420px) {
  .stats-grid { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: 1fr; }
  .filter-bar > .btn { grid-column: 1; }
}

/* ── PRINT ───────────────────────────────── */
@media print {
  .sidebar, .btn, .filter-bar, .page-header, #toast { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-body { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; }
  .print-header { display: block !important; }
  body { background: white !important; }
}
.print-header { display: none; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid var(--border); }
.print-header img { height: 50px; }
.print-header h2 { font-size: 18px; margin-top: 10px; }
.print-header p  { font-size: 12px; color: var(--text-secondary); }

/* ── Shared loading wheel ─────────────────────────────────────────────────────
   Usage: <span class="spinner"></span> Loading…   (wheel on the left, text right) */
.spinner { display: inline-block; width: 17px; height: 17px; vertical-align: -4px; border: 2.5px solid var(--border); border-top-color: var(--brand-red, #E8231A); border-radius: 50%; animation: spin 0.7s linear infinite; }
.spinner.lg { width: 40px; height: 40px; border-width: 4px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wheel { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 24px; color: var(--text-muted); font-size: 14px; }
