/* ═══════════════════════════════════════════════════════════════════════════
   ٹیلرنگ ERP — Enterprise UI  v3.0
   Palette: Deep Forest Green (#0f2d1a) + Gold (#b8860b) + Slate White (#f8f9fa)
   Typography: Noto Nastaliq Urdu (RTL) + Inter (numbers/LTR)
═══════════════════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Noto+Nastaliq+Urdu:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

/* ── Design Tokens ────────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --brand-900:  #071810;
  --brand-800:  #0f2d1a;
  --brand-700:  #163d23;
  --brand-600:  #1e5430;
  --brand-500:  #276b3e;
  --brand-400:  #3a8c55;
  --brand-300:  #5eaa76;
  --brand-100:  #d4ead9;
  --brand-50:   #eef7f0;

  --gold-700:   #7a5a06;
  --gold-600:   #9c720a;
  --gold-500:   #b8860b;
  --gold-400:   #d4a017;
  --gold-300:   #e8bb3a;
  --gold-100:   #fdf0c6;
  --gold-50:    #fffbee;

  /* Semantic */
  --success:    #166534;
  --success-bg: #dcfce7;
  --success-bd: #86efac;
  --danger:     #991b1b;
  --danger-bg:  #fee2e2;
  --danger-bd:  #fca5a5;
  --warning:    #92400e;
  --warning-bg: #fef3c7;
  --warning-bd: #fcd34d;
  --info:       #1e40af;
  --info-bg:    #dbeafe;
  --info-bd:    #93c5fd;

  /* Surface */
  --bg:         #f4f6f8;
  --bg-card:    #ffffff;
  --bg-subtle:  #f9fafb;
  --bg-hover:   #f0f4f1;

  /* Text */
  --text-primary:   #111827;
  --text-secondary: #4b5563;
  --text-muted:     #9ca3af;
  --text-inverse:   #ffffff;

  /* Border */
  --border:         #e5e7eb;
  --border-strong:  #d1d5db;
  --border-focus:   var(--brand-400);

  /* Nav */
  --nav-bg:     var(--brand-800);
  --nav-h:      64px;

  /* Radius */
  --r-xs:  4px;
  --r-sm:  6px;
  --r:     8px;
  --r-md:  10px;
  --r-lg:  12px;
  --r-xl:  16px;
  --r-2xl: 20px;

  /* Shadow */
  --sh-xs:  0 1px 2px 0 rgba(0,0,0,.05);
  --sh-sm:  0 1px 3px 0 rgba(0,0,0,.1), 0 1px 2px -1px rgba(0,0,0,.1);
  --sh:     0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.07);
  --sh-md:  0 10px 15px -3px rgba(0,0,0,.07), 0 4px 6px -4px rgba(0,0,0,.07);
  --sh-lg:  0 20px 25px -5px rgba(0,0,0,.08), 0 8px 10px -6px rgba(0,0,0,.08);
  --sh-xl:  0 25px 50px -12px rgba(0,0,0,.14);

  /* Transition */
  --ease:   cubic-bezier(.4,0,.2,1);
  --dur:    150ms;
  --dur-md: 200ms;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; font-size: 16px; }
body {
  font-family: 'Noto Nastaliq Urdu', 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  direction: rtl;
  line-height: 1.6;
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
svg { display: block; flex-shrink: 0; overflow: visible; }
svg:not([width]) { width: 1em; height: 1em; }
img { display: block; max-width: 100%; }

/* ── Numbers use Inter ───────────────────────────────────────────────────── */
.num, .stat-value, td.num { font-family: 'Inter', sans-serif; letter-spacing: -.01em; }

/* ═══════════════════════════════════════════════════════════════════════════
   TOP NAVIGATION — Enterprise sidebar-style topbar
═══════════════════════════════════════════════════════════════════════════ */
.topnav {
  position: fixed;
  top: 0; right: 0; left: 0;
  height: var(--nav-h);
  z-index: 500;
  background: var(--nav-bg);
  border-bottom: 1px solid rgba(255,255,255,.06);
  box-shadow: 0 1px 0 rgba(0,0,0,.3), var(--sh-md);
}

.topnav-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 24px;
  gap: 4px;
  max-width: 1800px;
  margin: 0 auto;
}

/* Brand ──────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 8px;
  border-radius: var(--r-md);
  text-decoration: none;
  margin-left: 20px;
  flex-shrink: 0;
  transition: background var(--dur) var(--ease);
  border: 1px solid transparent;
}
.brand:hover { background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.08); }

.brand-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--gold-600), var(--gold-400));
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--brand-900);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(184,134,11,.35);
}
.brand-icon svg { width: 20px; height: 20px; }

.brand-text {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  letter-spacing: .01em;
}
.brand-sub {
  font-size: 10px;
  color: var(--gold-300);
  font-family: 'Inter', sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
  display: block;
  line-height: 1;
  margin-top: 1px;
}

/* Nav links ─────────────────────────────────── */
.nav-links {
  display: flex;
  align-items: center;
  gap: 1px;
  flex: 1;
  overflow: hidden;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border-radius: var(--r-sm);
  color: rgba(255,255,255,.6);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
  position: relative;
  border: 1px solid transparent;
}
.nav-link:hover {
  color: rgba(255,255,255,.92);
  background: rgba(255,255,255,.08);
}
.nav-link.active {
  color: var(--gold-300);
  background: rgba(184,134,11,.12);
  border-color: rgba(184,134,11,.2);
  font-weight: 600;
}

.nav-icon {
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nav-icon svg { width: 15px; height: 15px; }
.nav-label { font-size: 12.5px; }

/* Right cluster ─────────────────────────────── */
.topnav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  flex-shrink: 0;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 5px 6px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 100px;
  cursor: default;
  transition: background var(--dur) var(--ease);
}
.user-chip:hover { background: rgba(255,255,255,.1); }

.user-av {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-300));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: var(--brand-900);
  font-family: 'Inter', sans-serif;
  flex-shrink: 0;
}
.user-nm {
  font-size: 12.5px;
  color: rgba(255,255,255,.85);
  font-weight: 500;
}

.btn-logout {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--r-sm);
  color: #fca5a5;
  transition: all var(--dur) var(--ease);
}
.btn-logout:hover { background: rgba(239,68,68,.2); color: #fff; border-color: rgba(239,68,68,.4); }
.btn-logout svg { width: 16px; height: 16px; }

/* Hamburger ─────────────────────────────────── */
.hamburger {
  display: none;
  background: none; border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.8);
  cursor: pointer;
  padding: 7px;
  border-radius: var(--r-sm);
  transition: all var(--dur) var(--ease);
  width: 36px; height: 36px;
  align-items: center; justify-content: center;
}
.hamburger:hover { background: rgba(255,255,255,.08); }
.hamburger svg { width: 18px; height: 18px; }

/* Mobile drawer ─────────────────────────────── */
.mobile-drawer {
  display: none;
  position: absolute;
  top: 100%; right: 0; left: 0;
  background: var(--brand-900);
  border-top: 1px solid rgba(255,255,255,.06);
  box-shadow: var(--sh-xl);
  padding: 8px 12px 16px;
  z-index: 400;
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
}
.mobile-drawer.open { display: block; }

.drawer-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  color: rgba(255,255,255,.7);
  border-radius: var(--r);
  font-size: 14px;
  transition: all var(--dur) var(--ease);
  margin-bottom: 2px;
}
.drawer-link:hover, .drawer-link.active { background: rgba(255,255,255,.07); color: #fff; }
.drawer-link.active { color: var(--gold-300); background: rgba(184,134,11,.1); }
.drawer-icon { width: 20px; height: 20px; flex-shrink: 0; opacity: .75; }
.drawer-icon svg { width: 18px; height: 18px; }
.drawer-logout { color: #fca5a5; margin-top: 8px; border-top: 1px solid rgba(255,255,255,.06); padding-top: 12px; }

/* ═══════════════════════════════════════════════════════════════════════════
   PAGE LAYOUT
═══════════════════════════════════════════════════════════════════════════ */
.page-wrap {
  padding-top: var(--nav-h);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.page-content { flex: 1; padding: 28px 28px 40px; max-width: 1800px; margin: 0 auto; width: 100%; }

/* Page hero / breadcrumb bar */
.page-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1.2;
}
.page-title-bar {
  width: 4px; height: 26px;
  background: linear-gradient(180deg, var(--gold-500) 0%, var(--brand-400) 100%);
  border-radius: 2px;
  flex-shrink: 0;
}
.page-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}
.page-date {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 5px 14px;
  border-radius: 100px;
  font-family: 'Inter', sans-serif;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-800);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(58,140,85,.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 10%, rgba(184,134,11,.08) 0%, transparent 50%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.login-box {
  background: #fff;
  border-radius: var(--r-2xl);
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--sh-xl);
  position: relative;
  z-index: 1;
}
.login-logo { text-align: center; margin-bottom: 36px; }
.logo-icon {
  width: 68px; height: 68px;
  background: var(--brand-800);
  border-radius: var(--r-xl);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  color: var(--gold-300);
  box-shadow: 0 8px 24px rgba(15,45,26,.35);
}
.logo-icon svg { width: 34px; height: 34px; }
.login-logo h1 { font-size: 21px; font-weight: 700; color: var(--text-primary); margin-bottom: 5px; }
.login-logo p  { color: var(--text-secondary); font-size: 13px; }
.login-hint {
  margin-top: 22px;
  padding: 14px 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.8;
}
.login-hint code {
  background: var(--border);
  padding: 1px 7px;
  border-radius: var(--r-xs);
  font-family: 'Inter', monospace;
  color: var(--brand-700);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORM CONTROLS
═══════════════════════════════════════════════════════════════════════════ */
.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: .01em;
}

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r);
  font-size: 13.5px;
  font-family: inherit;
  direction: rtl;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
  background: var(--bg-card);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-appearance: none;
}
.form-control:hover:not(:focus):not(:disabled) { border-color: var(--brand-300); }
.form-control:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px rgba(62,140,85,.12);
  background: #fff;
}
.form-control:disabled { opacity: .55; cursor: not-allowed; background: var(--bg-subtle); }
.form-control[readonly] { background: var(--bg-subtle); cursor: default; }
.form-control::placeholder { color: var(--text-muted); }

.form-control[type="number"],
.form-control[type="date"],
.form-control[type="time"],
input[type="number"],
input[type="date"],
input[type="time"] { direction: ltr; text-align: right; font-family: 'Inter', sans-serif; }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 88px; }

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.form-grid-5 { grid-template-columns: repeat(5, 1fr); }
.col-span-2  { grid-column: span 2; }
.col-span-3  { grid-column: span 3; }
.col-span-full { grid-column: 1 / -1; }

/* Input group */
.input-group { position: relative; }
.input-group .form-control { padding-right: 38px; }
.input-group .input-icon {
  position: absolute;
  top: 50%; right: 12px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.input-group .input-icon svg { width: 15px; height: 15px; }

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r);
  border: 1.5px solid transparent;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
  letter-spacing: .01em;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
  background: var(--brand-600);
  color: #fff;
  border-color: var(--brand-700);
  box-shadow: 0 1px 3px rgba(15,45,26,.25), inset 0 1px 0 rgba(255,255,255,.1);
}
.btn-primary:hover {
  background: var(--brand-500);
  border-color: var(--brand-600);
  box-shadow: 0 4px 12px rgba(15,45,26,.3);
  transform: translateY(-1px);
}

.btn-accent {
  background: var(--gold-500);
  color: var(--brand-900);
  border-color: var(--gold-600);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(184,134,11,.25);
}
.btn-accent:hover {
  background: var(--gold-400);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(184,134,11,.3);
}

.btn-danger {
  background: #dc2626;
  color: #fff;
  border-color: #b91c1c;
  box-shadow: 0 1px 3px rgba(220,38,38,.25);
}
.btn-danger:hover { background: #b91c1c; transform: translateY(-1px); }

.btn-success { background: #16a34a; color: #fff; border-color: #15803d; }
.btn-success:hover { background: #15803d; transform: translateY(-1px); }

.btn-info { background: #2563eb; color: #fff; border-color: #1d4ed8; }
.btn-info:hover { background: #1d4ed8; transform: translateY(-1px); }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-color: var(--border-strong);
  box-shadow: var(--sh-xs);
}
.btn-secondary:hover {
  background: var(--bg);
  color: var(--text-primary);
  border-color: var(--brand-300);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); }

.btn-sm   { padding: 5px 12px; font-size: 12px; gap: 5px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg   { padding: 12px 28px; font-size: 14.5px; }
.btn-xl   { padding: 14px 32px; font-size: 15px; width: 100%; justify-content: center; }
.btn-icon { padding: 7px; border-radius: var(--r-sm); }

/* ═══════════════════════════════════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════════════════════════════════ */
.card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 20px;
}

.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  background: var(--bg-subtle);
}

.card-title {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.card-title svg { width: 17px; height: 17px; color: var(--brand-400); flex-shrink: 0; }

.card-body { padding: 22px; }

/* Card accent variants */
.card-accent-top {
  border-top: 3px solid var(--brand-400);
}
.card-accent-right {
  border-right: 3px solid var(--brand-400);
}

/* ═══════════════════════════════════════════════════════════════════════════
   STATS CARDS — Enterprise metric tiles
═══════════════════════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--sh-sm);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 3px; height: 100%;
  border-radius: 0 var(--r-lg) var(--r-lg) 0;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
}

.stat-card.green::after { background: var(--brand-400); }
.stat-card.amber::after { background: var(--gold-500); }
.stat-card.red::after   { background: #ef4444; }
.stat-card.blue::after  { background: #3b82f6; }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }

.stat-card.green .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card.amber .stat-icon { background: var(--gold-50);    color: var(--gold-600); }
.stat-card.red   .stat-icon { background: var(--danger-bg);  color: #dc2626; }
.stat-card.blue  .stat-icon { background: var(--info-bg);    color: var(--info); }

.stat-info { flex: 1; min-width: 0; }
.stat-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
  line-height: 1.2;
}
.stat-value {
  font-size: 26px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  line-height: 1;
  color: var(--text-primary);
  letter-spacing: -.02em;
}
.stat-trend {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  font-family: 'Inter', sans-serif;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABLES — Clean enterprise data table
═══════════════════════════════════════════════════════════════════════════ */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

thead th {
  background: var(--brand-800);
  color: rgba(255,255,255,.9);
  padding: 12px 16px;
  text-align: right;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
}
thead th:first-child { border-radius: 0 var(--r-sm) 0 0; }
thead th:last-child  { border-radius: var(--r-sm) 0 0 0; }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--dur) var(--ease);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:nth-child(even) { background: var(--bg-subtle); }
tbody tr:nth-child(even):hover { background: var(--bg-hover); }

td {
  padding: 11px 16px;
  vertical-align: middle;
  color: var(--text-primary);
  white-space: nowrap;
}

td .btn-sm { opacity: 0; transition: opacity var(--dur) var(--ease); }
tbody tr:hover td .btn-sm { opacity: 1; }

tfoot td {
  padding: 12px 16px;
  font-weight: 700;
  background: var(--bg-subtle);
  border-top: 2px solid var(--border-strong);
  font-family: 'Inter', sans-serif;
}

/* Row states */
.row-danger { background: var(--danger-bg) !important; }
.row-danger:hover { background: #fecaca !important; }
.row-warning { background: var(--warning-bg) !important; }
.row-warning:hover { background: #fde68a !important; }
.row-success { background: var(--success-bg) !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
}
.badge-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-bd); }
.badge-danger  { background: var(--danger-bg);  color: var(--danger);  border: 1px solid var(--danger-bd); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning-bd); }
.badge-info    { background: var(--info-bg);    color: var(--info);    border: 1px solid var(--info-bd); }
.badge-accent  { background: var(--gold-50);    color: var(--gold-700); border: 1px solid var(--gold-100); }
.badge-neutral { background: var(--bg-subtle);  color: var(--text-secondary); border: 1px solid var(--border); }

/* ═══════════════════════════════════════════════════════════════════════════
   MODALS
═══════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 600;
  align-items: center; justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: var(--r-xl);
  width: 100%; max-width: 680px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--sh-xl);
  animation: modalSlideIn var(--dur-md) var(--ease);
}
.modal-lg { max-width: 940px; }
.modal-sm { max-width: 460px; }

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(-20px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--brand-800);
  color: #fff;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  position: sticky; top: 0; z-index: 10;
}
.modal-header h3 { font-size: 15.5px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.modal-header h3 svg { width: 18px; height: 18px; color: var(--gold-300); }

.modal-close {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.15);
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur) var(--ease);
  flex-shrink: 0;
}
.modal-close:hover { background: rgba(255,255,255,.25); }
.modal-close svg { width: 16px; height: 16px; }

.modal-body   { padding: 24px; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; flex-wrap: wrap;
  position: sticky; bottom: 0;
  background: var(--bg-subtle);
  z-index: 10;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ALERTS
═══════════════════════════════════════════════════════════════════════════ */
.alert {
  padding: 12px 16px;
  border-radius: var(--r);
  margin-bottom: 16px;
  font-size: 13.5px;
  display: flex; align-items: flex-start; gap: 10px;
  border-width: 1px; border-style: solid;
  font-weight: 500;
}
.alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success-bd); }
.alert-danger  { background: var(--danger-bg);  color: var(--danger);  border-color: var(--danger-bd); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-bd); }
.alert-info    { background: var(--info-bg);    color: var(--info);    border-color: var(--info-bd); }

/* ═══════════════════════════════════════════════════════════════════════════
   FILTER / SEARCH BAR
═══════════════════════════════════════════════════════════════════════════ */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 14px 18px;
  background: var(--bg-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--sh-xs);
}
.search-input {
  flex: 1; min-width: 200px;
  padding: 9px 13px 9px 13px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r);
  font-size: 13.5px;
  font-family: inherit;
  direction: rtl;
  background: var(--bg-subtle);
  color: var(--text-primary);
  transition: all var(--dur) var(--ease);
}
.search-input:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px rgba(62,140,85,.12);
  background: #fff;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TABS
═══════════════════════════════════════════════════════════════════════════ */
.tabs {
  display: flex; gap: 2px;
  background: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--r-md);
  margin-bottom: 18px;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  box-shadow: var(--sh-xs);
}
.tab {
  padding: 7px 16px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
}
.tab.active { background: #fff; color: var(--text-primary); font-weight: 700; box-shadow: var(--sh-sm); border: 1px solid var(--border); }
.tab:hover:not(.active) { color: var(--text-secondary); background: rgba(255,255,255,.5); }

/* ═══════════════════════════════════════════════════════════════════════════
   MISC COMPONENTS
═══════════════════════════════════════════════════════════════════════════ */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 52px 20px;
  color: var(--text-muted);
}
.empty-state-icon {
  width: 60px; height: 60px;
  background: var(--bg-subtle);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-xl);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.empty-state-icon svg { width: 28px; height: 28px; }
.empty-state h4 { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; max-width: 280px; margin: 0 auto; line-height: 1.6; }

/* Spinner */
.spinner {
  display: inline-block;
  width: 22px; height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--brand-500);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Section label */
.section-label {
  display: flex; align-items: center; gap: 12px;
  margin: 24px 0 14px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted);
}
.section-label::before, .section-label::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* Progress bar */
.progress { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--brand-400); border-radius: 3px; transition: width .4s var(--ease); }
.progress-bar.gold  { background: var(--gold-500); }
.progress-bar.red   { background: #ef4444; }
.progress-bar.blue  { background: #3b82f6; }

/* ═══════════════════════════════════════════════════════════════════════════
   SCROLLBAR
═══════════════════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════════════════════════════════ */
.g-toast {
  font-family: 'Noto Nastaliq Urdu', inherit;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════════════════════════════════════ */
.text-primary   { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted     { color: var(--text-muted) !important; }
.text-success   { color: var(--success) !important; }
.text-danger    { color: #dc2626 !important; }
.text-warning   { color: var(--warning) !important; }
.text-info      { color: var(--info) !important; }
.text-accent    { color: var(--gold-600) !important; }
.text-center    { text-align: center; }
.text-left      { text-align: left; }

.fw-400  { font-weight: 400; }
.fw-bold { font-weight: 700; }
.fw-600  { font-weight: 600; }

.d-flex      { display: flex; }
.align-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap   { flex-wrap: wrap; }
.gap-1       { gap: 8px; }
.gap-2       { gap: 16px; }
.w-100       { width: 100%; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.p-0  { padding: 0; }
.rounded { border-radius: var(--r); }
.mono { font-family: 'Inter', Consolas, monospace; }

/* ═══════════════════════════════════════════════════════════════════════════
   PRINT
═══════════════════════════════════════════════════════════════════════════ */
.print-only-header {
  display: none !important;
}

@media print {
  @page {
    size: landscape;
    margin: 8mm 10mm;
  }
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 10px !important;
  }
  .topnav, .btn, .filter-bar, .tabs, .modal-overlay, .hamburger, .section-divider, .page-hero, .card-header, .no-print {
    display: none !important;
  }
  .print-only-header {
    display: block !important;
    text-align: center;
    margin-bottom: 20px;
    direction: rtl;
  }
  .print-only-header h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 5px 0;
    color: #000;
  }
  .print-only-header p {
    font-size: 11px;
    margin: 0;
    color: #333;
  }
  .page-wrap {
    padding-top: 0 !important;
    margin: 0 !important;
  }
  .page-content {
    padding: 0 !important;
  }
  .card {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    margin: 0 !important;
    padding: 0 !important;
    break-inside: auto !important;
  }
  .table-wrapper {
    overflow: visible !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 9px !important;
  }
  thead {
    display: table-header-group !important;
  }
  tr {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
  th, td {
    padding: 5px 6px !important;
    border: 1px solid #ccc !important;
    color: #000 !important;
    text-align: center !important;
    vertical-align: middle !important;
  }
  table th, thead th, th {
    background-color: #eaeaea !important;
    background: #eaeaea !important;
    color: #000 !important;
    font-weight: bold !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .badge {
    border: 1px solid #777 !important;
    background: transparent !important;
    color: #000 !important;
    padding: 1px 4px !important;
    font-size: 8px !important;
    border-radius: 3px !important;
  }
  .text-danger, .text-success, .text-accent, .fw-bold {
    color: #000 !important;
  }
  #dsTable th:last-child, #dsTable td:last-child,
  #ordersTable th:last-child, #ordersTable td:last-child,
  #rmTable th:last-child, #rmTable td:last-child,
  #deTable th:last-child, #deTable td:last-child {
    display: none !important;
  }
}


/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet ≤ 1100px
═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .nav-label { display: none; }
  .nav-link  { padding: 8px 10px; }
  .form-grid-4, .form-grid-5 { grid-template-columns: repeat(2, 1fr); }
  .stats-grid  { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 900px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile ≤ 768px
═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --nav-h: 58px; }
  .topnav-inner { padding: 0 14px; gap: 6px; }
  .brand-text   { font-size: 13.5px; }
  .brand-sub    { display: none; }
  .page-content { padding: 14px 14px 32px; }

  .stats-grid  { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .stat-value  { font-size: 22px; }
  .stat-icon   { width: 40px; height: 40px; }
  .stat-icon svg { width: 18px; height: 18px; }
  .stat-card   { padding: 14px; gap: 12px; }

  .form-grid, .form-grid-2, .form-grid-3, .form-grid-4, .form-grid-5 { grid-template-columns: 1fr; gap: 10px; }
  .col-span-2, .col-span-3 { grid-column: span 1; }

  .filter-bar  { padding: 10px 12px; flex-direction: column; align-items: stretch; gap: 8px; }
  .search-input { min-width: unset; }

  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal, .modal-lg, .modal-sm {
    max-width: 100%;
    max-height: 96vh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
  }
  .modal-header { border-radius: var(--r-xl) var(--r-xl) 0 0; }

  .card-header { padding: 12px 16px; }
  .card-body   { padding: 14px; }
  .modal-body  { padding: 16px; }
  .modal-footer{ padding: 12px 16px; }
  .page-hero   { margin-bottom: 18px; padding-bottom: 14px; }
  .page-title  { font-size: 18px; }

  td, th { padding: 9px 11px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .user-nm    { display: none; }
  .page-date  { display: none; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   QUICK LINKS (dashboard)
═══════════════════════════════════════════════════════════════════════════ */
.quick-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 14px;
  margin-top: 24px;
}
.quick-link-card {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 20px 14px;
  text-align: center;
  text-decoration: none;
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: var(--sh-sm);
  border-top: 3px solid var(--ql-color, var(--brand-400));
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.quick-link-card:hover { transform: translateY(-4px); box-shadow: var(--sh-md); }
.ql-icon { color: var(--ql-color, var(--brand-400)); display: flex; align-items: center; justify-content: center; }
.ql-label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }

/* ═══════════════════════════════════════════════════════════════════════════
   REPORTS PAGE
═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .reports-grid { grid-template-columns: 1fr !important; }
  .reports-grid > * { grid-column: span 1 !important; }
}