/* Nida Pager design system — tokens, base, components. Logical properties everywhere so RTL/LTR both work. */
:root {
  --brand-900: #045E5A; --brand-800: #088985; --brand-700: #0AA09B; --brand-600: #0AA09B; --brand-500: #0DB3AD; --brand-100: #E8F7F6; --brand-50: #F0F8F7;
  --teal: #0AA09B; --teal-bright: #0DB3AD; --teal-deep: #088985; --teal-dark: #045E5A; --teal-soft: #E8F7F6; --teal-tint: #F0F8F7;
  --accent: #FFC107; --accent-ink: #5B3B00; --coral: #FF6B4A;
  --ok: #138A5E; --ok-bg: #DDF5EA; --ok-ink: #0B5A3D;
  --warn: #B87500; --warn-bg: #FFF8E1; --warn-ink: #6B4500;
  --bad: #C73A3A; --bad-bg: #FDE4E4; --bad-ink: #7C1D1D;
  --ink: #1A1A1A; --ink-deep: #0F1B2D; --muted: #6B6B6B; --line: #EEF1F4; --bg: #FFFFFF; --surface: #FFFFFF; --surface-2: #F4F6F9;
  --r-sm: 12px; --r-md: 16px; --r-lg: 24px; --r-pill: 999px;
  --sh-1: 0 8px 24px rgba(15, 27, 45, .08); --sh-2: 0 16px 40px rgba(15, 27, 45, .12);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --font: 'Tajawal', 'Plex Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --focus: 0 0 0 3px rgba(10, 160, 155, .35);
  --grad-teal: linear-gradient(135deg, #0DB3AD 0%, #0AA09B 42%, #088985 74%, #045E5A 100%);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.55; font-size: 16px; font-variant-numeric: tabular-nums lining-nums; min-height: 100vh; min-height: 100dvh; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.5rem; font-weight: 800; line-height: 1.3; } h2 { font-size: 1.125rem; font-weight: 700; } h3 { font-size: 1rem; font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-600); }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); } .small { font-size: .875rem; } .xs { font-size: .78rem; }
.row { display: flex; align-items: center; gap: var(--s3); } .grow { flex: 1 1 auto; min-width: 0; } .col { display: flex; flex-direction: column; gap: var(--s3); }
.num { font-weight: 700; font-variant-numeric: tabular-nums lining-nums; direction: ltr; unicode-bidi: isolate; letter-spacing: .01em; }

/* Light Tamara chrome: white bar, teal gradient identity card, tidy pill actions. */
.topbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px var(--s3);
  padding: 12px var(--s4);
  background: var(--surface);
  color: var(--ink);
  position: sticky; top: 0; z-index: 20;
  box-shadow: 0 8px 28px rgba(15, 27, 45, .07);
}
.topbar .brand {
  display: flex; align-items: center; gap: var(--s2);
  font-weight: 800;
  min-width: 0; flex: 0 1 auto;
  background: var(--grad-teal);
  color: #fff;
  border-radius: 20px;
  padding: 8px 14px 8px 8px;
  box-shadow: 0 8px 20px rgba(10, 160, 155, .28);
}
.topbar .brand img { width: 32px; height: 32px; border-radius: 10px; }
.topbar .brand > div { min-width: 0; overflow-wrap: anywhere; }
.topbar .sub { font-size: .8rem; opacity: 1; font-weight: 500; color: rgba(255,255,255,.88); }
.topbar .btn.ghost, .topbar .btn.ghost.dark {
  background: var(--teal-soft);
  color: var(--brand-900);
  border: 0;
  border-radius: var(--r-pill);
  min-height: 36px;
  padding: 0 14px;
  font-weight: 700;
  box-shadow: none;
}
@media (hover: hover) and (pointer: fine) {
  .topbar .btn.ghost:hover, .topbar .btn.ghost.dark:hover { background: #d4efed; }
}

.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s4); border: 0; border-radius: var(--r-pill); background: linear-gradient(180deg, #0DB3AD, #0AA09B); color: #fff; font-weight: 700; cursor: pointer; transition: transform .08s, background .15s, opacity .15s, box-shadow .15s; -webkit-tap-highlight-color: transparent; text-decoration: none; box-shadow: 0 8px 18px rgba(10, 160, 155, .24); }
.btn:active { transform: scale(.97); } @media (hover: hover) and (pointer: fine) { .btn:hover { background: linear-gradient(180deg, #0AA09B, #088985); } }
.btn[disabled], .btn[aria-disabled=true] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.secondary { background: var(--surface-2); color: var(--brand-900); box-shadow: none; } @media (hover: hover) and (pointer: fine) { .btn.secondary:hover { background: var(--brand-100); } }
.btn.ok { background: var(--ok); box-shadow: 0 8px 18px rgba(19, 138, 94, .22); } @media (hover: hover) and (pointer: fine) { .btn.ok:hover { background: #0F7550; } }
.btn.warn { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 18px rgba(255, 193, 7, .28); } @media (hover: hover) and (pointer: fine) { .btn.warn:hover { background: #FFB300; } }
.btn.danger { background: var(--bad); box-shadow: 0 8px 18px rgba(199, 58, 58, .22); } .btn.ghost { background: transparent; color: inherit; box-shadow: none; min-height: 36px; padding: 0 var(--s3); font-weight: 500; }
.btn.ghost.dark { color: var(--brand-900); background: var(--teal-soft); }
.btn.lg { min-height: 56px; font-size: 1.1rem; border-radius: var(--r-pill); } .btn.sm { min-height: 36px; padding: 0 var(--s3); font-size: .875rem; } .btn.block { width: 100%; }
.btn .spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.card { background: var(--surface); border: 0; border-radius: var(--r-lg); box-shadow: var(--sh-1); padding: var(--s4); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--r-pill); font-size: .8rem; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 0; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok-ink); } .chip.warn { background: var(--warn-bg); color: var(--warn-ink); }
.chip.bad { background: var(--bad-bg); color: var(--bad-ink); } .chip.info { background: var(--brand-100); color: var(--brand-900); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }
.conn { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; padding: 4px 12px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--ink); font-weight: 700; box-shadow: 0 2px 8px rgba(15, 27, 45, .05); }
.conn[data-s=live] .dot { background: #138A5E; } .conn[data-s=reconnecting] .dot, .conn[data-s=connecting] .dot { background: var(--accent); animation: pulse 1s infinite; } .conn[data-s=offline] .dot, .conn[data-s=fatal] .dot { background: var(--coral); }
@keyframes pulse { 50% { opacity: .25; } }
.field { display: flex; flex-direction: column; gap: 6px; } .field label { font-weight: 700; font-size: .9rem; }
.input { min-height: 46px; padding: 0 var(--s3); border: 0; border-radius: var(--r-md); background: var(--surface-2); width: 100%; }
.input:focus { outline: none; background: #fff; box-shadow: var(--focus); } .input[aria-invalid=true] { box-shadow: 0 0 0 2px var(--bad); }
.field-error { color: var(--bad-ink); font-size: .85rem; min-height: 1.2em; }
.seg { display: inline-flex; background: var(--surface-2); border: 0; border-radius: var(--r-pill); padding: 4px; gap: 3px; }
.seg button { border: 0; background: transparent; min-height: 38px; padding: 0 var(--s4); border-radius: var(--r-pill); font-weight: 700; color: var(--muted); cursor: pointer; }
.seg button[aria-pressed=true] { background: #fff; color: var(--brand-900); box-shadow: 0 4px 14px rgba(15, 27, 45, .08); }
.banner { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); font-size: .9rem; font-weight: 500; border-radius: 0; }
.banner.warn { background: var(--warn-bg); color: var(--warn-ink); } .banner.bad { background: var(--bad-bg); color: var(--bad-ink); } .banner.info { background: var(--brand-100); color: var(--brand-900); }
.empty { text-align: center; color: var(--muted); padding: var(--s6) var(--s4); border: 0; border-radius: var(--r-lg); background: var(--surface-2); }
.empty .big { font-size: 2.2rem; display: block; margin-bottom: var(--s2); }
.errbox { text-align: center; padding: var(--s6) var(--s4); } .errbox h2 { margin-bottom: var(--s2); } .errbox .big { font-size: 3rem; display: block; margin-bottom: var(--s3); }
.skeleton { background: linear-gradient(90deg, #E8F7F6 25%, #F4F6F9 37%, #E8F7F6 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r-md); }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 45;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -12px 40px rgba(15, 27, 45, .12);
  padding: var(--s5) var(--s4) calc(var(--s5) + env(safe-area-inset-bottom));
}

.toasts { position: fixed; inset-inline: 0; bottom: var(--s4); display: flex; flex-direction: column; align-items: center; gap: var(--s2); z-index: 60; pointer-events: none; padding: 0 var(--s4); }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-md); box-shadow: var(--sh-2); font-weight: 500; max-width: 480px; animation: rise .2s ease-out; pointer-events: auto; } .toast.bad { background: var(--bad); } .toast.ok { background: var(--ok); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }
.switch { position: relative; width: 48px; height: 28px; flex: none; } .switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; background: #C5CDD6; border-radius: var(--r-pill); transition: background .15s; } .switch .track::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: var(--sh-1); }
.switch input:checked + .track { background: var(--brand-500); } .switch input:checked + .track::after { transform: translateX(20px); } [dir=rtl] .switch input:checked + .track::after { transform: translateX(-20px); }
.switch input:disabled + .track { opacity: .45; } .switch input:focus-visible + .track { box-shadow: var(--focus); }

.status { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: var(--r-pill); font-weight: 700; font-size: 1rem; }
.status.preparing { background: var(--warn-bg); color: var(--warn-ink); } .status.ready { background: var(--ok-bg); color: var(--ok-ink); } .status.picked_up, .status.cancelled { background: var(--surface-2); color: var(--muted); }
.stepper { display: flex; align-items: center; justify-content: space-between; position: relative; padding: 0 var(--s2); }
.stepper .step { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; font-size: .8rem; color: var(--muted); font-weight: 600; position: relative; z-index: 1; text-align: center; }
.stepper .step i { width: 28px; height: 28px; border-radius: 50%; background: #E8EDF2; display: grid; place-items: center; font-style: normal; color: #fff; font-size: .8rem; }
.stepper .step.done i { background: var(--brand-500); } .stepper .step.now i { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 5px rgba(244,181,63,.3); } .stepper .step.now.ready i { background: var(--ok); color: #fff; box-shadow: 0 0 0 5px rgba(19,138,94,.25); } .stepper .step.now { color: var(--ink); }
.stepper::before { content: ''; position: absolute; top: 14px; inset-inline: 16%; height: 3px; background: #E8EDF2; z-index: 0; }

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