/* =====================================================================
   dr3 development — لوحة تحكم المطاعم والكافيهات
   ألوان التاجر تُحقن من قاعدة البيانات (--brand / --cream) — خط IBM Plex Sans Arabic + Fraunces للأرقام
   ===================================================================== */

:root {
  --brand: #16181D;
  --cream: #F2EEE8;
  --brand-2: color-mix(in srgb, var(--brand) 82%, white);
  --brand-soft: color-mix(in srgb, var(--brand) 9%, transparent);
  --brand-line: color-mix(in srgb, var(--brand) 22%, transparent);

  --bg: #F6F1EA;
  --surface: #FFFFFF;
  --surface-2: #FBF8F4;
  --surface-3: #F3ECE3;
  --ink: #2A1715;
  --ink-2: #4D3A36;
  --muted: #8C7C75;
  --line: #EBE2D7;
  --line-2: #DED2C4;

  --primary-bg: var(--brand);
  --primary-fg: var(--cream);

  --ok: #2E7D4F;   --ok-bg: #E5F3EA;
  --warn: #A86411; --warn-bg: #FBEFD9;
  --danger: #B42318; --danger-bg: #FDE8E6;
  --info: #285EA8; --info-bg: #E5EEFA;

  --sidebar-bg: var(--brand);
  --sidebar-fg: var(--cream);

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(42, 23, 21, .05);
  --shadow: 0 1px 2px rgba(42, 23, 21, .04), 0 6px 24px -8px rgba(42, 23, 21, .10);
  --shadow-lg: 0 24px 64px -16px rgba(42, 23, 21, .35);

  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --font-num: 'Fraunces', 'IBM Plex Sans Arabic', Georgia, serif;
  --sb-w: 264px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

[data-theme="dark"] {
  --bg: #140A09;
  --surface: #1E1210;
  --surface-2: #241614;
  --surface-3: #2C1C19;
  --ink: #F4EADF;
  --ink-2: #D9CABD;
  --muted: #A3918A;
  --line: #34231F;
  --line-2: #47302B;
  --primary-bg: var(--cream);
  --primary-fg: #2A0306;
  --brand-soft: rgba(239, 227, 211, .07);
  --brand-line: rgba(239, 227, 211, .18);
  --ok-bg: rgba(46, 125, 79, .18);   --ok: #6FCF97;
  --warn-bg: rgba(168, 100, 17, .2); --warn: #F2B65A;
  --danger-bg: rgba(180, 35, 24, .2); --danger: #FF8A80;
  --info-bg: rgba(40, 94, 168, .2); --info: #8AB4F8;
  --sidebar-bg: #1A0B0A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .5);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.6;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; font-weight: 600; }
p { margin: 0; }
small, .small { font-size: 12.5px; }
.muted { color: var(--muted); }
.danger-text { color: var(--danger) !important; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.cur { font-family: var(--font); font-size: .72em; font-weight: 500; color: var(--muted); margin-inline-start: 2px; }
[hidden] { display: none !important; }
::selection { background: var(--brand); color: var(--cream); }

.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
[data-theme="light"] .show-dark, [data-theme="dark"] .show-light { display: none; }

/* ================= الهيكل ================= */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sb-w); flex: none; position: sticky; top: 0; height: 100vh;
  background: var(--sidebar-bg); color: var(--sidebar-fg);
  display: flex; flex-direction: column; z-index: 40;
  transition: width .25s var(--ease), transform .25s var(--ease);
}
.sidebar::after { /* حبوب ناعمة */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: radial-gradient(120% 60% at 100% 0%, rgba(255,255,255,.08), transparent 60%);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; position: relative; z-index: 1; }
.brand-logo { width: 46px; height: 46px; border-radius: 12px; overflow: hidden; flex: none; background: rgba(0,0,0,.18); box-shadow: inset 0 0 0 1px rgba(239,227,211,.15); }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.brand-logo b { display: grid; place-items: center; width: 100%; height: 100%; font-family: var(--font-num); font-size: 18px; color: var(--sidebar-fg); }
.powered { font-size: 11px; opacity: .45; padding: 10px 12px 0; letter-spacing: .2px; white-space: nowrap; }
.powered b { font-family: var(--font-num); font-weight: 600; letter-spacing: .4px; direction: ltr; unicode-bidi: isolate; }
.sb-mini .powered span { display: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-family: var(--font-num); font-size: 18px; letter-spacing: .5px; white-space: nowrap; }
.brand-text small { opacity: .65; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; position: relative; z-index: 1; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-section { font-size: 11px; letter-spacing: .3px; opacity: .5; padding: 16px 12px 6px; font-weight: 600; }
.nav-link {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 10px;
  color: inherit; opacity: .78; background: none; border: 0; cursor: pointer; text-align: start;
  transition: background .15s, opacity .15s; white-space: nowrap; position: relative;
}
.nav-link:hover { opacity: 1; background: rgba(239, 227, 211, .08); }
.nav-link.active { opacity: 1; background: var(--cream); color: var(--brand); font-weight: 600; }
[data-theme="dark"] .nav-link.active { background: rgba(239,227,211,.12); color: var(--cream); }
.nav-link .ic { width: 19px; height: 19px; }
.nav-count { margin-inline-start: auto; background: #E5484D; color: #fff; font-size: 11px; min-width: 22px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; animation: pop .3s var(--ease); }
.sidebar-foot { padding: 10px 12px 16px; border-top: 1px solid rgba(239,227,211,.1); position: relative; z-index: 1; }
.sidebar-foot .ic { transition: transform .25s; }

.sb-mini { --sb-w: 76px; }
.sb-mini .brand-text, .sb-mini .nav-link span, .sb-mini .nav-section { display: none; }
.sb-mini .nav-link { justify-content: center; }
.sb-mini .nav-count { position: absolute; top: 2px; inset-inline-end: 2px; min-width: 18px; height: 18px; font-size: 10px; }
.sb-mini .sidebar-foot .ic { transform: rotate(180deg); }
.sb-mini .brand { justify-content: center; padding-inline: 10px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px;
  padding: 14px 28px; background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 21px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.search-trigger {
  margin-inline-start: auto; display: flex; align-items: center; gap: 10px; min-width: 260px;
  padding: 9px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  color: var(--muted); cursor: pointer; transition: border-color .15s;
}
.search-trigger:hover { border-color: var(--line-2); }
.search-trigger + .topbar-actions { margin-inline-start: 0; }
.search-trigger kbd { margin-inline-start: auto; }
kbd { font-family: ui-monospace, monospace; font-size: 11px; padding: 2px 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); color: var(--muted); direction: ltr; }

.content { padding: 8px 28px 48px; max-width: 1480px; width: 100%; }
.only-mobile { display: none !important; }
.sidebar-backdrop { display: none; }

/* ================= أزرار ================= */
.btn {
  --b: var(--surface); --f: var(--ink); --bd: var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 11px; border: 1px solid var(--bd);
  background: var(--b); color: var(--f); font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: transform .1s, background .15s, border-color .15s, box-shadow .15s; line-height: 1.4;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .ic { width: 17px; height: 17px; }
.btn-primary { --b: var(--primary-bg); --f: var(--primary-fg); --bd: var(--primary-bg); box-shadow: 0 1px 0 rgba(255,255,255,.12) inset, 0 4px 14px -6px color-mix(in srgb, var(--brand) 60%, transparent); }
.btn-primary:hover { --b: color-mix(in srgb, var(--primary-bg) 88%, white); border-color: var(--b); }
.btn-ghost { --b: transparent; --bd: transparent; }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-danger { --b: var(--danger-bg); --f: var(--danger); --bd: transparent; }
.btn-danger:hover { --b: var(--danger); --f: #fff; }
.btn-ok { --b: var(--ok); --f: #fff; --bd: var(--ok); }
.btn-warn { --b: var(--warn); --f: #fff; --bd: var(--warn); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 13px 20px; font-size: 15.5px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 11px; display: inline-grid; place-items: center; position: relative;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--ink-2); transition: background .15s;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; border: 0; background: transparent; }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-bg); }
.bell b { position: absolute; top: -4px; inset-inline-end: -4px; background: #E5484D; color: #fff; font-size: 10.5px; min-width: 19px; height: 19px; border-radius: 10px; display: grid; place-items: center; padding: 0 5px; border: 2px solid var(--bg); }
.link { color: var(--brand); font-size: 13px; font-weight: 500; }
[data-theme="dark"] .link { color: var(--cream); }
.link:hover { text-decoration: underline; }

/* ================= المستخدم ================= */
.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.user-meta { display: flex; flex-direction: column; text-align: start; line-height: 1.25; }
.user-meta strong { font-size: 13px; }
.user-meta small { font-size: 11.5px; color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--brand); color: var(--cream); font-weight: 600; font-size: 13px; }
[data-theme="dark"] .avatar { background: var(--cream); color: var(--brand); }
.avatar.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 22px; }
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-6px); pointer-events: none; transition: .15s var(--ease); z-index: 50;
}
.dropdown.open .dropdown-menu { opacity: 1; transform: none; pointer-events: auto; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; background: none; border: 0; cursor: pointer; text-align: start; }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-3); }
.dropdown-menu form { margin: 0; }

/* ================= بطاقات وشبكات ================= */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-width: 0; display: flex; flex-direction: column; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; flex-wrap: wrap; }
.card-head h3 { font-size: 15.5px; display: flex; align-items: center; gap: 8px; }
.card-head .muted { font-size: 12.5px; }
.card-body { padding: 16px 20px 20px; flex: 1; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }
.card + .card { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: 20px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.grid-2.narrow { max-width: 1100px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.grid-dash { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin-top: 20px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar-end { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-inline-start: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 500; color: var(--ink-2); transition: .15s; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.chip:hover { border-color: var(--line-2); }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .count { font-size: 11px; opacity: .7; }
.segmented { display: inline-flex; padding: 4px; background: var(--surface-3); border-radius: 12px; gap: 2px; }
.segmented a, .segmented button { padding: 6px 14px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--muted); border: 0; background: none; cursor: pointer; }
.segmented .active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ================= KPIs ================= */
.kpis { display: grid; grid-template-columns: 1.25fr repeat(3, 1fr); gap: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; position: relative; overflow: hidden; }
.kpi-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.kpi-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
[data-theme="dark"] .kpi-icon { color: var(--cream); }
.kpi-value { font-family: var(--font-num); font-size: 30px; font-weight: 700; letter-spacing: -.5px; line-height: 1.1; direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.kpi-value .cur { font-size: 14px; }
.kpi-label { color: var(--muted); margin-top: 6px; font-size: 13px; }
.kpi-label small { display: block; font-size: 11.5px; opacity: .8; }
.kpi-hero { background: var(--brand); color: var(--cream); border-color: transparent; }
[data-theme="dark"] .kpi-hero { background: linear-gradient(135deg, #4A0508, #2A0306); }
.kpi-hero::before { content: ""; position: absolute; width: 220px; height: 220px; border-radius: 50%; inset-inline-start: -70px; bottom: -110px; background: radial-gradient(circle, rgba(239,227,211,.16), transparent 70%); }
.kpi-hero .kpi-icon { background: rgba(239,227,211,.12); color: var(--cream); }
.kpi-hero .kpi-label, .kpi-hero .cur { color: rgba(239,227,211,.7); }
.kpi-hero .delta.up { background: rgba(111, 207, 151, .18); color: #9BE3B7; }
.kpi-hero .delta.down { background: rgba(255,138,128,.18); color: #FFB4AB; }
.delta { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; direction: ltr; }
.delta.up { color: var(--ok); background: var(--ok-bg); }
.delta.down { color: var(--danger); background: var(--danger-bg); }
.delta.flat { color: var(--muted); background: var(--surface-3); }

/* ================= الرسوم ================= */
.chart { height: 260px; position: relative; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-dasharray: 3 4; }
.chart .axis-lbl { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .area { fill: url(#gradA); }
.chart .line-a { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
[data-theme="dark"] .chart .line-a { stroke: var(--cream); }
.chart .line-b { fill: none; stroke: var(--line-2); stroke-width: 2; stroke-dasharray: 5 5; }
.chart .dot[cx="-10"] { opacity: 0; }
.chart .dot { fill: var(--surface); stroke: var(--brand); stroke-width: 2.5; }
[data-theme="dark"] .chart .dot { stroke: var(--cream); }
.chart .hover-line { stroke: var(--muted); stroke-dasharray: 2 3; }
.chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: 10px; font-size: 12.5px; white-space: nowrap; transform: translate(50%, -110%); box-shadow: var(--shadow-lg); z-index: 3; }
.chart-tip b { font-family: var(--font-num); font-size: 15px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.lg::before { content: ""; display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-inline-end: 6px; vertical-align: middle; }
.lg-a::before { background: var(--brand); }
[data-theme="dark"] .lg-a::before { background: var(--cream); }
.lg-b::before { background: var(--line-2); }

.bar { height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 55%, #C08A5B), var(--brand)); transform-origin: right; animation: grow .8s var(--ease) both; }
[data-theme="dark"] .bar i { background: linear-gradient(90deg, #8C6A4F, var(--cream)); }
@keyframes grow { from { transform: scaleX(0); } }

.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.rank-list li { display: flex; gap: 12px; align-items: center; }
.rank { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); font-size: 12px; font-weight: 600; flex: none; }
.rank-list li:first-child .rank { background: var(--brand); color: var(--cream); }
.rank-main { flex: 1; min-width: 0; }
.rank-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 13.5px; }
.rank-row strong { font-weight: 500; display: flex; gap: 8px; align-items: center; }
.branch-perf + .branch-perf { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }

.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut { width: 140px; height: 140px; flex: none; transform: scaleX(-1); }
.donut circle { transition: stroke-dasharray .6s; }
.donut text { transform: scaleX(-1); transform-origin: 21px 21px; text-anchor: middle; fill: var(--ink); }
.donut-num { font-family: var(--font-num); font-size: 7px; font-weight: 700; }
.donut-lbl { font-size: 3.4px; fill: var(--muted) !important; }
.donut-legend { list-style: none; margin: 0; padding: 0; flex: 1; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.donut-legend li { display: flex; align-items: center; gap: 8px; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; }
.donut-legend b { margin-inline-start: auto; }

.heatmap { display: flex; flex-direction: column; gap: 4px; overflow-x: auto; }
.hm-row { display: grid; grid-template-columns: 64px repeat(18, minmax(18px, 1fr)); gap: 4px; align-items: center; }
.hm-head span { font-size: 10.5px; color: var(--muted); text-align: center; }
.hm-day { font-size: 12px; color: var(--muted); }
.hm-cell { aspect-ratio: 1.6; border-radius: 5px; background: color-mix(in srgb, var(--brand) calc(var(--a) * 100%), var(--surface-3)); transition: transform .15s; }
[data-theme="dark"] .hm-cell { background: color-mix(in srgb, #E9B98A calc(var(--a) * 100%), var(--surface-3)); }
.hm-cell:hover { transform: scale(1.25); outline: 2px solid var(--surface); }

.live-card .card-head h3 { gap: 10px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: #2EBD6B; box-shadow: 0 0 0 0 rgba(46,189,107,.6); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(46,189,107,0); } 100% { box-shadow: 0 0 0 0 rgba(46,189,107,0); } }
.live-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ls { border-radius: 12px; padding: 12px 8px; text-align: center; transition: transform .15s; }
.ls:hover { transform: translateY(-2px); }
.ls b { display: block; font-family: var(--font-num); font-size: 28px; line-height: 1.1; }
.ls span { font-size: 12.5px; }
.ls-new { background: var(--info-bg); color: var(--info); }
.ls-prep { background: var(--warn-bg); color: var(--warn); }
.ls-ready { background: var(--ok-bg); color: var(--ok); }
.mini-stats { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; }
.mini-stats li { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-size: 13.5px; }
.mini-stats li + li { border-top: 1px dashed var(--line); }
.mini-stats .ic { color: var(--muted); width: 16px; height: 16px; }
.mini-stats b { margin-inline-start: auto; font-weight: 600; }
.lc-big { font-family: var(--font-num); font-size: 32px; font-weight: 700; line-height: 1.1; }
.lc-big small { font-family: var(--font); font-size: 13px; font-weight: 400; color: var(--muted); }

.people { list-style: none; margin: 0; padding: 0; }
.people li a { display: flex; align-items: center; gap: 12px; padding: 9px 8px; margin: 0 -8px; border-radius: 10px; }
.people li a:hover { background: var(--surface-2); }
.people-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: center; }
.people-main small { flex-basis: 100%; }

/* ================= شارات ================= */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; line-height: 1.6; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-muted { background: var(--surface-3); color: var(--muted); }
.badge-plain::before { display: none; }
.tier { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: var(--tier); background: color-mix(in srgb, var(--tier) 14%, transparent); border: 1px solid color-mix(in srgb, var(--tier) 30%, transparent); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 11.5px; background: var(--surface-3); color: var(--ink-2); }

/* ================= تنبيهات ================= */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; animation: slideIn .3s var(--ease); }
.alert .ic { margin-top: 2px; }
.alert-success { background: var(--ok-bg); color: var(--ok); }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-info { background: var(--info-bg); color: var(--info); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }
@keyframes slideIn { from { opacity: 0; transform: translateY(-6px); } }
@keyframes pop { from { transform: scale(.4); } }

.toasts { position: fixed; bottom: 24px; inset-inline-start: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 14px; animation: toastIn .3s var(--ease); max-width: 380px; }
.toast.error { background: var(--danger); color: #fff; }
.toast.hide { opacity: 0; transform: translateY(10px); transition: .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.96); } }

/* ================= جداول ================= */
.table-wrap { overflow-x: auto; }
.card > .table-wrap { padding: 8px 8px 4px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { text-align: start; font-weight: 500; font-size: 12.5px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.row-link { cursor: pointer; }
.table .ic { width: 15px; height: 15px; color: var(--muted); }
.table .actions { display: flex; gap: 4px; justify-content: flex-end; }
.table .num { font-variant-numeric: tabular-nums; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user .avatar { width: 32px; height: 32px; font-size: 12px; }
.cell-user small { display: block; color: var(--muted); }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--surface-3); display: grid; place-items: center; color: var(--muted); flex: none; font-size: 20px; }

.pagination { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; gap: 8px; flex-wrap: wrap; }
.pagination div { display: flex; gap: 4px; }

.empty-state { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty-state.big { padding: 80px 20px; max-width: 460px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-state.big .ic { width: 52px; height: 52px; padding: 12px; border-radius: 16px; background: var(--surface-3); color: var(--ink-2); }
.empty-state.big h2 { color: var(--ink); font-size: 20px; }
.debug { background: var(--surface-3); padding: 12px; border-radius: 10px; font-size: 12px; direction: ltr; text-align: left; white-space: pre-wrap; max-width: 100%; }

/* ================= النماذج ================= */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field > span small, .field-hint { font-size: 12px; color: var(--muted); font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=url], input[type=date], input[type=time], input[type=datetime-local], input:not([type]), select, textarea {
  width: 100%; padding: 10px 13px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface);
  outline: none; transition: border-color .15s, box-shadow .15s; min-height: 42px;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
[data-theme="dark"] input:focus, [data-theme="dark"] select:focus, [data-theme="dark"] textarea:focus { border-color: var(--cream); }
input:disabled { background: var(--surface-3); color: var(--muted); }
textarea { resize: vertical; min-height: 84px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238C7C75' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; padding-left: 32px; }
input[type=color] { width: 48px; height: 42px; padding: 3px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); cursor: pointer; }
input[type=number] { direction: ltr; text-align: right; }
.input-group { display: flex; align-items: stretch; }
.input-group input { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line-2); border-inline-start: 0; border-radius: 0 11px 11px 0; background: var(--surface-3); font-size: 13px; color: var(--muted); white-space: nowrap; }
html[dir=rtl] .input-group input { border-radius: 0 11px 11px 0; }
html[dir=rtl] .input-group .addon { border-radius: 11px 0 0 11px; border-inline-start: 0; border-inline-end: 1px solid var(--line-2); }
.input-icon { position: relative; }
.input-icon input { padding-left: 44px !important; }
.input-icon .icon-btn { position: absolute; left: 5px; top: 50%; transform: translateY(-50%); }
.search-input { position: relative; min-width: 240px; }
.search-input .ic { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-input input { padding-inline-start: 38px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.col-2 { grid-column: span 2; }
.col-full { grid-column: 1 / -1; }
.divider-label { font-weight: 600; font-size: 13.5px; padding-top: 10px; border-top: 1px dashed var(--line); margin-top: 4px; }

/* سويتش */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 42px; height: 24px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.switch input:checked + .track { background: var(--ok); }
.switch input:checked + .track::after { transform: translateX(-18px); }
html[dir=ltr] .switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px var(--brand-soft); }
.switch.sm .track { width: 36px; height: 20px; }
.switch.sm .track::after { width: 14px; height: 14px; }
.switch.sm input:checked + .track::after { transform: translateX(-16px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; }
.switch-row + .switch-row { border-top: 1px dashed var(--line); }
.switch-row strong { display: block; font-weight: 500; }
.switch-row small { color: var(--muted); }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
[data-theme="dark"] .check input { accent-color: var(--cream); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.check-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 11px; cursor: pointer; transition: .15s; font-size: 13.5px; }
.check-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
[data-theme="dark"] .check-card:has(input:checked) { border-color: var(--cream); }
.check-card input { accent-color: var(--brand); width: 17px; height: 17px; }
.check-card small { display: block; color: var(--muted); font-size: 11.5px; }

/* رفع صورة */
.upload { position: relative; border: 1.5px dashed var(--line-2); border-radius: 14px; aspect-ratio: 4/3; display: grid; place-items: center; text-align: center; overflow: hidden; background: var(--surface-2); cursor: pointer; transition: border-color .15s; }
.upload:hover { border-color: var(--brand); }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.upload .upload-hint { color: var(--muted); font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; }
.upload .upload-hint .ic { width: 30px; height: 30px; }
.upload.square { aspect-ratio: 1; }
.upload.wide { aspect-ratio: 16/7; }

/* ================= تبويبات ================= */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 16px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-bottom-color: var(--brand); }
[data-theme="dark"] .tabs a.active { border-bottom-color: var(--cream); }
.tabs .count { font-size: 11px; background: var(--surface-3); padding: 0 7px; border-radius: 999px; }

/* ================= مودال ================= */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(20, 8, 6, .45); backdrop-filter: blur(3px); animation: fade .2s; }
.modal-box { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); animation: modalIn .25s var(--ease); }
.modal-box.lg { width: min(820px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface-2); position: sticky; bottom: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }

/* ================= لوحة البحث ================= */
.palette { position: fixed; inset: 0; z-index: 150; background: rgba(20, 8, 6, .4); backdrop-filter: blur(3px); display: flex; justify-content: center; padding-top: 12vh; animation: fade .15s; }
.palette-box { width: min(620px, calc(100% - 32px)); background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; height: fit-content; animation: modalIn .2s var(--ease); }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.palette-input input { border: 0; padding: 0; min-height: 0; font-size: 16px; box-shadow: none !important; background: transparent; }
.palette-results { max-height: 380px; overflow-y: auto; padding: 6px; }
.palette-results .grp { font-size: 11.5px; color: var(--muted); padding: 10px 12px 4px; }
.palette-results a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; }
.palette-results a small { margin-inline-start: auto; color: var(--muted); }
.palette-results a.sel { background: var(--brand-soft); }
.palette-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); background: var(--surface-2); }

/* ================= لوحة الطلبات الحية ================= */
.board-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 18px; }
.branch-toggles { display: flex; gap: 10px; flex-wrap: wrap; }
.bt { display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.bt strong { font-size: 13.5px; font-weight: 600; }
.bt .bt-actions { display: flex; gap: 4px; }
.bt.paused { border-color: var(--danger); background: var(--danger-bg); }
.bt.busy { border-color: var(--warn); }
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.col { background: var(--surface-3); border-radius: 16px; padding: 10px; min-height: 60vh; }
[data-theme="dark"] .col { background: var(--surface-2); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px 12px; font-weight: 600; }
.col-head .n { margin-inline-start: auto; font-family: var(--font-num); font-size: 18px; }
.col-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.col-new .dot { background: var(--info); }
.col-preparing .dot { background: var(--warn); }
.col-ready .dot { background: var(--ok); }
.col-list { display: flex; flex-direction: column; gap: 10px; }
.col-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 30px 10px; border: 1.5px dashed var(--line-2); border-radius: 12px; }

.ocard { background: var(--surface); border-radius: 14px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); padding: 14px; animation: cardIn .35s var(--ease); position: relative; }
.ocard.is-new { box-shadow: 0 0 0 2px var(--info), var(--shadow); animation: cardIn .35s var(--ease), glow 1.6s ease-in-out 3; }
.ocard.late { border-color: var(--danger); }
.ocard.late .timer { background: var(--danger); color: #fff; }
@keyframes cardIn { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
@keyframes glow { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--info) 25%, transparent), var(--shadow); } }
.oc-head { display: flex; align-items: center; gap: 8px; }
.oc-num { font-family: var(--font-num); font-size: 20px; font-weight: 700; }
.timer { margin-inline-start: auto; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 8px; background: var(--surface-3); font-variant-numeric: tabular-nums; direction: ltr; }
.oc-meta { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.oc-type { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); }
[data-theme="dark"] .oc-type { color: var(--cream); }
.oc-type .ic { width: 15px; height: 15px; }
.oc-cust { font-size: 13px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.oc-items { list-style: none; padding: 10px 0; margin: 10px 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); display: flex; flex-direction: column; gap: 6px; }
.oc-items li { font-size: 13.5px; display: flex; gap: 8px; }
.oc-items .q { font-weight: 700; min-width: 22px; color: var(--brand); }
[data-theme="dark"] .oc-items .q { color: var(--cream); }
.oc-items small { display: block; color: var(--muted); font-size: 12px; }
.oc-note { font-size: 12.5px; background: var(--warn-bg); color: var(--warn); padding: 6px 10px; border-radius: 8px; margin-bottom: 10px; }
.oc-foot { display: flex; align-items: center; gap: 8px; }
.oc-total { font-weight: 700; font-family: var(--font-num); }
.oc-foot .btn { margin-inline-start: auto; }
.oc-usual { position: absolute; top: -9px; inset-inline-start: 14px; background: var(--brand); color: var(--cream); font-size: 11px; padding: 1px 8px; border-radius: 6px; display: flex; gap: 4px; align-items: center; }
.oc-usual .ic { width: 12px; height: 12px; }
.board-status { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }

/* تفاصيل الطلب */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { position: relative; padding-inline-start: 26px; padding-bottom: 16px; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: 5px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
.timeline li::after { content: ""; position: absolute; inset-inline-start: 9.5px; top: 18px; bottom: -2px; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.done::before { background: var(--ok); }
.timeline small { display: block; color: var(--muted); }
.receipt-lines { display: flex; flex-direction: column; gap: 8px; }
.receipt-lines .ln { display: flex; justify-content: space-between; font-size: 14px; }
.receipt-lines .ln.total { font-weight: 700; font-size: 16px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 20px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }

/* ================= المنيو ================= */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; transition: transform .2s var(--ease), box-shadow .2s; position: relative; }
.pcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.pcard.inactive { opacity: .55; }
.pcard-img { aspect-ratio: 4/3; background: linear-gradient(135deg, var(--surface-3), color-mix(in srgb, var(--brand) 10%, var(--surface-3))); display: grid; place-items: center; font-size: 44px; position: relative; }
.pcard-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pcard-flags { position: absolute; top: 10px; inset-inline-start: 10px; display: flex; gap: 4px; z-index: 1; }
.pcard-flags span { background: rgba(255,255,255,.92); color: #2A1715; font-size: 11px; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.pcard-flags .feat { background: var(--brand); color: var(--cream); }
.pcard-body { padding: 12px 14px; flex: 1; }
.pcard-body h4 { font-size: 15px; font-weight: 600; }
.pcard-body p { font-size: 12.5px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; margin-top: 2px; }
.pcard-price { font-family: var(--font-num); font-weight: 700; font-size: 17px; margin-top: 8px; }
.pcard-price del { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-inline-start: 6px; }
.pcard-foot { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--line); }
.pcard-foot .switch { margin-inline-end: auto; font-size: 12.5px; color: var(--muted); }

.sortable-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; transition: box-shadow .15s; }
.sortable-item + .sortable-item { margin-top: 8px; }
.sortable-item.dragging { opacity: .5; box-shadow: var(--shadow-lg); }
.sortable-item.over { border-color: var(--brand); }
.handle { cursor: grab; color: var(--muted); padding: 4px; }
.cat-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--surface-3); display: grid; place-items: center; font-size: 22px; flex: none; }
.si-main { flex: 1; min-width: 0; }
.si-main strong { display: block; }
.si-main small { color: var(--muted); }

.option-items { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.option-items .tag b { font-weight: 600; margin-inline-start: 4px; color: var(--ok); }
.repeater-row { display: grid; grid-template-columns: 1.4fr 1fr 110px 90px 40px; gap: 8px; align-items: center; margin-bottom: 8px; }
.repeater-head { font-size: 12px; color: var(--muted); margin-bottom: 6px; }

.matrix td, .matrix th { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: start; }
.matrix .price-ov { width: 90px; min-height: 34px; padding: 5px 8px; font-size: 13px; }
.matrix tr.cat-row td { background: var(--surface-2); font-weight: 600; font-size: 13px; }

/* ================= الفروع ================= */
.branch-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }
.bcard { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; }
.bcard-top { padding: 20px; background: linear-gradient(140deg, var(--brand), color-mix(in srgb, var(--brand) 70%, #000)); color: var(--cream); position: relative; overflow: hidden; }
.bcard-top::after { content: ""; position: absolute; inset-inline-start: -40px; bottom: -80px; width: 200px; height: 200px; border-radius: 50%; border: 30px solid rgba(239,227,211,.06); }
.bcard-top h3 { font-size: 19px; }
.bcard-top p { opacity: .75; font-size: 13px; display: flex; gap: 6px; align-items: center; margin-top: 2px; }
.bcard-top .ic { width: 15px; height: 15px; }
.bcard-status { position: absolute; top: 18px; inset-inline-end: 18px; z-index: 1; }
.bcard-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.bcard-stats div { padding: 14px; text-align: center; }
.bcard-stats div + div { border-inline-start: 1px solid var(--line); }
.bcard-stats b { display: block; font-family: var(--font-num); font-size: 20px; }
.bcard-stats span { font-size: 12px; color: var(--muted); }
.bcard-body { padding: 6px 20px; flex: 1; }
.bcard-foot { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }
.types-row { display: flex; gap: 6px; flex-wrap: wrap; padding: 12px 0; }
.hours-table td { padding: 8px 6px; border: 0; }
.hours-table input[type=time] { min-height: 38px; padding: 6px 10px; }
.hours-table tr.closed input[type=time] { opacity: .35; pointer-events: none; }

/* ================= العملاء ================= */
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-head h2 { font-size: 22px; display: flex; gap: 10px; align-items: center; }
.profile-head .contacts { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.profile-head .contacts span { display: flex; align-items: center; gap: 6px; }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 20px; }
.stat { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.stat b { display: block; font-family: var(--font-num); font-size: 22px; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 12.5px; }
.usual { border-radius: 16px; padding: 18px; background: linear-gradient(140deg, var(--brand), color-mix(in srgb, var(--brand) 65%, #000)); color: var(--cream); position: relative; overflow: hidden; }
.usual::before { content: "☕"; position: absolute; font-size: 90px; inset-inline-start: -10px; bottom: -28px; opacity: .12; }
.usual small { opacity: .7; display: flex; align-items: center; gap: 6px; }
.usual h4 { font-size: 20px; margin: 6px 0 2px; }
.usual p { opacity: .8; font-size: 13px; }
.usual .usual-count { margin-top: 10px; display: inline-block; background: rgba(239,227,211,.14); padding: 3px 10px; border-radius: 8px; font-size: 12.5px; }
.stamps { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.stamps i { width: 30px; height: 30px; border-radius: 50%; border: 1.5px dashed var(--line-2); display: grid; place-items: center; font-style: normal; font-size: 14px; }
.stamps i.on { background: var(--brand); border: 0; color: var(--cream); }
.pts { font-weight: 600; direction: ltr; display: inline-block; }
.pts.plus { color: var(--ok); }
.pts.minus { color: var(--danger); }

/* ================= الولاء ================= */
.tier-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.tcard { border-radius: 16px; padding: 18px; color: #fff; position: relative; overflow: hidden; background: linear-gradient(140deg, var(--tier), color-mix(in srgb, var(--tier) 55%, #000)); min-height: 150px; display: flex; flex-direction: column; }
.tcard::after { content: ""; position: absolute; width: 160px; height: 160px; border-radius: 50%; border: 22px solid rgba(255,255,255,.1); inset-inline-start: -50px; bottom: -70px; }
.tcard h4 { font-size: 19px; display: flex; gap: 8px; align-items: center; }
.tcard p { font-size: 12.5px; opacity: .88; margin-top: 4px; }
.tcard .tc-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: flex-end; padding-top: 14px; font-size: 12.5px; position: relative; z-index: 1; }
.tcard .tc-foot b { font-family: var(--font-num); font-size: 22px; display: block; }
.tcard .tc-actions { position: absolute; top: 12px; inset-inline-end: 12px; display: flex; gap: 4px; z-index: 1; }
.tcard .icon-btn.sm { color: #fff; }
.tcard .icon-btn.sm:hover { background: rgba(255,255,255,.15); }
.reward-card { display: flex; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.reward-card + .reward-card { margin-top: 10px; }
.reward-cost { flex: none; width: 74px; height: 74px; border-radius: 14px; background: var(--brand-soft); display: grid; place-items: center; text-align: center; line-height: 1.1; color: var(--brand); }
[data-theme="dark"] .reward-cost { color: var(--cream); }
.reward-cost b { font-family: var(--font-num); font-size: 20px; display: block; }
.reward-cost span { font-size: 11px; }
.calc { background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px; font-size: 13.5px; }
.calc b { font-family: var(--font-num); }

/* ================= العروض ================= */
.coupon { display: flex; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; position: relative; }
.coupon + .coupon { margin-top: 12px; }
.coupon-val { width: 120px; flex: none; display: grid; place-items: center; text-align: center; background: var(--brand); color: var(--cream); padding: 14px; position: relative; }
.coupon-val b { font-family: var(--font-num); font-size: 28px; line-height: 1; display: block; }
.coupon-val small { opacity: .75; }
.coupon-val::after { content: ""; position: absolute; inset-inline-end: -8px; top: 0; bottom: 0; width: 16px; background: radial-gradient(circle at center, var(--surface) 5px, transparent 5.5px) 0 0 / 16px 16px repeat-y; }
.coupon.off .coupon-val { background: var(--muted); }
.coupon-body { flex: 1; padding: 14px 18px; min-width: 0; }
.coupon-code { font-family: ui-monospace, monospace; font-weight: 700; letter-spacing: 1px; font-size: 16px; direction: ltr; display: inline-block; padding: 2px 10px; border: 1.5px dashed var(--line-2); border-radius: 8px; cursor: copy; }
.coupon-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.coupon-actions { display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 10px; }
.usage { height: 5px; border-radius: 3px; background: var(--surface-3); margin-top: 10px; overflow: hidden; max-width: 260px; }
.usage i { display: block; height: 100%; background: var(--ok); }
.banners { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.banner { border-radius: 16px; overflow: hidden; position: relative; aspect-ratio: 16/8; background: linear-gradient(135deg, var(--brand), #8B3A2E); color: var(--cream); display: flex; flex-direction: column; justify-content: flex-end; padding: 18px; }
.banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.banner::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,.65), transparent 70%); z-index: 1; }
.banner > * { position: relative; z-index: 2; }
.banner h4 { font-size: 19px; }
.banner p { opacity: .85; font-size: 13px; }
.banner .banner-actions { position: absolute; top: 12px; inset-inline-end: 12px; display: flex; gap: 4px; z-index: 2; }
.banner .icon-btn.sm { background: rgba(0,0,0,.35); color: #fff; }

/* ================= الإعدادات + معاينة الجوال ================= */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-nav { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 500; }
.settings-nav a:hover { background: var(--surface); }
.settings-nav a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.phone { width: 270px; height: 540px; border-radius: 40px; background: #111; padding: 10px; box-shadow: var(--shadow-lg); margin: 0 auto; position: relative; }
.phone::before { content: ""; position: absolute; top: 16px; left: 50%; transform: translateX(-50%); width: 80px; height: 22px; border-radius: 12px; background: #111; z-index: 3; }
.phone-screen { width: 100%; height: 100%; border-radius: 31px; overflow: hidden; background: #FBF7F2; color: #2A1715; display: flex; flex-direction: column; font-size: 11px; }
.ph-head { background: var(--p, #4A0508); color: var(--a, #EFE3D3); padding: 46px 16px 18px; }
.ph-head small { opacity: .75; }
.ph-head h5 { font-size: 15px; margin: 2px 0 10px; }
.ph-points { background: rgba(255,255,255,.12); border-radius: 12px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; }
.ph-points b { font-size: 18px; font-family: var(--font-num); }
.ph-body { padding: 12px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.ph-usual { border-radius: 12px; padding: 10px 12px; background: #fff; border: 1px solid #EBE2D7; display: flex; justify-content: space-between; align-items: center; }
.ph-usual button { background: var(--p, #4A0508); color: var(--a, #EFE3D3); border: 0; border-radius: 8px; padding: 5px 10px; font-size: 10.5px; }
.ph-cats { display: flex; gap: 6px; }
.ph-cats span { padding: 4px 10px; border-radius: 999px; background: #fff; border: 1px solid #EBE2D7; }
.ph-cats span:first-child { background: var(--p, #4A0508); color: var(--a, #EFE3D3); border-color: transparent; }
.ph-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ph-grid div { background: #fff; border-radius: 12px; border: 1px solid #EBE2D7; padding: 8px; }
.ph-grid i { display: block; aspect-ratio: 1.2; border-radius: 8px; background: #F0E6DA; margin-bottom: 6px; font-style: normal; display: grid; place-items: center; font-size: 22px; }
.ph-tab { display: flex; justify-content: space-around; padding: 10px 0 18px; border-top: 1px solid #EBE2D7; background: #fff; }
.ph-tab span { width: 22px; height: 4px; border-radius: 2px; background: #D9CEC2; }
.ph-tab span:first-child { background: var(--p, #4A0508); }
.color-row { display: flex; gap: 10px; align-items: center; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches button { width: 28px; height: 28px; border-radius: 8px; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; }

/* ================= صلاحيات ================= */
.perm-group { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.perm-group h5 { font-size: 13px; margin-bottom: 8px; color: var(--muted); font-weight: 600; }
.perm-group .check { display: flex; padding: 4px 0; }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.role-chip { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* ================= صفحة الدخول ================= */
.auth-page { background: var(--bg); }
.auth { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-art { background: var(--brand); color: var(--cream); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::before { content: ""; position: absolute; width: 520px; height: 520px; border-radius: 50%; inset-inline-start: -180px; bottom: -220px; border: 70px solid rgba(239,227,211,.05); }
.auth-logo { position: relative; z-index: 1; }
.client-brand { display: flex; align-items: center; gap: 16px; align-self: flex-start; }
.client-brand img, .client-mark { width: 84px; height: 84px; border-radius: 22px; object-fit: cover; box-shadow: 0 0 0 1px rgba(255,255,255,.12); }
.client-mark { display: grid; place-items: center; background: rgba(255,255,255,.08); font-family: var(--font-num); font-size: 32px; font-weight: 700; }
.client-brand strong { font-family: var(--font-num); font-size: 30px; letter-spacing: .3px; }
.install { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 40px 16px; }
.install .install-brand { color: var(--brand); align-self: center; }
.install-brand b { font-size: 46px; }
.install-card { width: min(620px, 100%); box-shadow: var(--shadow); }
.platform-wordmark { display: flex; align-items: baseline; gap: 10px; align-self: flex-end; }
.platform-wordmark b { font-family: var(--font-num); font-size: 64px; line-height: 1; letter-spacing: -1px; }
.platform-wordmark span { font-size: 15px; letter-spacing: 5px; text-transform: uppercase; opacity: .7; }
.auth-quote { position: relative; z-index: 1; }
.auth-quote p { font-size: 30px; font-weight: 600; line-height: 1.5; }
.auth-quote ul { list-style: none; padding: 0; margin: 24px 0 0; display: flex; flex-direction: column; gap: 12px; opacity: .85; }
.auth-quote li { display: flex; gap: 10px; align-items: center; }
.auth-steam { position: absolute; top: 40%; inset-inline-start: 20%; display: flex; gap: 14px; opacity: .25; }
.auth-steam span { width: 6px; height: 80px; border-radius: 6px; background: linear-gradient(to top, transparent, var(--cream)); animation: steam 3.5s ease-in-out infinite; }
.auth-steam span:nth-child(2) { animation-delay: .6s; height: 110px; }
.auth-steam span:nth-child(3) { animation-delay: 1.2s; }
@keyframes steam { 0% { transform: translateY(20px) scaleY(.6); opacity: 0; } 50% { opacity: 1; } 100% { transform: translateY(-40px) scaleY(1.1); opacity: 0; } }
.auth-form-wrap { display: grid; place-items: center; padding: 40px 24px; }
.auth-form { width: min(400px, 100%); display: flex; flex-direction: column; gap: 18px; }
.auth-form h1 { font-size: 30px; font-weight: 700; }
.auth-foot { text-align: center; color: var(--muted); font-size: 12.5px; }

/* ================= متفرقات ================= */
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 28px 0 14px; gap: 10px; }
.section-title h2 { font-size: 17px; }
.hint-box { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--brand-soft); border: 1px solid var(--brand-line); font-size: 13.5px; }
.hint-box .ic { color: var(--brand); flex: none; margin-top: 2px; }
[data-theme="dark"] .hint-box .ic { color: var(--cream); }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.flex { display: flex; gap: 8px; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; }
.text-end { text-align: end; }
.nowrap { white-space: nowrap; }
.stars { color: #E0A82E; letter-spacing: 1px; }

/* ================= طباعة الفاتورة ================= */
@media print {
  .sidebar, .topbar, .no-print, .toasts { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; }
  .card { border: 0; box-shadow: none; }
  .grid-side { grid-template-columns: 1fr; }
}

/* ================= الجوال ================= */
@media (max-width: 1280px) {
  .grid-dash { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-dash .span-2 { grid-column: 1 / -1; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-side { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .search-trigger { min-width: 0; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .board { grid-template-columns: 1fr; }
  .col { min-height: 0; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
  .user-meta { display: none; }
}
@media (max-width: 860px) {
  .only-mobile { display: inline-grid !important; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; transform: translateX(100%); width: 280px !important; }
  .sb-mini .brand-text, .sb-mini .nav-link span, .sb-mini .nav-section { display: revert; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar.open + .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .sidebar-foot { display: none; }
  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar-title h1 { font-size: 17px; }
  .topbar-title p { display: none; }
  .content { padding: 8px 16px 40px; }
  .grid-dash, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .kpi-value { font-size: 24px; }
  .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .col-2 { grid-column: auto; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 28px; min-height: 240px; }
  .auth-quote ul, .auth-steam { display: none; }
  .auth-quote p { font-size: 20px; }
  .platform-wordmark b { font-size: 44px; }
  .repeater-row { grid-template-columns: 1fr 1fr; }
  .donut-wrap { flex-direction: column; }
  .coupon-val { width: 92px; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 20px; }
  .toasts { inset-inline: 12px; bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
