/* ============================================================================
   KogniRestro design system — one file, used by every back-office screen.
   The billing screen (Views/Pos) has its own full-screen CSS on top of these tokens.
   Light + dark (html[data-theme=dark]); works from 360px phones to 1920px.
   ============================================================================ */
:root {
  --brand: #e23744;          /* overridden from Settings › Appearance */
  --brand-600: #c81f2d;
  --brand-50: #fff1f2;
  --ink: #1d2433;
  --ink-2: #4b5567;
  --ink-3: #8a93a6;
  --line: #e6e8ef;
  --line-2: #f0f2f6;
  --bg: #f4f5f9;
  --card: #ffffff;
  --side: #121725;
  --side-2: #1b2235;
  --side-ink: #aab3c7;
  --side-hi: #ffffff;
  --ok: #16a34a;  --ok-50: #ecfdf3;
  --warn: #d97706; --warn-50: #fff7e6;
  --bad: #dc2626; --bad-50: #fef2f2;
  --info: #2563eb; --info-50: #eff6ff;
  --violet: #7c3aed; --violet-50: #f5f3ff;
  --veg: #15803d; --nonveg: #b91c1c; --egg: #ca8a04;
  --r: 12px; --r-sm: 8px; --r-lg: 18px;
  --sh: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --sh-lg: 0 12px 32px rgba(16,24,40,.14);
  --font: "Inter", "Segoe UI", "Noto Naskh Arabic", "Noto Sans Arabic", Tahoma, "Nirmala UI", "Noto Sans", "Noto Sans Malayalam", "Noto Sans Devanagari", "Noto Sans Tamil", system-ui, sans-serif;
  --side-w: 248px;
  --top-h: 58px;
}
html[data-theme=dark] {
  --ink: #e8ebf2; --ink-2: #b6bdcc; --ink-3: #7d869a;
  --line: #2a3142; --line-2: #222838;
  --bg: #0e121b; --card: #161b27;
  --side: #0a0d14; --side-2: #141a27;
  --brand-50: #3a1418; --ok-50: #0f2a1b; --warn-50: #33240c; --bad-50: #3a1414; --info-50: #13213d; --violet-50: #241a3d;
  --sh: 0 1px 2px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
.muted { color: var(--ink-3); }
.sm { font-size: 12px; }
.num, td.num { text-align: end; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.hide { display: none !important; }
.grow { flex: 1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }

/* ───────────── shell ───────────── */
.shell { display: flex; min-height: 100vh; }
.side { width: var(--side-w); background: var(--side); color: var(--side-ink); position: fixed; inset-block: 0; inset-inline-start: 0; display: flex; flex-direction: column; z-index: 40; transition: width .18s, transform .2s; }
.side .brandbar { height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid rgba(255,255,255,.06); }
.side .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 15px; flex: none; overflow: hidden; }
.side .logo img { width: 100%; height: 100%; object-fit: cover; }
.side .bname { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .bname small { display: block; color: var(--side-ink); font-weight: 500; font-size: 11px; }
.side nav { flex: 1; overflow-y: auto; padding: 8px 8px 24px; scrollbar-width: thin; scrollbar-color: #2a3247 transparent; }
.side .grp { margin-top: 6px; }
.side .grp-h { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; cursor: pointer; color: var(--side-ink); font-weight: 600; font-size: 13px; user-select: none; }
.side .grp-h:hover { background: var(--side-2); color: #fff; }
.side .grp-h .gi { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; color: #fff; flex: none; }
.side .grp-h .chev { margin-inline-start: auto; font-size: 10px; transition: transform .15s; }
.side .grp.open .grp-h .chev { transform: rotate(90deg); }
.side .grp-items { display: none; padding-block: 2px 4px; padding-inline: 18px 0; }
.side .grp.open .grp-items { display: block; }
.side .grp-items a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--side-ink); font-size: 13px; text-decoration: none; border-inline-start: 2px solid transparent; }
.side .grp-items a i { width: 16px; text-align: center; font-size: 12px; opacity: .8; }
.side .grp-items a:hover { color: #fff; background: var(--side-2); }
.side .grp-items a.on { color: #fff; background: rgba(226,55,68,.16); border-inline-start-color: var(--brand); }
.side .grp-items a .tag { margin-inline-start: auto; font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--violet); color: #fff; }
.side .foot { padding: 10px 14px; border-top: 1px solid rgba(255,255,255,.06); font-size: 11px; color: #6b7489; }
body.mini .side { width: 68px; }
body.mini .side .bname, body.mini .side .grp-h span, body.mini .side .grp-h .chev, body.mini .side .grp-items, body.mini .side .foot { display: none !important; }
body.mini .main { margin-inline-start: 68px; }

.main { margin-inline-start: var(--side-w); flex: 1; min-width: 0; display: flex; flex-direction: column; transition: margin .18s; }
.top { height: var(--top-h); background: var(--card); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 0 18px; position: sticky; top: 0; z-index: 30; }
.top .ib { width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); position: relative; }
.top .ib:hover { background: var(--line-2); }
.top .ib .dot { position: absolute; top: 6px; inset-inline-end: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--brand); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.outlet-pick { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--card); max-width: 320px; }
.outlet-pick:hover { border-color: var(--brand); }
.outlet-pick .oi { width: 28px; height: 28px; border-radius: 8px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-size: 12px; flex: none; }
.outlet-pick b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.outlet-pick small { display: block; color: var(--ink-3); font-size: 11px; }
.gsearch { flex: 1; max-width: 440px; position: relative; }
.gsearch input { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 10px; padding-block: 0; padding-inline: 36px 12px; background: var(--bg); outline: none; }
.gsearch input:focus { border-color: var(--brand); background: var(--card); }
.gsearch > i { position: absolute; inset-inline-start: 12px; top: 12px; color: var(--ink-3); font-size: 13px; }
.gsearch kbd { position: absolute; inset-inline-end: 8px; top: 9px; font-size: 10px; border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; color: var(--ink-3); background: var(--card); }
.gsearch .res { position: absolute; top: 44px; inset-inline-start: 0; inset-inline-end: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-lg); max-height: 60vh; overflow: auto; display: none; z-index: 60; }
.gsearch .res.on { display: block; }
.gsearch .res a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; color: var(--ink); text-decoration: none; }
.gsearch .res a small { margin-inline-start: auto; color: var(--ink-3); }
.gsearch .res a.on, .gsearch .res a:hover { background: var(--brand-50); }
.top .sp { flex: 1; }
.newbtn { height: 38px; padding: 0 14px; border-radius: 10px; background: var(--brand); color: #fff; border: 0; display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.newbtn:hover { background: var(--brand-600); text-decoration: none; }
.userchip { display: flex; align-items: center; gap: 8px; cursor: pointer; padding-block: 4px; padding-inline: 4px 6px; border-radius: 22px; border: 1px solid var(--line); }
.av { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), #f97316); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.userchip b { font-size: 12px; display: block; line-height: 1.1; }
.userchip small { font-size: 10px; color: var(--ink-3); }
.dd { position: relative; }
.dd .menu { position: absolute; inset-inline-end: 0; top: 46px; min-width: 220px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--sh-lg); padding: 6px; display: none; z-index: 70; }
.dd.on .menu { display: block; }
.dd .menu a, .dd .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 8px; color: var(--ink); background: none; border: 0; cursor: pointer; text-align: start; text-decoration: none; }
.dd .menu a:hover, .dd .menu button:hover { background: var(--line-2); }
.dd .menu a.on { color: var(--brand); font-weight: 600; }
.dd .menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.dd .menu .lbl { font-size: 11px; color: var(--ink-3); padding: 6px 10px 2px; text-transform: uppercase; letter-spacing: .04em; }

.content { padding: 20px 22px 40px; max-width: 1600px; width: 100%; }
.offline-bar { background: var(--warn); color: #fff; text-align: center; font-size: 12px; padding: 4px; display: none; }
body.offline .offline-bar { display: block; }

/* mobile shell: drawer + bottom tabs */
.mtabs { display: none; }
.scrim { display: none; }
@media (max-width: 1024px) {
  .side { transform: translateX(-100%); width: 280px; }
  body.drawer .side { transform: none; }
  body.drawer .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 35; }
  .main, body.mini .main { margin-inline-start: 0; }
  .gsearch kbd, .outlet-pick small, .userchip div { display: none; }
  .content { padding: 14px 12px 90px; }
  .mtabs { display: flex; position: fixed; bottom: 0; inset-inline-start: 0; inset-inline-end: 0; height: 62px; background: var(--card); border-top: 1px solid var(--line); z-index: 30; padding-bottom: env(safe-area-inset-bottom); }
  .mtabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10px; color: var(--ink-3); text-decoration: none; }
  .mtabs a i { font-size: 18px; }
  .mtabs a.on { color: var(--brand); }
  .newbtn span { display: none; }
}
@media (max-width: 560px) {
  .gsearch { display: none; }
  .outlet-pick { max-width: 150px; padding: 5px 8px; }
  .outlet-pick .oi { display: none; }
  .top { padding: 0 8px; gap: 4px; }
  .top .ib { width: 34px; }
  .top .hide-xs { display: none; }
  .newbtn { padding: 0 11px; }
  .userchip { padding: 2px; border: 0; }
}

/* ───────────── page furniture ───────────── */
.page-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-h h1 { font-size: 21px; display: flex; align-items: center; gap: 10px; }
.page-h h1 .hi { width: 36px; height: 36px; border-radius: 10px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-size: 15px; }
.page-h .sub { width: 100%; color: var(--ink-3); font-size: 13px; margin-top: -6px; }
.page-h .sp { flex: 1; }
.page-h input.q { height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; min-width: 220px; background: var(--card); }
.crumbs { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a { color: var(--ink-3); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); }
.card > .hd { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card > .hd h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card > .hd .sp { flex: 1; }
.card > .bd { padding: 16px; }
.card > .ft { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
.card.pad { padding: 16px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
.span2 { grid-column: span 2; }
@media (max-width: 1200px) { .g5 { grid-template-columns: repeat(3, minmax(0,1fr)); } .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 760px) { .g2, .g3, .g4, .g5 { grid-template-columns: minmax(0,1fr); } .span2 { grid-column: auto; } .g4.keep2, .g5.keep2 { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* KPI tiles */
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; box-shadow: var(--sh); position: relative; overflow: hidden; }
.kpi .ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-size: 16px; flex: none; }
.kpi .v { font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.kpi .d { font-size: 11px; font-weight: 600; margin-top: 4px; }
.kpi .d.up { color: var(--ok); } .kpi .d.down { color: var(--bad); }
.ic.r { background: var(--brand-50); color: var(--brand); } .ic.g { background: var(--ok-50); color: var(--ok); } .ic.y { background: var(--warn-50); color: var(--warn); }
.ic.b { background: var(--info-50); color: var(--info); } .ic.p { background: var(--violet-50); color: var(--violet); } .ic.n { background: var(--line-2); color: var(--ink-2); }

/* buttons */
.btn { height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { border-color: var(--ink-3); text-decoration: none; }
.btn.pri { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.pri:hover { background: var(--brand-600); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.lg { height: 46px; padding: 0 20px; font-size: 15px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.rowbtn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); display: inline-grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.rowbtn:hover { border-color: var(--brand); color: var(--brand); }
.rowbtn.del:hover { border-color: var(--bad); color: var(--bad); }

/* tables */
.tbwrap { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; }
.tb th { text-align: start; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--line-2); white-space: nowrap; position: sticky; top: 0; }
.tb td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tb tr:hover td { background: var(--line-2); }
.tb td.act { text-align: end; white-space: nowrap; }
.tb tfoot td { font-weight: 700; background: var(--line-2); }
.tb .who { display: flex; align-items: center; gap: 10px; }
.tb .who b { display: block; }
.tb .who small { color: var(--ink-3); }
@media (max-width: 760px) {
  table.tb.stack thead { display: none; }
  table.tb.stack tr { display: block; border-bottom: 1px solid var(--line); padding: 8px 0; }
  table.tb.stack td { display: flex; justify-content: space-between; gap: 10px; border: 0; padding: 5px 12px; }
  table.tb.stack td[data-l]::before { content: attr(data-l); color: var(--ink-3); font-size: 12px; }
  table.tb.stack td.act { justify-content: flex-end; }
}

/* pills, chips, tabs */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.pill.g { background: var(--ok-50); color: var(--ok); } .pill.r { background: var(--bad-50); color: var(--bad); } .pill.y { background: var(--warn-50); color: var(--warn); }
.pill.b { background: var(--info-50); color: var(--info); } .pill.p { background: var(--violet-50); color: var(--violet); } .pill.br { background: var(--brand-50); color: var(--brand); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.chip.on { background: var(--ink); color: var(--card); border-color: var(--ink); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button, .tabs a { border: 0; background: none; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; display: inline-flex; gap: 8px; align-items: center; }
.tabs button.on, .tabs a.on { color: var(--brand); border-bottom-color: var(--brand); }
.pane { display: none; } .pane.on { display: block; }

/* food type mark (FSSAI style) */
span.ft, i.ft, .fmark { display: inline-grid; place-items: center; width: 14px; height: 14px; border: 1.5px solid var(--veg); border-radius: 3px; flex: none; vertical-align: -2px; }
span.ft::after, i.ft::after, .fmark::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--veg); }
span.ft.NONVEG, i.ft.NONVEG, .fmark.NONVEG { border-color: var(--nonveg); }
span.ft.NONVEG::after, i.ft.NONVEG::after, .fmark.NONVEG::after { background: transparent; width: 0; height: 0; border-radius: 0; border-inline-start: 4px solid transparent; border-inline-end: 4px solid transparent; border-bottom: 7px solid var(--nonveg); }
span.ft.EGG, i.ft.EGG, .fmark.EGG { border-color: var(--egg); } span.ft.EGG::after, i.ft.EGG::after, .fmark.EGG::after { background: var(--egg); }

/* forms */
.fgrid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px 16px; }
.fgrid.c3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.fgrid.c4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.fg { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fg.full { grid-column: 1 / -1; }
.fg label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.fg label .req { color: var(--bad); }
.fg .hint { font-size: 11px; color: var(--ink-3); }
.inp, .fg input:not([type=checkbox]):not([type=radio]):not([type=color]), .fg select, .fg textarea {
  height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 0 11px; background: var(--card); outline: none; width: 100%; min-width: 0; }
.fg textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; }
.inp:focus, .fg input:focus, .fg select:focus, .fg textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(226,55,68,.12); }
.fg input[type=color] { height: 38px; width: 70px; border: 1px solid var(--line); border-radius: 9px; padding: 3px; background: var(--card); }
@media (max-width: 760px) { .fgrid, .fgrid.c3, .fgrid.c4 { grid-template-columns: minmax(0,1fr); } }
.err { display: none; color: var(--bad); font-size: 12px; } .err.on { display: block; }

/* toggle switch */
.togg { display: flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.sw { position: relative; width: 40px; height: 22px; flex: none; }
.sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.sw span { position: absolute; inset: 0; background: #cfd5e1; border-radius: 22px; transition: .15s; }
.sw span::before { content: ""; position: absolute; width: 16px; height: 16px; inset-inline-start: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.sw input:checked ~ span { background: var(--ok); }
.sw input:checked ~ span::before { transform: translateX(18px); }

/* notes, bars, empty */
.note { background: var(--info-50); color: var(--ink-2); border: 1px solid transparent; border-radius: 10px; padding: 10px 12px; font-size: 13px; display: flex; gap: 10px; }
.note i { color: var(--info); margin-top: 2px; }
.warnbar { background: var(--warn-50); border-radius: 10px; padding: 10px 12px; font-size: 13px; display: flex; gap: 10px; align-items: center; }
.warnbar i { color: var(--warn); }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty i { font-size: 34px; margin-bottom: 10px; opacity: .5; display: block; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--ink-3); } .kv dd { margin: 0; font-weight: 600; }
.progress { height: 8px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.sect { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; margin: 18px 0 8px; }

/* modals (bottom sheets on phones) */
.ovl { position: fixed; inset: 0; background: rgba(15,20,30,.5); display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.ovl.on { display: flex; }
.mdl { background: var(--card); border-radius: var(--r-lg); width: 560px; max-width: 100%; max-height: 92vh; display: flex; flex-direction: column; box-shadow: var(--sh-lg); }
.mdl.sm { width: 400px; } .mdl.lg { width: 860px; } .mdl.xl { width: 1120px; }
.mdl > .hd { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.mdl > .hd h3 { font-size: 16px; flex: 1; }
.mdl > .hd .x { width: 32px; height: 32px; border-radius: 8px; border: 0; background: var(--line-2); cursor: pointer; }
.mdl > .bd { padding: 16px 18px; overflow: auto; }
.mdl > .ft { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
@media (max-width: 640px) {
  .ovl { align-items: flex-end; padding: 0; }
  .mdl, .mdl.sm, .mdl.lg, .mdl.xl { width: 100%; border-radius: 18px 18px 0 0; max-height: 94vh; }
}

/* toast */
#toasts { position: fixed; inset-inline-end: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: var(--card); padding: 10px 14px; border-radius: 10px; box-shadow: var(--sh-lg); font-size: 13px; display: flex; gap: 10px; align-items: center; animation: tin .2s; max-width: 380px; }
.toast.ok i { color: #4ade80; } .toast.err { background: var(--bad); color: #fff; }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }
@media (max-width: 1024px) { #toasts { bottom: 76px; inset-inline-start: 12px; inset-inline-end: 12px; } }

/* Apps launcher */
.apps-hero { background: linear-gradient(120deg, #1b2235 0%, #2b1830 60%, var(--brand) 140%); color: #fff; border-radius: var(--r-lg); padding: 22px 24px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.apps-hero h1 { font-size: 22px; }
.apps-hero p { margin: 4px 0 0; opacity: .8; }
.apps-hero .sp { flex: 1; }
.apps-hero .hs { display: flex; gap: 18px; flex-wrap: wrap; }
.apps-hero .hs div b { display: block; font-size: 20px; }
.apps-hero .hs div small { opacity: .75; }
.app-grp { margin-bottom: 18px; }
.app-grp h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.app-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.app-tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; color: var(--ink); text-decoration: none; transition: transform .12s, box-shadow .12s, border-color .12s; min-height: 98px; }
.app-tile:hover { transform: translateY(-2px); box-shadow: var(--sh-lg); border-color: transparent; text-decoration: none; }
.app-tile .ti { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 16px; }
.app-tile b { font-size: 13px; }

/* charts */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 200px; }

/* print */
@media print {
  .side, .top, .mtabs, .no-print, #toasts { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; }
}

/* ============================================================================
   Right-to-left (Arabic). <html dir="rtl" lang="ar"> comes from LocalizationService.Dir.
   Most shell rules above use logical properties; this block flips what they cannot
   (transforms, icons that point, absolutely placed bits) and keeps numbers LTR.
   ============================================================================ */
html[lang=ar] { --font: "Segoe UI", "Noto Naskh Arabic", "Noto Sans Arabic", Tahoma, "Noto Sans", system-ui, sans-serif; }
html[lang=ar] * { letter-spacing: normal !important; }          /* letter-spacing breaks Arabic joining */
html[lang=ar] body { line-height: 1.5; }
/* numbers, money, phones, TRN, bill numbers: always LTR, isolated from the Arabic around them */
.ltr, [data-ltr], .phone, .trn, .billno, a[href^="tel:"], input[type=tel], input[type=number], input[type=email], input[type=url], kbd, code { direction: ltr; unicode-bidi: isolate; }
input:not([type]), input[type=text], input[type=search], textarea { unicode-bidi: plaintext; }  /* type Arabic or English naturally */
html[dir=rtl] input[type=tel], html[dir=rtl] input[type=number], html[dir=rtl] input[type=email], html[dir=rtl] input[type=url] { text-align: end; }
html[dir=rtl] .num, html[dir=rtl] td.num, html[dir=rtl] th.num { text-align: start; }
html[dir=rtl] .kpi .v { direction: ltr; unicode-bidi: isolate; text-align: end; }
/* shell */
@media (max-width: 1024px) {
  html[dir=rtl] .side { transform: translateX(100%); }
  html[dir=rtl] body.drawer .side { transform: none; }
}
html[dir=rtl] .side .grp-h .chev { transform: rotate(180deg); }
html[dir=rtl] .side .grp.open .grp-h .chev { transform: rotate(90deg); }
/* icons that point a direction */
html[dir=rtl] .fa-chevron-right, html[dir=rtl] .fa-chevron-left, html[dir=rtl] .fa-arrow-right, html[dir=rtl] .fa-arrow-left,
html[dir=rtl] .fa-angle-right, html[dir=rtl] .fa-angle-left, html[dir=rtl] .fa-caret-right, html[dir=rtl] .fa-caret-left,
html[dir=rtl] .fa-arrow-right-long, html[dir=rtl] .fa-arrow-left-long, html[dir=rtl] .fa-right-from-bracket, html[dir=rtl] .fa-right-to-bracket,
html[dir=rtl] .fa-arrow-right-from-bracket, html[dir=rtl] .fa-arrow-right-to-bracket, html[dir=rtl] .fa-reply, html[dir=rtl] .fa-share,
html[dir=rtl] .fa-circle-chevron-right, html[dir=rtl] .fa-circle-chevron-left, html[dir=rtl] .fa-angles-right, html[dir=rtl] .fa-angles-left,
html[dir=rtl] .fa-arrow-turn-up, html[dir=rtl] .fa-up-right-from-square, html[dir=rtl] .fa-arrow-up-right-from-square { transform: scaleX(-1); }
html[dir=rtl] .side .grp-h .chev.fa-chevron-right { transform: rotate(180deg); }
html[dir=rtl] .side .grp.open .grp-h .chev.fa-chevron-right { transform: rotate(90deg); }
/* toggle switch knob travels the other way */
html[dir=rtl] .sw input:checked ~ span::before { transform: translateX(-18px); }
/* tables, kv, notes */
html[dir=rtl] table.tb.stack td.num { text-align: start; }
@media (max-width: 760px) {
  /* stacked rows are flex: keep label on the right, value on the left */
  html[dir=rtl] table.tb.stack td.num { direction: rtl; }
}
/* truncated names (outlet / brand / table): an English name keeps its own direction, so the "…" lands at its end */
html[dir=rtl] .side .bname, html[dir=rtl] .outlet-pick b, html[dir=rtl] .pbar .brand b, html[dir=rtl] .pbar .brand small,
html[dir=rtl] .ct b, html[dir=rtl] .ct small, html[dir=rtl] .qh-t b, html[dir=rtl] .tt small, html[dir=rtl] .tile .lc { unicode-bidi: plaintext; text-align: right; }
/* SweetAlert2 dialogs */
html[dir=rtl] .swal2-popup { direction: rtl; font-family: var(--font); }
/* printing Arabic: per-line direction, numbers stay LTR */
@media print { html[dir=rtl] .main { margin: 0 !important; } }

