/* ===================================================
   DELIVERY PRO SYSTEM — Design Tokens & Reset
   =================================================== */

/* ===== DARK MODE (default) ===== */
:root {
  --brand:        #4F6EF5;
  --brand-dark:   #3A54D6;
  --brand-light:  #7C97FF;
  --brand-ghost:  rgba(79,110,245,0.12);
  --brand-border: rgba(79,110,245,0.30);
  --brand-grad:   linear-gradient(135deg, #5B7CFF 0%, #4F6EF5 55%, #7A4FF5 100%);

  --bg:   #0D1224;
  --bg-2: #161D33;
  --bg-3: #1D2540;
  --bg-4: #262F4F;
  --bg-5: #333D60;

  --text:   #F2F4FB;
  --text-2: #9CA6C9;
  --text-3: #6C7699;

  --border:   rgba(255,255,255,0.07);
  --border-2: rgba(255,255,255,0.12);

  --green:        #2ED47A;
  --green-ghost:  rgba(46,212,122,0.12);
  --amber:        #FFB020;
  --amber-ghost:  rgba(255,176,32,0.12);
  --blue:         #3DA9FC;
  --blue-ghost:   rgba(61,169,252,0.12);
  --red:          #FF4D6A;
  --red-ghost:    rgba(255,77,106,0.12);
  --purple:       #B368FF;
  --purple-ghost: rgba(179,104,255,0.12);

  --radius:    12px;
  --radius-lg: 18px;
  --radius-xl: 26px;

  --font: 'Almarai', sans-serif;
  --mono: 'JetBrains Mono', monospace;

  --shadow:      0 4px 28px rgba(3,6,16,0.55);
  --shadow-sm:   0 2px 10px rgba(3,6,16,0.35);
  --shadow-glow: 0 8px 28px rgba(79,110,245,0.30);

  --sidebar-width: 240px;
  --transition:    0.2s cubic-bezier(0.4,0,0.2,1);
}

/* ===== LIGHT MODE ===== */
html[data-theme="light"] {
  --brand-light:  #3A54D6;
  --brand-ghost:  rgba(79,110,245,0.10);
  --brand-border: rgba(79,110,245,0.30);

  --bg:   #E4E8F2;
  --bg-2: #F8F9FC;
  --bg-3: #ECEFF7;
  --bg-4: #DDE2F0;
  --bg-5: #C4CCE2;

  --text:   #10162A;
  --text-2: #333D5E;
  --text-3: #59638A;

  --border:   rgba(16,22,42,0.11);
  --border-2: rgba(16,22,42,0.18);

  --green:        #1A8F52;
  --green-ghost:  rgba(26,143,82,0.12);
  --amber:        #B5790A;
  --amber-ghost:  rgba(181,121,10,0.12);
  --blue:         #1873C4;
  --blue-ghost:   rgba(24,115,196,0.12);
  --red:          #D42C4E;
  --red-ghost:    rgba(212,44,78,0.12);
  --purple:       #7C35D6;
  --purple-ghost: rgba(124,53,214,0.12);

  --shadow:      0 4px 24px rgba(16,22,42,0.13);
  --shadow-sm:   0 2px 8px rgba(16,22,42,0.09);
  --shadow-glow: 0 8px 24px rgba(79,110,245,0.22);
}

/* Light mode: bump weight/color of small or secondary text so it holds up
   against the brighter background (dark mode's neon-on-navy palette already
   has plenty of contrast and is left untouched). */
html[data-theme="light"] thead th        { color: var(--text-2); font-weight: 800; }
html[data-theme="light"] tbody td        { font-weight: 600; }
html[data-theme="light"] .badge          { font-weight: 800; }
html[data-theme="light"] .stat-label     { color: var(--text-2); }
html[data-theme="light"] .nav-section-title { color: var(--text-2); }
html[data-theme="light"] .nav-item       { font-weight: 600; }
html[data-theme="light"] .nav-item.active,
html[data-theme="light"] .nav-item.active .nav-icon {
  color: var(--brand-dark);
}
html[data-theme="light"] .mobile-card-label { color: var(--text-2); font-weight: 700; }
html[data-theme="light"] .detail-label   { color: var(--text-2); }
html[data-theme="light"] .fin-item .fin-label { color: var(--text-2); }

/* ===== SMOOTH THEME TRANSITION ===== */
*,
*::before,
*::after {
  transition:
    background-color 0.22s ease,
    border-color     0.22s ease,
    color            0.22s ease,
    box-shadow       0.22s ease;
}
/* Exclude elements where transition causes visual glitches */
.spinner,
.nav-item,
.btn,
img,
svg {
  transition: none;
}
.btn { transition: all var(--transition); }
.nav-item { transition: all var(--transition); }

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* Base type scale — every font-size elsewhere in the app is in rem,
   relative to this root, so bumping it (and adapting it per breakpoint)
   scales the whole UI's text consistently and responsively. */
html { font-size: 15.5px; }                              /* desktop / laptop (default) */
@media (max-width: 1279px) { html { font-size: 15.25px; } } /* small laptop */
@media (max-width: 1024px) { html { font-size: 15px; } }    /* tablet */
@media (max-width: 640px)  { html { font-size: 14.5px; } }  /* mobile phone */
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
input, select, textarea, button { font-family: var(--font); }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }
img { max-width: 100%; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--bg-5); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ===== UTILITY ===== */
.hidden  { display: none !important; }
.sr-only { position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0; }
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }  .gap-2 { gap: 8px; }  .gap-3 { gap: 12px; }
.gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.w-full    { width: 100%; }
.text-sm   { font-size: 0.857rem; }
.text-xs   { font-size: 0.786rem; }
.font-mono { font-family: var(--mono); }
.text-muted   { color: var(--text-2); }
.text-dimmed  { color: var(--text-3); }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== THEME TOGGLE BUTTON ===== */
.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border-2);
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.143rem;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--text-2);
  transition: background 0.2s, border-color 0.2s, transform 0.15s !important;
}
.theme-toggle-btn svg { width: 18px; height: 18px; }
.theme-toggle-btn:hover {
  background: var(--bg-4);
  border-color: var(--brand-border);
  transform: scale(1.1);
}