/* KogniLaundry design system — tokens, light/dark, RTL-safe (logical properties only). */
:root {
  --font-latin: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-arabic: "IBM Plex Sans Arabic", "Noto Sans Arabic", "Segoe UI", sans-serif;
  --font: var(--font-latin), var(--font-arabic);

  --brand-50: #ecfeff; --brand-100: #cffafe; --brand-200: #a5f3fc; --brand-400: #22c3e6;
  --brand-500: #06a6cf; --brand-600: #0787ad; --brand-700: #0c6a8a; --brand-900: #123c50;
  --accent: #14b8a6;

  --bg: #f4f7fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f6;
  --border: #e3e8ef;
  --border-strong: #cbd4e0;
  --text: #0f1b2d;
  --text-2: #475569;
  --text-3: #8392a7;
  --primary: var(--brand-600);
  --primary-hover: var(--brand-700);
  --primary-soft: #e3f5fb;
  --on-primary: #ffffff;

  --ok: #16a34a; --ok-soft: #e7f7ed;
  --warn: #d97706; --warn-soft: #fdf3e2;
  --err: #dc2626; --err-soft: #fdecec;
  --info: #2563eb; --info-soft: #e8effd;
  --violet: #7c3aed; --violet-soft: #f1eafe;
  --indigo: #4f46e5; --indigo-soft: #ecebfd;
  --teal: #0d9488; --teal-soft: #e2f6f3;
  --slate: #475569; --slate-soft: #eef1f5;

  --radius-sm: 8px; --radius: 12px; --radius-lg: 18px; --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15, 27, 45, .06);
  --shadow: 0 1px 3px rgba(15, 27, 45, .06), 0 6px 16px rgba(15, 27, 45, .06);
  --shadow-lg: 0 12px 40px rgba(15, 27, 45, .18);
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --touch: 48px;
  --side-w: 248px;
  --top-h: 60px;
  color-scheme: light;
}

/* data-theme is resolved before first paint by the inline script in the layout ("auto" follows the OS). */
:root[data-theme="dark"] {
  --bg: #0b1320;
  --surface: #121c2c;
  --surface-2: #162236;
  --surface-3: #1c2a40;
  --border: #23324a;
  --border-strong: #31445f;
  --text: #e7eef7;
  --text-2: #a9b7ca;
  --text-3: #71839b;
  --primary: #22b4dc;
  --primary-hover: #4cc6e8;
  --primary-soft: #11344a;
  --on-primary: #04121c;
  --ok-soft: #10301f; --warn-soft: #3a2a10; --err-soft: #3d1717; --info-soft: #14254a;
  --violet-soft: #2a1d4a; --indigo-soft: #1f1f4a; --teal-soft: #0f3330; --slate-soft: #1f2a3b;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 6px 16px rgba(0, 0, 0, .3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

[dir="rtl"] { --font: var(--font-arabic), var(--font-latin); }

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
[dir="rtl"] body { font-size: 15.5px; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3 { letter-spacing: 0; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
.num, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.muted { color: var(--text-2); } .faint { color: var(--text-3); }
.small { font-size: .85rem; } .tiny { font-size: .75rem; }
.bold { font-weight: 700; } .nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface);
  border-inline-end: 1px solid var(--border); display: flex; flex-direction: column; z-index: 40;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; height: var(--top-h); }
.logo {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 18px;
  background: linear-gradient(135deg, var(--brand-500), var(--accent)); box-shadow: 0 4px 12px rgba(6, 166, 207, .35);
}
.side-brand .t1 { font-weight: 800; font-size: 1.02rem; line-height: 1.1; }
.side-brand .t2 { font-size: .72rem; color: var(--text-3); }
.nav { padding: 8px 10px 16px; display: flex; flex-direction: column; gap: 2px; }
.nav-h { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 14px 10px 6px; }
[dir="rtl"] .nav-h { letter-spacing: 0; font-size: .78rem; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text-2);
  font-weight: 500; min-height: 42px;
}
.nav a i { width: 20px; text-align: center; font-size: 15px; color: var(--text-3); }
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.on { background: var(--primary-soft); color: var(--primary); font-weight: 650; }
.nav a.on i { color: var(--primary); }
.nav a .cnt { margin-inline-start: auto; font-size: .72rem; background: var(--surface-3); color: var(--text-2); padding: 1px 8px; border-radius: 99px; }
.side-foot { margin-top: auto; padding: 12px 16px; border-top: 1px solid var(--border); font-size: .75rem; color: var(--text-3); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 20px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.top .title { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: 10px; min-width: 0; }
.top .title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .sp { flex: 1; }
.burger { display: none; }
.page { padding: 20px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page-h { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-h .sp { flex: 1; }
.page-h p { margin: 2px 0 0; color: var(--text-2); font-size: .9rem; }

/* dropdowns in top bar */
.dd { position: relative; }
.dd-menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px; display: none; z-index: 60;
}
.dd.open .dd-menu { display: block; }
.dd-menu a, .dd-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 8px; color: var(--text); background: none;
  border: 0; font: inherit; cursor: pointer; text-align: start;
}
.dd-menu a:hover, .dd-menu button:hover { background: var(--surface-3); }
.dd-menu a.on { color: var(--primary); font-weight: 600; }
.dd-menu hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.dd-menu .lbl { padding: 6px 12px; font-size: .72rem; color: var(--text-3); font-weight: 700; text-transform: uppercase; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer;
  transition: background .12s, border-color .12s, transform .06s; white-space: nowrap; user-select: none; text-decoration: none;
}
.btn:hover { background: var(--surface-3); color: var(--text); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: .85rem; border-radius: 8px; }
.btn.lg { min-height: var(--touch); padding: 0 22px; font-size: 1.02rem; border-radius: 12px; }
.btn.xl { min-height: 60px; padding: 0 26px; font-size: 1.15rem; border-radius: 14px; }
.btn.icon { width: 40px; padding: 0; }
.btn.icon.sm { width: 32px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > label, .lbl-s { font-size: .82rem; font-weight: 600; color: var(--text-2); }
.input, select.input, textarea.input {
  width: 100%; min-height: 42px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface);
  color: var(--text); font: inherit; outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.input.lg { min-height: var(--touch); font-size: 1.05rem; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; inset-inline-start: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon > .input { padding-inline-start: 38px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 44px; height: 26px; border-radius: 99px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: inset-inline-start .15s; }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { inset-inline-start: 21px; }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-3); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button, .seg a {
  border: 0; background: transparent; padding: 0 14px; min-height: 36px; border-radius: 9px; font: inherit; font-weight: 600; color: var(--text-2);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.seg .on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Cards / layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-h h3 { font-size: 1rem; }
.card-h .sp { flex: 1; }
.card-b { padding: 18px; }
.card-b.tight { padding: 0; }
.cols { display: grid; gap: 16px; }
.cols.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols.c-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row .sp { flex: 1; }
.divider { border-top: 1px solid var(--border); margin: 14px 0; }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; position: relative; overflow: hidden; }
.kpi .k-l { font-size: .8rem; color: var(--text-2); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kpi .k-v { font-size: 1.6rem; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .k-s { font-size: .78rem; color: var(--text-3); margin-top: 2px; }
.kpi .k-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-size: 14px; }
.kpi.alert .k-v { color: var(--err); }
.tone-brand { background: var(--primary-soft); color: var(--primary); }
.tone-ok { background: var(--ok-soft); color: var(--ok); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-err { background: var(--err-soft); color: var(--err); }
.tone-violet { background: var(--violet-soft); color: var(--violet); }
.tone-indigo { background: var(--indigo-soft); color: var(--indigo); }
.tone-teal { background: var(--teal-soft); color: var(--teal); }
.tone-slate { background: var(--slate-soft); color: var(--slate); }

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th {
  text-align: start; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); font-weight: 700;
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap;
}
[dir="rtl"] .tbl th { letter-spacing: 0; font-size: .8rem; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tr.click { cursor: pointer; }
.tbl .r, .r { text-align: end; }
.tbl tfoot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--border-strong); }

/* ---------- Pills / chips ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: var(--radius-pill); font-size: .75rem; font-weight: 650; white-space: nowrap; line-height: 1.7; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-RECEIVED { background: var(--info-soft); color: var(--info); }
.st-TO_PLANT, .st-TO_STORE { background: var(--indigo-soft); color: var(--indigo); }
.st-AT_PLANT { background: var(--violet-soft); color: var(--violet); }
.st-PROCESSING { background: var(--warn-soft); color: var(--warn); }
.st-PROCESSED { background: var(--teal-soft); color: var(--teal); }
.st-READY { background: var(--ok-soft); color: var(--ok); }
.st-OUT_FOR_DELIVERY { background: var(--primary-soft); color: var(--primary); }
.st-DELIVERED, .st-COLLECTED { background: var(--slate-soft); color: var(--slate); }
.st-CANCELLED { background: var(--err-soft); color: var(--err); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-2); font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip.warn.on { background: var(--warn); border-color: var(--warn); color: #fff; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(9, 16, 28, .5); backdrop-filter: blur(2px); z-index: 100; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-bg.open { display: flex; animation: fade .15s; }
.modal { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: pop .18s; }
.modal.wide { max-width: 860px; }
.modal.xwide { max-width: 1100px; }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-h h3 { flex: 1; font-size: 1.08rem; }
.modal-b { padding: 18px 20px; overflow-y: auto; }
.modal-f { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

/* ---------- Toast / alerts ---------- */
#toasts { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--text); color: var(--surface); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: center; font-weight: 500; max-width: 380px; animation: pop .2s; }
.toast.ok i { color: #4ade80; } .toast.err i { color: #f87171; }
.alert { padding: 12px 16px; border-radius: 12px; display: flex; gap: 10px; align-items: flex-start; margin-bottom: 14px; font-size: .92rem; }
.alert.info { background: var(--info-soft); color: var(--info); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.err { background: var(--err-soft); color: var(--err); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.empty { text-align: center; padding: 40px 20px; color: var(--text-3); }
.empty i { font-size: 34px; margin-bottom: 10px; display: block; opacity: .6; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--text-2); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tabs .on { color: var(--primary); border-bottom-color: var(--primary); }

/* avatar */
.av { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: .85rem; background: var(--primary-soft); color: var(--primary); flex: none; }

/* timeline */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { position: relative; padding-inline-start: 26px; padding-bottom: 14px; }
.tl li::before { content: ""; position: absolute; inset-inline-start: 6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.tl li::after { content: ""; position: absolute; inset-inline-start: 10px; top: 18px; bottom: 0; width: 2px; background: var(--border); }
.tl li:last-child::after { display: none; }

/* progress / pipeline bars */
.bar { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--primary); }
.pipeline { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.pipe { border-radius: 14px; padding: 12px; text-align: center; }
.pipe .n { font-size: 1.5rem; font-weight: 800; }
.pipe .l { font-size: .75rem; font-weight: 600; }

/* kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.kcol-h { padding: 12px 14px; display: flex; align-items: center; gap: 8px; font-weight: 700; border-bottom: 1px solid var(--border); }
.kcol-b { padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; cursor: pointer; box-shadow: var(--shadow-sm); }
.kcard:hover { border-color: var(--primary); }
.kcard.overdue { border-inline-start: 4px solid var(--err); }

/* login */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art {
  background: radial-gradient(1200px 600px at 20% 10%, rgba(34, 195, 230, .35), transparent 60%),
              linear-gradient(150deg, #0c4a63 0%, #0b6a8a 45%, #12a594 100%);
  color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.auth-art h1 { font-size: 2.3rem; font-weight: 800; max-width: 480px; }
.auth-art p { opacity: .85; max-width: 440px; font-size: 1.05rem; }
.auth-art .bubbles span { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: var(--surface); }
.auth-box { width: 100%; max-width: 400px; }
.feat { display: flex; gap: 12px; align-items: center; margin: 10px 0; font-weight: 500; }
.feat i { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: rgba(255, 255, 255, .14); }

/* print */
@media print {
  .side, .top, .no-print, #toasts { display: none !important; }
  .shell { display: block; }
  .page { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { border: 0; box-shadow: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .cols.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols.c-main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 280px; transform: translateX(-105%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  [dir="rtl"] .side { transform: translateX(105%); }
  body.side-open .side { transform: none; }
  body.side-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 35; }
  .burger { display: inline-flex; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 700px) {
  .page { padding: 14px; }
  .top { padding: 0 12px; }
  .cols.c2, .cols.c3, .grid2, .grid3 { grid-template-columns: 1fr; }
  .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .k-v { font-size: 1.3rem; }
  .hide-sm { display: none !important; }
  .modal-bg { padding: 0; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: 18px 18px 0 0; }
  .tbl td, .tbl th { padding: 9px 10px; }
}

/* directional icons (arrows, chevrons) mirror in RTL */
[dir="rtl"] .flip { transform: scaleX(-1); }
