/* ============ design tokens ============ */
:root {
  --bg: #f3f4fb; --surface: #ffffff; --surface-2: #eef0f8; --ink: #191a2e; --ink-2: #4b4e6a; --ink-3: #8285a3;
  --line: #e4e6f2; --brand: #4f46e5; --brand-2: #7c3aed; --brand-soft: #e9e8ff;
  --accent: #4f46e5; --accent-soft: #e9e8ff; --hot: #f97316; --hot-soft: #ffedd9;
  --danger: #dc2626; --danger-soft: #fee2e2; --warn-soft: #fff1d6; --ok: #16a34a; --ok-soft: #dcfce7;
  --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #c026d3 130%);
  --grad-dark: linear-gradient(160deg, #1e1b4b 0%, #312e81 60%, #4c1d95 130%);
  --shadow: 0 1px 2px rgba(31,29,90,.05), 0 6px 18px rgba(31,29,90,.07); --shadow-lg: 0 10px 30px rgba(31,29,90,.16);
  --radius: 18px; --nav-h: 66px; --top-h: 58px;
  --s-new: #2563eb; --s-preparing: #d97706; --s-ready: #0d9488; --s-with_courier: #4f46e5; --s-picked_up: #0284c7; --s-with_shipper: #9333ea;
  --s-out_for_delivery: #ea580c; --s-delivered: #16a34a; --s-failed: #dc2626; --s-returned: #78716c; --s-cancelled: #9ca3af;
  --sub-trial: #2563eb; --sub-active: #16a34a; --sub-expired: #dc2626; --sub-suspended: #78716c; --sub-lifetime: #7c3aed;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0f1e; --surface: #181a2e; --surface-2: #22253f; --ink: #eef0ff; --ink-2: #b5b8d6; --ink-3: #7f83a6;
    --line: #2b2e4d; --brand: #8b83ff; --brand-2: #a78bfa; --brand-soft: #262459; --accent: #8b83ff; --accent-soft: #262459;
    --hot-soft: #3d2410; --danger: #f87171; --danger-soft: #3f1618; --warn-soft: #3b2c0f; --ok: #4ade80; --ok-soft: #123020;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.25); --shadow-lg: 0 10px 30px rgba(0,0,0,.5);
    --s-new: #60a5fa; --s-preparing: #fbbf24; --s-ready: #2dd4bf; --s-with_courier: #a5a0ff; --s-picked_up: #38bdf8; --s-with_shipper: #c4a1ff;
    --s-out_for_delivery: #fb923c; --s-delivered: #4ade80; --s-failed: #f87171; --s-returned: #a8a29e; --s-cancelled: #6b7280;
    --sub-trial: #60a5fa; --sub-active: #4ade80; --sub-expired: #f87171; --sub-suspended: #a8a29e; --sub-lifetime: #c4a1ff;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.55 "Tajawal", "Segoe UI", Tahoma, system-ui, -apple-system, Roboto, Arial, sans-serif; min-height: 100dvh; overflow-x: hidden; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }

/* ============ shell ============ */
#app { min-height: 100dvh; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; height: var(--top-h); background: var(--grad); color: #fff; display: flex; align-items: center; gap: 8px; padding: 0 12px; box-shadow: 0 4px 18px rgba(79,70,229,.28); }
.top h1 { font-size: 18px; font-weight: 800; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .btn { color: #fff; }
.top .btn.ghost { background: rgba(255,255,255,.14); border-color: transparent; }
.top .back { display: none; }
.top.has-back .back { display: inline-flex; }
main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 14px 14px calc(var(--nav-h) + 28px); }
main.wide { max-width: 1120px; }
.nav { position: fixed; inset-inline: 0; bottom: 0; z-index: 20; height: var(--nav-h); padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line); display: flex; justify-content: center; box-shadow: 0 -6px 24px rgba(31,29,90,.06); }
.nav-inner { display: flex; width: 100%; max-width: 760px; }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-3); font-size: 11.5px; font-weight: 700; position: relative; transition: color .15s; }
.nav a svg { width: 24px; height: 24px; transition: transform .15s; }
.nav a.on { color: var(--brand); }
.nav a.on svg { transform: translateY(-1px) scale(1.08); }
.nav a.on::before { content: ""; position: absolute; top: 0; width: 34px; height: 4px; border-radius: 0 0 6px 6px; background: var(--grad); }
.nav a .dot { position: absolute; top: 7px; inset-inline-start: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--hot); color: #fff; font: 800 10.5px/18px "Tajawal", sans-serif; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.nav a.plus span.pill { background: var(--grad); color: #fff; width: 52px; height: 52px; border-radius: 18px; display: flex; align-items: center; justify-content: center; margin-top: -22px; box-shadow: 0 8px 20px rgba(79,70,229,.45); border: 3px solid var(--surface); }
.nav a.plus span.pill svg { width: 26px; height: 26px; }
.nav a.plus.on::before { display: none; }
@media (min-width: 900px) {
  .nav { top: 0; bottom: auto; inset-inline: auto; inset-inline-start: 0; width: 96px; height: 100dvh; border: 0; background: var(--grad-dark); flex-direction: column; justify-content: flex-start; padding-top: 14px; box-shadow: none; backdrop-filter: none; }
  .nav-inner { flex-direction: column; max-width: none; gap: 6px; padding: 0 10px; }
  .nav a { flex: none; height: 66px; color: rgba(255,255,255,.65); border-radius: 16px; }
  .nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
  .nav a.on { background: rgba(255,255,255,.16); color: #fff; }
  .nav a.on::before { display: none; }
  .nav a .dot { box-shadow: 0 0 0 2px #312e81; }
  .nav a.plus span.pill { margin-top: 0; width: 44px; height: 44px; border-radius: 14px; border: 0; background: var(--hot); }
  #app { padding-inline-start: 96px; }
  main { padding-bottom: 36px; padding-top: 20px; }
}

/* ============ atoms ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; cursor: pointer; white-space: nowrap; transition: transform .08s, box-shadow .15s, background .15s; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { box-shadow: var(--shadow); }
.btn.primary { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(79,70,229,.32); }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 13.5px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn.icon { width: 46px; padding: 0; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn:active { transform: scale(.97); }
.btn[class*="to-"] { background: var(--c); color: #fff; border-color: transparent; box-shadow: 0 6px 14px color-mix(in srgb, var(--c) 38%, transparent); }
.btn.to-preparing { --c: var(--s-preparing); } .btn.to-ready { --c: var(--s-ready); } .btn.to-with_courier { --c: var(--s-with_courier); } .btn.to-picked_up { --c: var(--s-picked_up); }
.btn.to-with_shipper { --c: var(--s-with_shipper); } .btn.to-out_for_delivery { --c: var(--s-out_for_delivery); } .btn.to-delivered { --c: var(--s-delivered); }
.btn.to-failed, .btn.to-returned, .btn.to-cancelled { --c: #dc2626; } .btn.to-new { --c: var(--s-new); }
input, select, textarea { width: 100%; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
input[type="checkbox"] { width: 22px; min-height: 22px; height: 22px; accent-color: var(--brand); }
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
label.f small { color: var(--ink-3); display: block; margin-top: 4px; font-size: 12px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row > .btn { white-space: normal; text-align: center; line-height: 1.3; padding: 8px 14px; }
.row.wrap > .btn { flex: 1 1 auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card h3 { font-size: 13.5px; color: var(--ink-3); margin-bottom: 12px; font-weight: 800; letter-spacing: .2px; }
.muted { color: var(--ink-3); }
.sm { font-size: 13px; }
.grow { flex: 1; min-width: 0; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 800; background: color-mix(in srgb, var(--c, var(--ink-3)) 15%, transparent); color: var(--c, var(--ink-2)); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--ink-3)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--ink-3)) 22%, transparent); }
.tag { display: inline-block; padding: 1px 9px; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 700; }
.empty { text-align: center; padding: 44px 16px; color: var(--ink-3); }
.empty svg { width: 64px; height: 64px; padding: 16px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); margin-bottom: 12px; }
.hr { height: 1px; background: var(--line); margin: 14px 0; border: 0; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 14px; border-radius: 14px; margin-bottom: 12px; font-weight: 700; font-size: 13.5px; }
.banner a { flex: none; background: #fff; color: #191a2e; padding: 5px 12px; border-radius: 10px; font-weight: 800; }
.banner.info { background: linear-gradient(135deg, #dbeafe, #e0e7ff); color: #1e3a8a; }
.banner.warn { background: linear-gradient(135deg, #fde68a, #fed7aa); color: #7c2d12; }
.banner.bad { background: linear-gradient(135deg, #fecaca, #fca5a5); color: #7f1d1d; }
.banner.bad a { background: #7f1d1d; color: #fff; } .banner.warn a { background: #7c2d12; color: #fff; }

/* ============ chips / tabs ============ */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 14px 12px; scrollbar-width: none; margin-inline: -14px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 8px 15px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); font-weight: 700; font-size: 13.5px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; transition: all .15s; }
.chip.on { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 5px 14px rgba(79,70,229,.3); }
.chip b { font-size: 12px; opacity: .85; background: color-mix(in srgb, currentColor 14%, transparent); padding: 0 7px; border-radius: 9px; }
.seg { display: flex; background: var(--surface-2); border-radius: 16px; padding: 4px; margin-bottom: 14px; gap: 4px; }
.seg button { flex: 1; min-height: 44px; border: 0; background: transparent; border-radius: 12px; font-weight: 800; color: var(--ink-2); cursor: pointer; transition: all .15s; }
.seg button.on { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.seg button b { margin-inline-start: 6px; font-size: 12px; background: var(--hot); color: #fff; padding: 1px 8px; border-radius: 9px; }
.search { position: relative; margin-bottom: 12px; }
.search svg { position: absolute; inset-inline-start: 14px; top: 14px; width: 20px; height: 20px; color: var(--ink-3); }
.search input { padding-inline-start: 44px; border-radius: 16px; box-shadow: var(--shadow); border-color: transparent; }

/* ============ order card ============ */
.oc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 12px; overflow: hidden; position: relative; }
.oc::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 5px; background: var(--c, var(--line)); }
.lnk { display: block; color: inherit; padding: 14px 16px 12px; padding-inline-start: 20px; text-decoration: none; }
.oc .top2 { display: flex; align-items: center; gap: 12px; }
.av { flex: none; width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #fff; background: linear-gradient(135deg, hsl(var(--h, 250) 78% 58%), hsl(calc(var(--h, 250) + 40) 78% 48%)); box-shadow: 0 5px 12px hsl(var(--h, 250) 70% 50% / .3); }
.oc .who { flex: 1; min-width: 0; }
.oc .who b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oc .who span { color: var(--ink-3); font-size: 13px; }
.oc .side { text-align: end; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.oc .amt { font-weight: 800; font-size: 16px; }
.oc .sub { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin-top: 10px; color: var(--ink-3); font-size: 13px; }
.oc .no { font-weight: 800; color: var(--ink-2); background: var(--surface-2); padding: 1px 9px; border-radius: 8px; letter-spacing: .3px; }
.oc .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--ink-2); font-size: 13.5px; margin-top: 8px; }
.oc .meta svg { width: 15px; height: 15px; vertical-align: -2px; color: var(--ink-3); }
.oc .items { margin: 10px 0 2px; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; font-size: 14.5px; }
.oc .items div { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.oc .items b { font-variant-numeric: tabular-nums; color: var(--brand); }
.oc .acts { display: flex; gap: 8px; padding: 0 16px 14px; padding-inline-start: 20px; flex-wrap: wrap; }
.oc .acts .btn { flex: 1; }
.big-amt { font-size: 22px; font-weight: 800; }
.due { background: var(--warn-soft); border-radius: 14px; padding: 10px 14px; display: flex; justify-content: space-between; align-items: center; font-weight: 800; margin-top: 10px; color: #92400e; }
.due.paid { background: var(--ok-soft); color: #166534; }
@media (prefers-color-scheme: dark) { .due { color: #fcd9a0; } .due.paid { color: #86efac; } }

/* ============ detail ============ */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14.5px; }
.kv dt { color: var(--ink-3); font-weight: 600; } .kv dd { margin: 0; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.contact { display: flex; gap: 8px; margin-top: 14px; }
.contact .btn { flex: 1; padding: 0 8px; border-color: transparent; }
.contact .btn.c-call { background: #dbeafe; color: #1e40af; } .contact .btn.c-wa { background: #dcfce7; color: #166534; } .contact .btn.c-map { background: #ffedd5; color: #9a3412; }
.lines .l { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.lines .l:last-child { border: 0; }
.tl { list-style: none; margin: 0; padding: 0; position: relative; }
.tl li { position: relative; padding-inline-start: 30px; padding-bottom: 16px; }
.tl li::before { content: ""; position: absolute; inset-inline-start: 6px; top: 8px; bottom: -8px; width: 2px; background: var(--line); }
.tl li:last-child::before { display: none; }
.tl li i { position: absolute; inset-inline-start: 0; top: 4px; width: 14px; height: 14px; border-radius: 50%; background: var(--c, var(--ink-3)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c, var(--ink-3)) 20%, var(--surface)); }
.tl .t { font-weight: 800; } .tl .s { color: var(--ink-3); font-size: 12.5px; }
.hero { background: var(--grad); color: #fff; border: 0; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.1); inset-inline-end: -50px; top: -70px; pointer-events: none; }
.hero h2 { color: #fff; font-size: 22px; } .hero .muted { color: rgba(255,255,255,.78); }
.hero .badge { background: rgba(255,255,255,.96); }
.steps { display: flex; margin: 18px 0 8px; position: relative; z-index: 1; }
.steps .st { flex: 1; text-align: center; position: relative; font-size: 10.5px; font-weight: 700; color: rgba(255,255,255,.65); }
.steps .st::before { content: ""; position: absolute; top: 9px; inset-inline: 0; height: 3px; background: rgba(255,255,255,.28); }
.steps .st:first-child::before { inset-inline-start: 50%; } .steps .st:last-child::before { inset-inline-end: 50%; }
.steps .st.done::before { background: #fff; }
.steps .st i { position: relative; z-index: 1; display: block; width: 20px; height: 20px; border-radius: 50%; margin: 0 auto 5px; background: rgba(255,255,255,.3); border: 2px solid transparent; }
.steps .st.done i { background: #fff; } .steps .st.now i { background: var(--hot); border-color: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.3); }
.steps .st.now, .steps .st.done { color: #fff; }
.actionbar { position: fixed; inset-inline: 0; bottom: var(--nav-h); z-index: 15; padding: 12px 14px; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: center; }
.actionbar .btn { flex: 1; max-width: 380px; min-height: 50px; font-size: 16px; }
@media (min-width: 900px) { .actionbar { bottom: 0; inset-inline-start: 96px; } }

/* ============ sheet / toast ============ */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(16,14,50,.55); backdrop-filter: blur(3px); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 580px; max-height: 92dvh; overflow: auto; background: var(--surface); border-radius: 26px 26px 0 0; padding: 22px 18px calc(20px + env(safe-area-inset-bottom)); animation: up .2s ease-out; box-shadow: var(--shadow-lg); }
.sheet::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: -10px auto 14px; }
.sheet h2 { font-size: 19px; margin-bottom: 16px; font-weight: 800; }
@media (min-width: 700px) { .overlay { align-items: center; } .sheet { border-radius: 26px; } .sheet::before { display: none; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast { position: fixed; inset-inline: 14px; bottom: calc(var(--nav-h) + 84px); z-index: 60; max-width: 440px; margin: 0 auto; background: #1e1b4b; color: #fff; padding: 13px 18px; border-radius: 16px; font-weight: 700; box-shadow: var(--shadow-lg); animation: up .2s; }
.toast.err { background: #b91c1c; }

/* ============ order form ============ */
.itemrow { display: grid; grid-template-columns: 1fr 64px 88px 40px; gap: 8px; margin-bottom: 8px; align-items: center; }
.itemrow input { min-height: 44px; padding: 8px 10px; }
.itemrow .btn { min-height: 44px; }
.total-box { background: linear-gradient(135deg, var(--brand-soft), var(--surface-2)); border-radius: 14px; padding: 12px 16px; margin-top: 6px; }
.total-box .l { display: flex; justify-content: space-between; padding: 2px 0; }
.total-box .l.t { font-weight: 800; font-size: 18px; border-top: 1.5px dashed color-mix(in srgb, var(--brand) 40%, transparent); margin-top: 6px; padding-top: 8px; color: var(--brand); }

/* ============ dashboard ============ */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 14px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { position: relative; overflow: hidden; border-radius: var(--radius); padding: 16px; color: #fff; box-shadow: var(--shadow); background: var(--g, var(--grad)); }
.kpi::after { content: ""; position: absolute; width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,.14); inset-inline-end: -30px; bottom: -40px; }
.kpi svg { width: 26px; height: 26px; opacity: .9; margin-bottom: 8px; }
.kpi .v { font-size: 28px; font-weight: 800; line-height: 1.1; position: relative; z-index: 1; }
.kpi .k { font-size: 13px; opacity: .93; margin-top: 3px; position: relative; z-index: 1; font-weight: 600; }
.kpi.k1 { --g: linear-gradient(135deg, #4f46e5, #7c3aed); } .kpi.k2 { --g: linear-gradient(135deg, #059669, #10b981); }
.kpi.k3 { --g: linear-gradient(135deg, #f59e0b, #f97316); } .kpi.k4 { --g: linear-gradient(135deg, #e11d48, #db2777); }
.kpi.plain { background: var(--surface); color: var(--ink); border: 1px solid var(--line); } .kpi.plain::after { display: none; }
.bars .b { display: grid; grid-template-columns: 104px 1fr 44px; align-items: center; gap: 10px; margin: 9px 0; font-size: 13.5px; font-weight: 600; }
.bars .track { height: 12px; background: var(--surface-2); border-radius: 7px; overflow: hidden; }
.bars .fill { height: 100%; background: var(--c, var(--brand)); border-radius: 7px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: start; color: var(--ink-3); font-weight: 700; padding: 8px 6px; border-bottom: 1.5px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 6px; border-bottom: 1px solid var(--line); }
.tblwrap { overflow-x: auto; margin-inline: -6px; }
.spark { width: 100%; height: 100px; }

/* ============ list rows (admin) ============ */
.li { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; color: inherit; box-shadow: var(--shadow); }
.li > svg:first-child { flex: none; width: 42px; height: 42px; padding: 10px; border-radius: 14px; background: var(--brand-soft); color: var(--brand); }
.li .grow b { display: block; }
.li .sub { color: var(--ink-3); font-size: 13px; }
.li svg.chev { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
[dir="rtl"] svg.chev { transform: scaleX(-1); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch:last-child { border: 0; }
code, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; direction: ltr; unicode-bidi: isolate; }
.copybox { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 12px; padding: 8px 10px; }
.copybox code { flex: 1; overflow-x: auto; white-space: nowrap; }
pre.tpl { white-space: pre-wrap; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; margin: 6px 0; font: inherit; font-size: 13.5px; }
details > summary { cursor: pointer; }

/* ============ login ============ */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 22px; background: var(--grad-dark); position: relative; overflow: hidden; }
.login::before, .login::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.login::before { width: 420px; height: 420px; background: radial-gradient(circle, rgba(249,115,22,.55), transparent 65%); inset-inline-start: -120px; top: -100px; }
.login::after { width: 520px; height: 520px; background: radial-gradient(circle, rgba(124,58,237,.65), transparent 65%); inset-inline-end: -160px; bottom: -160px; }
.login .box { width: 100%; max-width: 400px; position: relative; z-index: 1; }
.login .logo { width: 76px; height: 76px; border-radius: 24px; background: linear-gradient(135deg, #f97316, #f59e0b); color: #fff; display: grid; place-items: center; margin: 0 auto 16px; box-shadow: 0 14px 32px rgba(249,115,22,.5); transform: rotate(-6deg); }
.login .logo svg { width: 40px; height: 40px; }
.login h1 { text-align: center; font-size: 26px; font-weight: 800; color: #fff; margin-bottom: 6px; }
.login p { text-align: center; color: rgba(255,255,255,.78); margin: 0 0 22px; }
.login .card { background: rgba(255,255,255,.97); border: 0; padding: 22px; box-shadow: var(--shadow-lg); color: #191a2e; }
.login .card label.f > span { color: #4b4e6a; }
.login .card input { background: #fff; color: #191a2e; border-color: #e4e6f2; }
.login .btn.ghost { color: #fff; background: rgba(255,255,255,.14); }
.login .feat { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.login .feat span { background: rgba(255,255,255,.12); color: #fff; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.spin { display: grid; place-items: center; padding: 60px; color: var(--ink-3); }

/* ============ chat ============ */
.chatwrap { display: flex; flex-direction: column; height: calc(100dvh - var(--top-h) - var(--nav-h) - 30px); }
.msgs { flex: 1; overflow-y: auto; padding: 6px 2px 12px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 82%; padding: 9px 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); align-self: flex-start; border-end-start-radius: 5px; overflow-wrap: anywhere; white-space: pre-wrap; box-shadow: var(--shadow); }
.msg.me { align-self: flex-end; background: var(--grad); color: #fff; border-color: transparent; border-end-start-radius: 18px; border-end-end-radius: 5px; }
.msg .who { font-size: 12.5px; font-weight: 800; color: var(--brand); display: flex; gap: 6px; align-items: center; margin-bottom: 2px; }
.msg .who .tag { font-size: 10.5px; padding: 0 7px; }
.msg .tm { font-size: 11px; color: var(--ink-3); margin-top: 3px; text-align: end; }
.msg.me .tm { color: rgba(255,255,255,.75); }
.msg a.ord { font-weight: 800; background: var(--brand-soft); color: var(--brand); border-radius: 7px; padding: 0 6px; }
.msg.me a.ord { background: rgba(255,255,255,.22); color: #fff; }
.day { align-self: center; font-size: 12px; color: var(--ink-3); background: var(--surface); border: 1px solid var(--line); padding: 2px 14px; border-radius: 999px; margin: 6px 0; font-weight: 700; }
.composer { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.composer textarea { min-height: 48px; height: 48px; max-height: 120px; resize: none; border-radius: 24px; padding: 12px 18px; }
.composer .btn { flex: none; border-radius: 50%; width: 48px; height: 48px; padding: 0; }
.unread { background: var(--hot); color: #fff; min-width: 22px; height: 22px; border-radius: 11px; font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; padding: 0 7px; }
@media (min-width: 900px) { .chatwrap { height: calc(100dvh - var(--top-h) - 60px); } }
.back svg { transform: scaleX(-1); }
[dir="rtl"] .back svg { transform: none; }
.flip { transform: none; } [dir="rtl"] .flip { transform: scaleX(-1); }

/* ============ landing page (guests) ============ */
.btn.hot { background: linear-gradient(135deg, #f97316, #f59e0b); color: #fff; border-color: transparent; box-shadow: 0 8px 20px rgba(249,115,22,.4); }
.btn.glass { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.28); backdrop-filter: blur(6px); }
.land { min-height: 100dvh; background: var(--bg); }
.l-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px max(16px, calc((100% - 1120px) / 2)); background: rgba(30,27,75,.92); backdrop-filter: blur(10px); color: #fff; }
.l-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; }
.l-logo { width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, #f97316, #f59e0b); display: grid; place-items: center; transform: rotate(-6deg); }
.l-logo svg { width: 22px; height: 22px; }
.l-actions { display: flex; gap: 8px; align-items: center; }
.l-hero { background: var(--grad-dark); color: #fff; position: relative; overflow: hidden; padding: 44px max(20px, calc((100% - 1120px) / 2)) 64px; display: grid; gap: 34px; grid-template-columns: 1.1fr .9fr; align-items: center; }
.l-hero::before, .l-hero::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.l-hero::before { width: 460px; height: 460px; background: radial-gradient(circle, rgba(249,115,22,.5), transparent 65%); inset-inline-start: -140px; top: -120px; }
.l-hero::after { width: 560px; height: 560px; background: radial-gradient(circle, rgba(192,38,211,.5), transparent 65%); inset-inline-end: -180px; bottom: -200px; }
.l-hero > * { position: relative; z-index: 1; }
.l-pill { display: inline-block; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); padding: 5px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.l-hero h1 { font-size: clamp(28px, 5.2vw, 46px); line-height: 1.25; font-weight: 800; margin: 16px 0 12px; }
.l-hero p { font-size: 17px; color: rgba(255,255,255,.82); max-width: 560px; margin: 0 0 24px; }
.l-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.l-cta .btn { min-height: 52px; padding: 0 26px; font-size: 16px; }
.l-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.l-chips span { background: rgba(255,255,255,.12); padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.l-art { position: relative; display: grid; place-items: center; min-height: 380px; }
.l-phone { width: 250px; background: #0f1024; border: 6px solid #2a2c52; border-radius: 34px; padding: 12px; box-shadow: 0 30px 60px rgba(0,0,0,.45); transform: rotate(4deg); }
.l-ph-top { background: var(--grad); border-radius: 16px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.l-ph-top i { width: 26px; height: 26px; border-radius: 9px; background: rgba(255,255,255,.25); }
.l-ph-card { background: #fff; color: #191a2e; border-radius: 14px; padding: 10px 12px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.l-ph-card b { display: block; font-size: 13px; } .l-ph-card small { color: #8285a3; font-size: 11.5px; }
.l-ph-card .b { font-size: 10.5px; font-weight: 800; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.b1 { background: #ffedd9; color: #ea580c; } .b2 { background: #ccfbf1; color: #0d9488; } .b3 { background: #dcfce7; color: #16a34a; }
.l-ph-nav { display: flex; justify-content: space-around; align-items: center; background: #fff; border-radius: 16px; padding: 10px; margin-top: 12px; }
.l-ph-nav i { width: 18px; height: 18px; border-radius: 6px; background: #d9dcef; } .l-ph-nav i.p { width: 30px; height: 30px; border-radius: 11px; background: var(--grad); }
.l-bubble { position: absolute; inset-inline-start: -6px; bottom: 30px; max-width: 230px; background: #dcfce7; color: #14532d; padding: 10px 14px; border-radius: 16px; box-shadow: var(--shadow-lg); display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; font-weight: 700; transform: rotate(-3deg); }
.l-bubble svg { width: 20px; height: 20px; flex: none; color: #16a34a; }
.l-sec { padding: 54px max(20px, calc((100% - 1120px) / 2)); }
.l-sec.alt { background: var(--surface-2); }
.l-sec h2 { text-align: center; font-size: clamp(22px, 3.6vw, 32px); font-weight: 800; margin: 0 0 8px; }
.l-lead { text-align: center; color: var(--ink-2); margin: 0 0 26px; }
.l-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 30px; }
.l-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 22px; box-shadow: var(--shadow); }
.l-card h3, .l-step h3, .l-role h3 { margin: 12px 0 6px; font-size: 17px; font-weight: 800; }
.l-card p, .l-step p, .l-role p { margin: 0; color: var(--ink-2); font-size: 14.5px; }
.l-ic { width: 48px; height: 48px; border-radius: 15px; background: var(--grad); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 18px rgba(79,70,229,.3); }
.l-card:nth-child(3n+2) .l-ic { background: linear-gradient(135deg, #f97316, #f59e0b); box-shadow: 0 8px 18px rgba(249,115,22,.3); }
.l-card:nth-child(3n) .l-ic { background: linear-gradient(135deg, #059669, #10b981); box-shadow: 0 8px 18px rgba(5,150,105,.3); }
.l-ic svg { width: 24px; height: 24px; }
.l-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 30px; }
.l-step { background: var(--surface); border-radius: 20px; padding: 22px; border: 1px solid var(--line); position: relative; }
.l-step b { width: 38px; height: 38px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-size: 17px; }
.l-roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.l-role { background: var(--surface); border: 1px solid var(--line); border-inline-start: 5px solid var(--brand); border-radius: 16px; padding: 16px 18px; }
.l-role:nth-child(2n) { border-inline-start-color: var(--hot); } .l-role:nth-child(3n) { border-inline-start-color: #059669; }
.l-role h3 { margin-top: 0; }
.l-appsec { padding-top: 20px; }
.l-appbox { background: var(--grad); color: #fff; border-radius: 28px; padding: 40px 34px; text-align: center; box-shadow: var(--shadow-lg); position: relative; overflow: hidden; }
.l-appbox::after { content: ""; position: absolute; width: 300px; height: 300px; border-radius: 50%; background: rgba(255,255,255,.1); inset-inline-end: -80px; top: -120px; }
.l-appbox > div { position: relative; z-index: 1; }
.l-appbox h2 { color: #fff; } .l-appbox p { color: rgba(255,255,255,.85); max-width: 560px; margin: 0 auto 22px; }
.l-stores { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.l-stores .btn { min-height: 56px; padding: 0 24px; }
.l-store { display: inline-flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 20px; border-radius: 14px; background: #0f1024; color: #fff; text-align: start; font-weight: 800; }
.l-store svg { width: 26px; height: 26px; } .l-store small { display: block; font-size: 10.5px; font-weight: 500; opacity: .75; }
.l-store.off { opacity: .55; cursor: default; }
.l-note { display: block; margin-top: 16px; color: rgba(255,255,255,.8); }
.l-foot { background: #1e1b4b; color: #c7c9ea; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 22px max(20px, calc((100% - 1120px) / 2)); font-size: 14px; }
.l-foot-a { display: flex; gap: 8px; }
.l-ol { padding-inline-start: 22px; margin: 12px 0 18px; line-height: 2; }
@media (max-width: 900px) {
  .l-hero { grid-template-columns: 1fr; padding-top: 30px; text-align: start; } .l-art { min-height: 340px; }
  .l-grid, .l-roles { grid-template-columns: 1fr 1fr; } .l-steps { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .l-grid, .l-roles, .l-steps { grid-template-columns: 1fr; } .l-cta .btn { flex: 1 1 100%; }
  .l-brand span:not(.l-logo) { font-size: 17px; } .l-appbox { padding: 30px 20px; border-radius: 22px; }
  .l-bubble { inset-inline-start: 0; bottom: 10px; }
}
@media (min-width: 900px) { #app:has(.land), #app:has(.login) { padding-inline-start: 0; } }


.total-box .l.dep { color: var(--ok); font-weight: 700; }

/* ---- products line, reminders, dispatch board ---- */
.oc .prod { display: flex; gap: 6px; align-items: flex-start; margin-top: 8px; padding: 7px 10px; border-radius: 10px; background: var(--surface-2); color: var(--ink); font-size: 13.5px; font-weight: 700; line-height: 1.5; }
.oc .prod svg, .dsp-l2 svg { width: 15px; height: 15px; flex: none; margin-top: 3px; color: var(--ink-3); }
.tag.bad { background: var(--danger-soft); color: var(--danger); } .tag.ok { background: var(--ok-soft); color: var(--ok); }
.sch { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 10px; font-size: 12.5px; font-weight: 700; }
.sch svg { width: 14px; height: 14px; }
.sch.info { background: var(--brand-soft); color: var(--brand); } .sch.warn { background: var(--warn-soft); color: #b45309; } .sch.bad { background: var(--danger-soft); color: var(--danger); }
.sch-row { margin-top: 8px; }
.grp { margin: 18px 4px 8px; font-size: 14px; color: var(--ink-2); } .grp b { background: var(--surface-2); padding: 1px 8px; border-radius: 9px; margin-inline-start: 4px; } .grp.bad { color: var(--danger); }
.rem-wrap { margin-bottom: 14px; } .rem-wrap .oc { margin-bottom: 6px; }
.dsp-g { display: flex; justify-content: space-between; align-items: center; margin: 16px 2px 8px; font-weight: 800; color: var(--ink-2); font-size: 14px; }
.dsp-g b { background: var(--surface-2); padding: 1px 8px; border-radius: 9px; margin-inline-start: 4px; }
.dsp-row { display: flex; gap: 10px; align-items: flex-start; padding: 12px; margin-bottom: 8px; background: var(--surface); border: 2px solid transparent; border-radius: 16px; box-shadow: var(--shadow); cursor: pointer; }
.dsp-row.on { border-color: var(--brand); background: var(--brand-soft); }
.dsp-row.locked { opacity: .65; cursor: default; }
.dsp-row .ck { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line); background: var(--surface); display: grid; place-items: center; margin-top: 2px; }
.dsp-row.on .ck { background: var(--brand); border-color: var(--brand); color: #fff; } .dsp-row .ck svg { width: 16px; height: 16px; }
.dsp-row.locked .ck { visibility: hidden; }
.dsp-main { flex: 1; min-width: 0; } .dsp-l1 { font-size: 14.5px; } .dsp-l1 a { color: var(--brand); font-weight: 800; }
.dsp-l2 { display: flex; gap: 6px; font-size: 13px; color: var(--ink-2); margin-top: 4px; line-height: 1.5; } .dsp-l2.prod { color: var(--ink); font-weight: 700; }
.dsp-amt { flex: none; font-weight: 800; font-size: 14px; text-align: end; }
.dsp-bar { position: fixed; inset-inline: 0; bottom: var(--nav-h); z-index: 15; padding: 10px 14px 12px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); display: grid; gap: 8px; }
@media (min-width: 900px) { .dsp-bar { bottom: 0; inset-inline-start: 96px; } }
.dsp-sel { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; }
.lnkbtn { border: 0; background: none; color: var(--brand); font-weight: 800; cursor: pointer; padding: 4px 2px; font-size: 13px; }
.dsp-bar .btn[disabled] { opacity: .5; }

.signup-link { margin: 14px 0 0; font-size: 14px; color: var(--ink-2); } .signup-link a { color: var(--brand); font-weight: 800; }
.l-trial { display: flex; gap: 6px; align-items: center; margin: 12px 0 0; font-size: 14px; font-weight: 700; opacity: .95; } .l-trial svg { width: 18px; height: 18px; color: #86efac; }
.login .card small { display: block; margin-top: 4px; }
.onb { border: 2px dashed var(--brand); background: var(--brand-soft); } .onb-i { display: flex; gap: 12px; align-items: center; padding: 10px 12px; margin-top: 8px; background: var(--surface); border-radius: 14px; font-weight: 700; color: var(--ink); }
.onb-i b { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-size: 14px; }
.login .signup-link { color: rgba(255,255,255,.8); } .login .signup-link a { color: #fbbf24; }
.li > svg:not(:first-child), .li > svg:only-child { width: 18px; height: 18px; flex: none; color: var(--ink-3); padding: 0; background: none; }
.banner svg { width: 18px; height: 18px; flex: none; vertical-align: -3px; }

/* ---- landing: real screenshots in phone frames ---- */
.l-frame { background: #0f1024; border: 6px solid #23254a; border-radius: 34px; padding: 0; overflow: hidden; box-shadow: 0 30px 60px rgba(15,16,36,.35); width: 250px; flex: none; aspect-ratio: 390 / 844; }
.l-frame img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.l-art { position: relative; display: flex; justify-content: center; align-items: flex-start; min-height: 0; padding: 6px 0 24px; }
.l-art .l-frame.main { transform: rotate(-3deg); position: relative; z-index: 2; }
.l-art .l-frame.side { width: 200px; margin-inline-start: -46px; margin-top: 46px; transform: rotate(4deg); opacity: .96; }
.l-lead { text-align: center; color: var(--ink-2); margin: -6px auto 26px; max-width: 560px; }
.l-show { display: grid; gap: 44px; max-width: 900px; margin: 0 auto; }
.l-row { display: flex; align-items: center; justify-content: center; gap: 44px; }
.l-row.rev { flex-direction: row-reverse; }
.l-row .l-frame { width: 260px; }
.l-rt { max-width: 360px; } .l-rt h3 { font-size: 22px; margin: 10px 0 8px; } .l-rt p { margin: 0; color: var(--ink-2); font-size: 16px; line-height: 1.8; }
.l-no { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--grad); color: #fff; font-weight: 800; }
.l-opt { display: inline-block; vertical-align: middle; margin-inline-start: 6px; padding: 2px 9px; border-radius: 999px; background: var(--hot-soft); color: #c2410c; font-size: 11.5px; font-weight: 800; }
@media (max-width: 760px) {
  .l-row, .l-row.rev { flex-direction: column; gap: 18px; text-align: center; } .l-rt { max-width: 100%; }
  .l-art, .l-art { min-height: 0 !important; } .l-art .l-frame.main { width: 220px; } .l-art .l-frame.side { width: 170px; margin-inline-start: -60px; margin-top: 34px; }
}
@media (max-width: 520px) { .l-top { flex-wrap: wrap; row-gap: 8px; } .l-actions { flex-wrap: wrap; gap: 6px; } .l-brand { min-width: 0; } .land { overflow-x: clip; } }
