/* Fixdock admin — hand-written CSS, no framework. Logical properties everywhere so Arabic (RTL) just works. */
:root {
    --bg: #f4f6fa;
    --panel: #ffffff;
    --panel-2: #f8fafc;
    --line: #e5e8ef;
    --line-2: #d5dae4;
    --text: #182033;
    --muted: #64708a;
    --faint: #98a2b6;
    --primary: #2563eb;
    --primary-2: #1d4ed8;
    --primary-soft: #e8efff;
    --ok: #16a34a;
    --ok-soft: #e7f7ed;
    --warn: #d97706;
    --warn-soft: #fff4e0;
    --danger: #dc2626;
    --danger-soft: #fdecec;
    --side: #0f172a;
    --side-text: #b7c0d4;
    --side-active: #1e293b;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-lg: 0 18px 50px -12px rgba(16, 24, 40, .28);
    --r: 10px;
    --r-lg: 14px;
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
    color-scheme: light;
}
[data-theme="dark"] {
    --bg: #0b1020;
    --panel: #121a2c;
    --panel-2: #172036;
    --line: #232d45;
    --line-2: #2e3a57;
    --text: #e6eaf3;
    --muted: #9aa6c0;
    --faint: #6b7794;
    --primary: #4f83ff;
    --primary-2: #6b97ff;
    --primary-soft: #1a2747;
    --ok-soft: #12301f;
    --warn-soft: #3a2a10;
    --danger-soft: #3a1518;
    --side: #080c18;
    --side-active: #151d33;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    color-scheme: dark;
}
[dir="rtl"] { --font: 'Cairo', 'Inter', system-ui, sans-serif; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
/* Links that are components (rows, chips, cards, bars, pictures) never underline: only links inside text do */
a:is(.row, .rowlink, .chip, .tag, .hbar, .stat, .panel, .card, .badge, .pill, .avatar, .brand, .wa-float, .skip, .proof__img, .page-card__thumb, .portal-kid), a:is(.row, .rowlink, .chip, .tag, .hbar, .stat, .panel, .card, .badge, .pill, .avatar, .brand, .wa-float, .skip, .proof__img, .page-card__thumb, .portal-kid):hover,
a:has(div, p, h2, h3, h4, img, table, .avatar, .avatar-lg), a:has(div, p, h2, h3, h4, img, table, .avatar, .avatar-lg):hover,
.portal-bar__kids a, .portal-bar__kids a:hover { text-decoration: none; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--primary); color: #fff; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.i { flex: none; }
/* Icons inside text (headings, labels, cells, links…) stay on the line of their text; in flex rows they are flex items anyway */
:where(h1, h2, h3, h4, h5, p, label, legend, dt, dd, th, td, li, small, strong, b, em, span, a, summary) > .i { display: inline-block; vertical-align: -.2em; }
[dir="rtl"] .flip { transform: scaleX(-1); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: .92em; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.right { text-align: end; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; background: linear-gradient(to right, var(--side) 248px, transparent 248px); }
[dir="rtl"] .app { background: linear-gradient(to left, var(--side) 248px, transparent 248px); }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--side); color: var(--side-text); overflow-y: auto; scrollbar-width: thin; z-index: 40; }
.side__brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; font-weight: 700; font-size: 16px; }
.side__brand:hover { text-decoration: none; }
.side__logo { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: linear-gradient(135deg, var(--primary), #7c3aed); color: #fff; flex: none; overflow: hidden; }
.side__logo img { width: 100%; height: 100%; object-fit: cover; }
.side__shop { display: grid; line-height: 1.2; min-width: 0; }
.side__shop small { font-weight: 500; font-size: 11.5px; color: var(--side-text); }
.side nav { padding: 6px 10px 20px; display: grid; gap: 2px; }
.nav-group { margin: 14px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #64748b; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--side-text); font-weight: 500; }
.nav-link:hover { background: var(--side-active); color: #fff; text-decoration: none; }
.nav-link.is-active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--primary); }
[dir="rtl"] .nav-link.is-active { box-shadow: inset -3px 0 0 var(--primary); }
.nav-link .count { margin-inline-start: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: #1e2a44; color: #cbd5e1; font-size: 11.5px; text-align: center; }
.nav-link .count--warn { background: #7c2d12; color: #fed7aa; }
.side__foot { margin-top: auto; padding: 14px 18px; border-top: 1px solid #1e293b; font-size: 12px; color: #64748b; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 62px; padding: 0 24px; background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar__burger { display: none; }
.gsearch { position: relative; flex: 1; max-width: 520px; }
.gsearch input { width: 100%; height: 40px; padding-inline: 38px 52px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.gsearch input:focus { outline: none; border-color: var(--primary); background: var(--panel); box-shadow: 0 0 0 3px var(--primary-soft); }
.gsearch > .i { position: absolute; inset-inline-start: 12px; top: 11px; color: var(--faint); }
.gsearch kbd { position: absolute; inset-inline-end: 10px; top: 9px; padding: 1px 7px; border: 1px solid var(--line-2); border-radius: 6px; font-size: 11.5px; color: var(--muted); background: var(--panel); }
.gsearch__panel { position: absolute; top: calc(100% + 6px); inset-inline: 0; max-height: 70vh; overflow: auto; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); }
.gsearch__group { padding: 8px 10px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.gsearch__item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); }
.gsearch__item:hover, .gsearch__item.is-active { background: var(--primary-soft); text-decoration: none; }
.gsearch__item small { color: var(--muted); margin-inline-start: auto; }
.topbar__actions { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
.content { padding: 24px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text); font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, color .15s; text-decoration: none !important; vertical-align: middle; }
.btn:hover { border-color: var(--faint); background: var(--panel-2); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-2); border-color: var(--primary-2); }
.btn--ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn--danger { color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--ghost:hover { background: var(--panel-2); border-color: transparent; }
.btn--sm { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn--xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn--icon { width: 38px; padding: 0; }
.btn--icon.btn--sm { width: 32px; }
.btn--block { width: 100%; }
.btn--wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn--wa:hover { background: #1fb457; border-color: #1fb457; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* ---------- Cards, grids ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); min-width: 0; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card__head h2, .card__head h3 { font-size: 15px; font-weight: 650; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-main { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row--wrap { flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.spacer { flex: 1; }

/* Stat tiles */
.stat { display: flex; gap: 14px; align-items: center; padding: 16px 18px; }
.stat__icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.stat__icon--ok { background: var(--ok-soft); color: var(--ok); }
.stat__icon--warn { background: var(--warn-soft); color: var(--warn); }
.stat__icon--danger { background: var(--danger-soft); color: var(--danger); }
.stat b { display: block; font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 13px; }
a.stat:hover { text-decoration: none; background: var(--panel-2); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 10px 14px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: start; background: var(--panel-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--panel-2); }
.table .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table a.rowlink { color: var(--text); font-weight: 600; }
.table--compact td { padding: 8px 12px; }
.table tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.table-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.table-tools .input, .table-tools .select { height: 36px; width: auto; }
.table-tools .btn { height: 36px; } /* same height as the filters next to it */
.table-tools .input--search { min-width: 240px; flex: 1; max-width: 360px; }

/* ---------- Badges, chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: color-mix(in srgb, var(--c, #64748b) 14%, transparent); color: color-mix(in srgb, var(--c, #64748b) 82%, var(--text)); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c, #64748b); }
.badge--plain::before { display: none; }
.pri { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; text-transform: capitalize; }
.pri::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.pri--low { color: var(--faint); } .pri--normal { color: var(--muted); } .pri--high { color: var(--warn); } .pri--urgent { color: var(--danger); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 5px; background: var(--primary-soft); color: var(--primary); font-size: 11.5px; font-weight: 600; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 700; flex: none; }
.avatar--sm { width: 24px; height: 24px; font-size: 10.5px; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .error { font-size: 12px; color: var(--danger); }
.input, .select, .textarea { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--panel); transition: border-color .15s, box-shadow .15s; }
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-inline-end: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364708a' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
[dir="rtl"] .select { background-position: left 10px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.is-invalid, .select.is-invalid, .textarea.is-invalid { border-color: var(--danger); }
.input--sm, .select--sm { height: 34px; font-size: 13px; }
.input--lg, .select--lg { height: 46px; font-size: 15px; } /* matches .btn--lg */
.input-group { display: flex; }
.input-group .input { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-group .addon { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--line-2); border-inline-start: 0; border-start-end-radius: 9px; border-end-end-radius: 9px; background: var(--panel-2); color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 38px; height: 22px; border-radius: 11px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { inset-inline-start: 19px; }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); }
.seg a, .seg button, .seg label { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 7px; border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; }
.seg .is-active, .seg input:checked + span { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.seg label input { display: none; }
.seg label span { padding: 5px 12px; border-radius: 7px; }
.seg label { padding: 0; }

/* Device type picker */
.typepick { cursor: pointer; }
.typepick input:checked + .btn { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.typepick input:focus-visible + .btn { outline: 2px solid var(--primary); outline-offset: 2px; }
.svc-pick { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.svc-pick:hover { border-color: var(--line-2); }
.svc-pick:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.svc-pick b { margin-inline-start: auto; }

/* Check grid (intake checklist) */
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.checklist__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); }
[dir="rtl"] .checklist__row { padding: 6px 12px 6px 6px; }
.tri { display: inline-flex; gap: 2px; }
.tri label { cursor: pointer; }
.tri input { display: none; }
.tri span { display: grid; place-items: center; width: 28px; height: 26px; border-radius: 6px; color: var(--faint); border: 1px solid transparent; }
.tri input:checked + span.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.tri input:checked + span.bad { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.tri input:checked + span.na { background: var(--panel); color: var(--muted); border-color: var(--line-2); }

/* Pattern lock */
.pattern { position: relative; width: 168px; height: 168px; touch-action: none; user-select: none; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.pattern svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pattern__dot { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: var(--line-2); transition: background .1s, transform .1s; }
.pattern__dot.is-on { background: var(--primary); transform: scale(1.15); }
.pattern--sm { width: 96px; height: 96px; }
.pattern--sm .pattern__dot { width: 12px; height: 12px; margin: -6px 0 0 -6px; }

/* Signature pad */
.sigpad { width: 100%; height: 160px; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--panel); touch-action: none; cursor: crosshair; }

/* ---------- Alerts, toasts ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; border: 1px solid; font-weight: 500; }
.alert--ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); color: color-mix(in srgb, var(--ok) 80%, var(--text)); }
.alert--warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: color-mix(in srgb, var(--warn) 70%, var(--text)); }
.alert--danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: color-mix(in srgb, var(--danger) 80%, var(--text)); }
.alert--info { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 30%, transparent); color: color-mix(in srgb, var(--primary) 70%, var(--text)); }
.toasts { position: fixed; inset-block-end: 20px; inset-inline-end: 20px; display: grid; gap: 8px; z-index: 200; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 11px; background: var(--side); color: #fff; box-shadow: var(--shadow-lg); animation: toast-in .25s ease; font-weight: 500; }
.toast .i { color: #4ade80; }
.toast--error .i { color: #f87171; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Dropdown, modal ---------- */
.dd { position: relative; }
.dd__menu { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; min-width: 200px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 60; display: none; }
.dd.is-open .dd__menu { display: block; }
.dd__menu a, .dd__menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; color: var(--text); text-align: start; cursor: pointer; font-weight: 500; }
.dd__menu a:hover, .dd__menu button:hover { background: var(--panel-2); text-decoration: none; }
.dd__menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
dialog.modal { width: min(560px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 16px; background: var(--panel); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.modal--lg { width: min(860px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(10, 15, 30, .55); backdrop-filter: blur(2px); }
.modal__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal__head h3 { font-size: 16px; }
.modal__body { padding: 20px; max-height: 70vh; overflow: auto; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--panel-2); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px; border: 0; background: none; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer; text-decoration: none; }
.tabs .is-active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .count { padding: 0 6px; border-radius: 8px; background: var(--panel-2); font-size: 11.5px; }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.kcol { display: flex; flex-direction: column; max-height: calc(100vh - 190px); background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; }
.kcol__head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; font-weight: 650; border-top: 3px solid var(--c); border-radius: 14px 14px 0 0; }
.kcol__head .count { margin-inline-start: auto; color: var(--muted); font-weight: 600; font-size: 12.5px; }
.kcol__body { display: grid; gap: 8px; padding: 0 10px 12px; overflow-y: auto; min-height: 80px; align-content: start; }
.kcol.is-over { border-color: var(--primary); background: var(--primary-soft); }
.kcard { display: grid; gap: 6px; padding: 11px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); cursor: grab; color: var(--text); }
.kcard:hover { border-color: var(--line-2); text-decoration: none; }
.kcard.is-dragging { opacity: .45; }
.kcard__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.kcard__top b { color: var(--text); font-family: var(--mono); font-size: 12.5px; }
.kcard__device { font-weight: 650; }
.kcard__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.kcard--overdue { border-inline-start: 3px solid var(--danger); }

/* ---------- Timeline ---------- */
.timeline { display: grid; gap: 0; }
.tl { position: relative; display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding-bottom: 16px; }
.tl::before { content: ""; position: absolute; inset-inline-start: 15px; top: 32px; bottom: 0; width: 2px; background: var(--line); }
.tl:last-child::before { display: none; }
.tl__dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.tl__dot--status { background: color-mix(in srgb, var(--c) 16%, var(--panel)); border-color: var(--c); color: var(--c); }
.tl__body { min-width: 0; padding-top: 4px; }
.tl__meta { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tl__text { margin-top: 4px; white-space: pre-line; overflow-wrap: anywhere; }
.tl__text--note { padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.tl__text--public { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 25%, transparent); }

/* Definition list */
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 9px 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Totals */
.totals { display: grid; gap: 6px; padding: 14px 18px; }
.totals div { display: flex; justify-content: space-between; gap: 10px; }
.totals .total { padding-top: 8px; border-top: 1px solid var(--line); font-size: 17px; font-weight: 700; }
.totals .due { color: var(--danger); font-weight: 700; }
.totals .paid-full { color: var(--ok); font-weight: 700; }

/* Photos */
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.photos a { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--panel-2); }
.photos img { width: 100%; height: 100%; object-fit: cover; }
.photos .badge { position: absolute; bottom: 5px; inset-inline-start: 5px; height: 20px; font-size: 10.5px; background: rgba(0,0,0,.55); color: #fff; }
.photos .badge::before { display: none; }
.dropzone { display: grid; place-items: center; gap: 6px; padding: 18px; border: 1.5px dashed var(--line-2); border-radius: 12px; color: var(--muted); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }

/* Empty state */
.empty { display: grid; justify-items: center; gap: 10px; padding: 48px 20px; text-align: center; color: var(--muted); }
.empty .i { color: var(--faint); }
.empty h3 { color: var(--text); font-size: 16px; }

/* Pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.pager__links { display: flex; gap: 4px; }
.pager__links a, .pager__links span { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); color: var(--text); font-weight: 600; }
.pager__links a:hover { border-color: var(--line-2); text-decoration: none; background: var(--panel-2); }
.pager__links .is-active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager__links .is-off { opacity: .4; }

/* Charts (SVG) */
.chart { width: 100%; height: 220px; }
.chart .bar { fill: var(--primary); }
.chart .bar:hover { fill: var(--primary-2); }
.chart .grid-line { stroke: var(--line); stroke-dasharray: 3 3; }
.chart text { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.bars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(0, 160px) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.hbar__track { display: block; height: 9px; border-radius: 5px; background: var(--panel-2); overflow: hidden; }
.hbar__fill { display: block; height: 100%; border-radius: 5px; background: var(--c, var(--primary)); }

/* ---------- Auth & installer ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth__side { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 48px; background: radial-gradient(circle at 20% 10%, #3b5bdb 0, transparent 50%), radial-gradient(circle at 90% 90%, #7c3aed 0, transparent 45%), #0f172a; color: #fff; overflow: hidden; }
.auth__side h2 { font-size: 34px; line-height: 1.15; letter-spacing: -.02em; max-width: 440px; }
.auth__side p { color: #c7d2fe; margin-top: 12px; max-width: 420px; }
.auth__side ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 10px; color: #e0e7ff; }
.auth__side li { display: flex; gap: 10px; align-items: center; }
.auth__form { display: grid; place-items: center; padding: 32px; }
.auth__box { width: min(400px, 100%); display: grid; gap: 18px; }
.auth__box h1 { font-size: 24px; }
.auth__demo { padding: 12px 14px; border-radius: 10px; background: var(--primary-soft); font-size: 13px; }
.auth__demo code { font-family: var(--mono); }
.auth__docs { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-weight: 600; }

/* Print helpers */
@media print {
    .side, .topbar, .no-print, .toasts { display: none !important; }
    .app { display: block; }
    .content { padding: 0; }
    .card { box-shadow: none; border: 0; }
    body { background: #fff; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    .g-4 { grid-template-columns: repeat(2, 1fr); }
    .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
    .app, [dir="rtl"] .app { grid-template-columns: 1fr; background: none; }
    .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 270px; transform: translateX(-100%); transition: transform .25s ease; }
    [dir="rtl"] .side { transform: translateX(100%); }
    .side.is-open { transform: none; box-shadow: var(--shadow-lg); }
    .side-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(10,15,30,.5); }
    .topbar__burger { display: inline-flex; }
    .g-3, .g-2 { grid-template-columns: 1fr; }
    .auth { grid-template-columns: 1fr; }
    .auth__side { display: none; }
}
@media (max-width: 640px) {
    .content { padding: 16px; }
    .topbar { padding: 0 12px; }
    .g-4 { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .dl { grid-template-columns: 1fr; gap: 2px 0; }
    .dl dd { margin-bottom: 8px; }
    .gsearch kbd { display: none; }
    .page-head h1 { font-size: 19px; }
    .hide-sm { display: none !important; }
    .table-tools .input--search { min-width: 0; width: 100%; max-width: none; }
}

/* ---------- Website pages ---------- */
.pages-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.page-card { overflow: visible; display: flex; flex-direction: column; }
.page-card__thumb { position: relative; display: block; height: 170px; padding: 12px; background: var(--panel-2); border-bottom: 1px solid var(--line); border-radius: var(--r-lg) var(--r-lg) 0 0; overflow: hidden; color: var(--muted); }
.page-card__blocks { display: grid; gap: 5px; }
.page-card__blk { display: block; padding: 5px 8px; border-radius: 6px; font-size: 10.5px; font-weight: 600; background: var(--panel); border: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-card__blk--dark { background: #1e293b; color: #cbd5e1; border-color: #1e293b; }
.page-card__blk--primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-card__blk--light { background: var(--line); }
.page-card__edit { position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 82%, transparent); color: #fff; font-weight: 700; opacity: 0; transition: opacity .15s; }
.page-card__edit .i { display: none; }
.page-card__thumb:hover .page-card__edit, .page-card__thumb:focus-visible .page-card__edit { opacity: 1; text-decoration: none; }
.page-card__body { display: grid; gap: 2px; padding: 12px 14px; min-width: 0; }

/* ---------- Appointments ---------- */
.cal-toolbar { flex-wrap: wrap; }
.cal-toolbar h2 { font-size: 15px; }
.cal { --days: 7; --gutter: 56px; }
.cal__head, .cal__body { display: grid; grid-template-columns: var(--gutter) repeat(var(--days), minmax(0, 1fr)); }
.cal__head { border-bottom: 1px solid var(--line); background: var(--panel-2); }
.cal__dayhead { display: flex; align-items: baseline; justify-content: center; gap: 6px; padding: 9px 4px; font-size: 12.5px; color: var(--muted); border-inline-start: 1px solid var(--line); min-width: 0; }
.cal__dayhead b { font-size: 16px; color: var(--text); }
.cal__dayhead.is-today { color: var(--primary); }
.cal__dayhead.is-today b { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 13.5px; }
.cal__scroll { max-height: min(68vh, 760px); overflow-y: auto; scrollbar-width: thin; }
.cal__hours { position: relative; }
.cal__hour { position: relative; border-top: 1px solid var(--line); }
.cal__hour:first-child { border-top: 0; }
.cal__hour span { position: absolute; top: -8px; inset-inline-end: 8px; font-size: 11px; color: var(--faint); background: var(--panel); padding: 0 2px; font-variant-numeric: tabular-nums; }
.cal__hour:first-child span { top: 2px; }
.cal__col { position: relative; border-inline-start: 1px solid var(--line); cursor: copy; background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 51px, var(--line) 51px, var(--line) 52px); }
.cal__col.is-today { background-color: color-mix(in srgb, var(--primary) 4%, transparent); }
.cal__off { position: absolute; inset-inline: 0; display: grid; place-items: center; background: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--line) 70%, transparent) 6px 7px); background-color: color-mix(in srgb, var(--panel-2) 70%, transparent); pointer-events: none; }
.cal__off span { font-size: 12px; font-weight: 600; color: var(--faint); }
.cal__now { position: absolute; inset-inline: 0; height: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.cal__now::before { content: ""; position: absolute; inset-inline-start: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.cal__ev { position: absolute; z-index: 1; display: flex; flex-direction: column; gap: 1px; padding: 3px 7px; overflow: hidden; border: 0; border-inline-start: 3px solid var(--c); border-radius: 7px; background: color-mix(in srgb, var(--c) 14%, var(--panel)); color: var(--text); text-align: start; font-size: 12px; line-height: 1.3; cursor: pointer; box-shadow: var(--shadow); }
.cal__ev:hover { background: color-mix(in srgb, var(--c) 24%, var(--panel)); z-index: 3; }
.cal__ev b { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal__ev span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal__ev--cancelled, .cal__ev--no_show { opacity: .6; }
.cal__ev--cancelled b { text-decoration: line-through; }
.cal__empty { position: absolute; top: 40%; inset-inline: 0; text-align: center; color: var(--faint); pointer-events: none; }
.cal--day .cal__dayhead { justify-content: flex-start; padding-inline: 12px; }
.appt-row { cursor: pointer; }
.appt-foot { flex-wrap: wrap; align-items: center; }
.appt-foot form { display: contents; }
@media (max-width: 640px) {
    .cal { --gutter: 46px; }
    .cal-toolbar .legend { display: none; }
}

/* ---------- Inventory & purchase orders ---------- */
.inv-thumb { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; flex: none; overflow: hidden; background: var(--panel-2); border: 1px solid var(--line); color: var(--faint); }
.inv-thumb img { width: 100%; height: 100%; object-fit: cover; }
.inv-thumb--lg { width: 72px; height: 72px; border-radius: 12px; }
.inv-stock { display: inline-block; min-width: 30px; padding: 1px 8px; border-radius: 6px; font-weight: 700; text-align: center; background: var(--ok-soft); color: var(--ok); }
.inv-stock.is-low { background: var(--warn-soft); color: var(--warn); }
.inv-stock.is-out { background: var(--danger-soft); color: var(--danger); }
.inv-stock-big { font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1; color: var(--ok); }
.inv-stock-big.is-low { color: var(--warn); }
.inv-stock-big.is-out { color: var(--danger); }
.inv-code { display: block; padding: 10px 12px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12px; overflow-wrap: anywhere; }
.po-lines .input--sm { width: 100%; min-width: 72px; }

/* ---------- Catalog (devices & prices) ---------- */
.cat-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.cat-models { position: sticky; top: 78px; display: flex; flex-direction: column; max-height: calc(100vh - 100px); }
.cat-models .table-tools { flex-wrap: nowrap; }
.cat-models .table-tools .select { max-width: 130px; }
.cat-models__list { overflow-y: auto; padding: 6px 8px 10px; scrollbar-width: thin; position: relative; }
.cat-models__brand { padding: 10px 8px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.cat-model { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--text); font-weight: 500; }
.cat-model:hover { background: var(--panel-2); text-decoration: none; }
.cat-model.is-active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.cat-model.is-active .chip { border-color: color-mix(in srgb, var(--primary) 30%, transparent); color: var(--primary); background: var(--panel); }
.cat-model__empty { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.inv-thumb--md { width: 44px; height: 44px; border-radius: 10px; }
.cat-svc .cat-svc__edit td, .cat-svc .cat-svc__edit:hover td { background: var(--panel-2); }
.cat-svc-form { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 10px 12px; align-items: end; padding: 4px 0; }
.cat-svc-form:has(select) { grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)); }
.cat-svc-form .field > label { font-size: 12px; color: var(--muted); }
.cat-svc-form__desc { grid-column: 1 / 2; }
.cat-svc-form__opts { grid-column: 2 / -1; gap: 14px; }
@media (max-width: 1100px) {
    .cat-grid { grid-template-columns: 1fr; }
    .cat-models { position: static; max-height: 360px; }
}
@media (max-width: 640px) {
    .cat-svc-form, .cat-svc-form:has(select) { grid-template-columns: 1fr 1fr; }
    .cat-svc-form__name, .cat-svc-form__desc, .cat-svc-form__opts { grid-column: 1 / -1; }
    .cat-svc .cat-svc__edit td { white-space: normal; }
}

/* ---------- Settings ---------- */
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.settings__nav { position: sticky; top: 80px; display: grid; gap: 2px; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.settings__nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: 13.5px; }
.settings__nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.settings__nav a.is-active { background: var(--primary-soft); color: var(--primary); }
.settings__main { min-width: 0; }
.settings__save { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 10px 12px 10px 18px; background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); }
.settings__save .muted { margin-inline-end: auto; font-size: 13px; }
.le { display: grid; gap: 10px; }
.le__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.le__row { display: flex; align-items: center; gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); }
.le__row .input { flex: 1; min-width: 0; background: var(--panel); }
.le__row.is-dragging, .st-row.is-dragging, .menu-row.is-dragging { opacity: .45; }
.le__grip { display: grid; place-items: center; width: 22px; height: 30px; color: var(--faint); cursor: grab; flex: none; }
.le__empty { font-size: 13px; }
.le__add { display: flex; gap: 6px; }
.le__add .input { flex: 1; min-width: 0; }
.brandpick { display: flex; align-items: center; gap: 14px; }
.brandpick__img { display: grid; place-items: center; width: 96px; height: 64px; padding: 6px; border: 1px dashed var(--line-2); border-radius: 10px; background: var(--panel-2); color: var(--faint); flex: none; overflow: hidden; }
.brandpick__img--sm { width: 64px; }
.brandpick__img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.hours-edit { display: grid; gap: 4px; padding-block: 10px; }
.hours-edit__row { display: grid; grid-template-columns: 200px auto 1fr; align-items: center; gap: 12px; min-height: 44px; padding: 2px 0; border-bottom: 1px solid var(--line); }
.hours-edit__row:last-child { border-bottom: 0; }
.hours-edit__times { display: flex; align-items: center; gap: 8px; }
.hours-edit__times .input { width: 120px; }
.hours-edit__closed { display: none; font-size: 13px; }
.hours-edit__row.is-closed .hours-edit__times { display: none; }
.hours-edit__row.is-closed .hours-edit__closed { display: block; }
.tpl__vars { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tpl__var { cursor: pointer; font-family: var(--mono); font-size: 11.5px; }
.tpl__var:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.sms-preview { display: grid; gap: 6px; }
.sms-preview code { display: block; padding: 10px 12px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12.5px; overflow-wrap: anywhere; }
.st-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 10px 18px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); background: var(--panel-2); }
.st-list { list-style: none; margin: 0; padding: 10px; display: grid; gap: 6px; }
.st-row { display: grid; grid-template-columns: auto auto minmax(160px, 1fr) auto auto; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.st-color { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); cursor: pointer; }
.st-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.st-name .input { flex: 1; min-width: 0; }
.st-count { font-size: 12px; white-space: nowrap; }
.st-flags { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.st-flags .check input { width: 15px; height: 15px; }
.st-del__undo { display: none; font-size: 12px; font-weight: 600; }
.st-row.is-removed { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.st-row.is-removed .st-name .input { text-decoration: line-through; opacity: .6; }
.st-row.is-removed .st-flags, .st-row.is-removed .st-color { opacity: .4; }
.st-row.is-removed .st-del { width: auto; padding: 0 10px; }
.st-row.is-removed .st-del .i { display: none; }
.st-row.is-removed .st-del__undo { display: inline; }
.st-move { grid-column: 3 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--danger); font-weight: 600; }
.st-move .select { width: auto; min-width: 180px; }
.perm-table td, .perm-table th { vertical-align: middle; }
.perm-col { width: 110px; text-align: center !important; }
.perm-col input { width: 17px; height: 17px; accent-color: var(--primary); margin: auto; display: block; }
.perm-group td { padding: 9px 14px; background: var(--panel-2); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.backup-tile { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
@media (max-width: 1440px) {
    .st-row { grid-template-columns: auto auto minmax(0, 1fr) auto; }
    .st-flags { grid-column: 3 / -1; grid-row: 2; }
    .st-del { grid-column: 4; grid-row: 1; }
}
@media (max-width: 960px) {
    .settings { grid-template-columns: 1fr; gap: 14px; }
    .settings__nav { position: static; display: flex; overflow-x: auto; scrollbar-width: none; padding: 6px; }
    .settings__nav a { white-space: nowrap; flex: none; }
}
@media (max-width: 640px) {
    .hours-edit__row { grid-template-columns: 1fr; gap: 6px; padding: 8px 0; }
    .hours-edit__times .input { width: auto; flex: 1; min-width: 0; }
    .brandpick { flex-wrap: wrap; }
    .perm-col { width: 64px; }
    .settings__save { padding: 8px; }
    .settings__save .btn { width: 100%; }
    .st-row { grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 8px; }
    .st-name { flex-wrap: wrap; gap: 2px 8px; }
    .st-flags { grid-column: 1 / -1; }
    .st-move { grid-column: 1 / -1; }
}
.settings .form-grid, .settings .grid { align-items: start; }
@media (max-width: 640px) {
    .table-tools .input--search { flex-basis: 100%; } /* flex:1 resets the basis to 0, so the search box stayed narrow on phones */
    .inv-name { max-width: 170px !important; }
    .po-lines .ellipsis { white-space: normal; max-width: 150px !important; }
    .po-lines th:nth-child(2), .po-lines th:nth-child(3) { width: auto !important; }
    .po-lines .input--sm { min-width: 64px; }
}

/* ---------- Sales: point of sale, invoices, payments, expenses, reports ---------- */
.kpis .stat > span:last-child { min-width: 0; }
.kpis .stat b { overflow-wrap: anywhere; }
.chip.is-active { background: var(--primary-soft); color: var(--primary); border-color: color-mix(in srgb, var(--primary) 40%, transparent); }
button.chip { font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.seg--xs { padding: 2px; }
.seg--xs button { padding: 1px 7px; font-size: 12px; border-radius: 6px; }
.is-out { color: var(--danger) !important; font-weight: 600; }

/* POS */
.pos-head { margin-bottom: 14px; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 16px; align-items: start; }
.pos__catalog { display: grid; gap: 12px; min-width: 0; }
.pos__search { position: relative; }
.pos__search > .i { position: absolute; inset-inline-start: 15px; top: 15px; color: var(--faint); }
.pos__search .input { height: 50px; padding-inline: 46px 52px; font-size: 15px; border-radius: 12px; box-shadow: var(--shadow); }
.pos__search kbd { position: absolute; inset-inline-end: 12px; top: 14px; padding: 1px 7px; border: 1px solid var(--line-2); border-radius: 6px; font-size: 11.5px; color: var(--muted); background: var(--panel); }
.pos__search .gsearch__panel { z-index: 20; }
.pos__cats { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pos__cats .chip { height: 30px; padding: 0 12px; }
.pos__tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(142px, 1fr)); gap: 10px; }
.pos-tile { display: flex; flex-direction: column; gap: 6px; padding: 9px; min-height: 100%; text-align: start; font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); cursor: pointer; transition: border-color .15s, transform .1s; touch-action: manipulation; }
.pos-tile:hover { border-color: var(--primary); }
.pos-tile:active { transform: scale(.97); }
.pos-tile img, .pos-tile__ph { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 8px; background: var(--panel-2); }
.pos-tile__ph { display: grid; place-items: center; font-weight: 700; font-size: 17px; letter-spacing: .04em; color: color-mix(in srgb, var(--primary) 55%, var(--faint)); background: linear-gradient(135deg, var(--primary-soft), var(--panel-2)); }
.pos-tile__name { font-weight: 600; font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pos-tile__meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 6px; margin-top: auto; font-size: 11.5px; color: var(--muted); }
.pos-tile__meta b { color: var(--text); font-size: 14px; font-variant-numeric: tabular-nums; }
.pos-tile.is-bump { animation: pos-bump .25s ease; }
@keyframes pos-bump { 50% { transform: scale(.95); border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); } }

.pos__cart { position: sticky; top: 78px; display: flex; flex-direction: column; max-height: calc(100vh - 94px); overflow: hidden; }
.pos__cust { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.pos__debt { display: block; margin-top: 2px; font-size: 12px; font-weight: 600; color: var(--warn); white-space: normal; }
.pos__debt.is-over { color: var(--danger); }
.pos__cust-search { position: relative; }
.pos__cust-search > .i { position: absolute; inset-inline-start: 11px; top: 9px; color: var(--faint); }
.pos__cust-search .input { padding-inline-start: 34px; }
.pos__lines { flex: 1 1 auto; min-height: 110px; overflow-y: auto; overscroll-behavior: contain; }
.pos-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 6px 8px; padding: 9px 10px 9px 14px; border-bottom: 1px solid var(--line); }
[dir="rtl"] .pos-line { padding: 9px 14px 9px 10px; }
.pos-line.is-open { background: var(--panel-2); }
.pos-line__main { display: grid; min-width: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: start; cursor: pointer; }
.pos-line__name { font-weight: 600; font-size: 13.5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pos-line__meta { font-size: 12px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pos-line__main:hover .pos-line__name { color: var(--primary); }
.pos-qty { display: inline-flex; align-items: center; gap: 3px; }
.pos-qty .btn { width: 30px; height: 30px; padding: 0; border-radius: 8px; }
.pos-qty .input { width: 42px; height: 30px; padding: 0 2px; text-align: center; font-weight: 600; -moz-appearance: textfield; appearance: textfield; }
.pos-qty .input::-webkit-inner-spin-button, .pos-qty .input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pos-line__total { min-width: 72px; text-align: end; font-variant-numeric: tabular-nums; }
.pos-line__rm { width: 28px !important; height: 28px; color: var(--faint); }
.pos-line__rm:hover { color: var(--danger); }
.pos-line__edit { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pos-line__edit .field { gap: 2px; }
.pos__sum { display: grid; gap: 5px; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--panel-2); }
.pos__sum > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.pos__disc { width: 96px; height: 30px; text-align: end; }
.pos__total { margin-top: 3px; padding-top: 7px; border-top: 1px dashed var(--line-2); font-size: 20px !important; font-weight: 700; }
.pos__pay { display: grid; gap: 10px; padding: 12px 14px 14px; border-top: 1px solid var(--line); }
.pos__methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; }
.pos__methods .btn { height: 38px; }
.pos__methods .btn.is-active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.pos__tender { flex: 1; display: grid; gap: 2px; font-size: 12px; min-width: 0; }
.pos__tender .input { height: 44px; font-size: 19px; font-weight: 700; text-align: end; font-variant-numeric: tabular-nums; }
.pos__pay > .row .btn { align-self: flex-end; height: 44px; }
.pos__quick, .pos__splits { display: flex; flex-wrap: wrap; gap: 6px; }
.pos__quick:empty, .pos__splits:empty, .pos__state:empty { display: none; }
.pos__quick .chip { height: 30px; padding: 0 10px; }
.pos__splits .chip { height: 28px; color: var(--text); }
.pos__splits .chip button { padding: 0 2px; border: 0; background: none; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
.pos__change, .pos__balance { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: 10px; font-weight: 600; }
.pos__change { background: var(--ok-soft); color: color-mix(in srgb, var(--ok) 80%, var(--text)); }
.pos__balance { background: var(--warn-soft); color: color-mix(in srgb, var(--warn) 75%, var(--text)); }
.pos__change b, .pos__balance b { font-size: 18px; font-variant-numeric: tabular-nums; }
.pos__state .hint { margin-top: 6px; font-size: 12.5px; }
.pos__ok { text-align: center; font-size: 13px; font-weight: 600; color: var(--ok); }
.pos__charge { height: 54px; font-size: 17px; border-radius: 12px; }
.pos__bar { display: none; }
.pos-done { display: grid; justify-items: center; gap: 14px; text-align: center; padding-top: 26px; }
.pos-done__icon { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.pos-done h3 { font-size: 18px; }
@media (max-width: 1200px) {
    .pos { grid-template-columns: minmax(0, 1fr) 350px; }
    .pos__tiles { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
}
@media (max-width: 767px) {
    .pos { grid-template-columns: 1fr; }
    .pos__cart { position: static; max-height: none; overflow: visible; scroll-margin-top: 72px; }
    .pos__lines { max-height: none; }
    .pos__tiles { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
    .pos-tile { padding: 7px; }
    .pos__bar { position: fixed; inset-inline: 12px; inset-block-end: 12px; z-index: 25; display: none; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 14px; background: var(--side); color: #fff; box-shadow: var(--shadow-lg); text-decoration: none !important; }
    [dir="rtl"] .pos__bar { padding: 8px 16px 8px 8px; }
    .pos__bar.is-on { display: flex; }
    .pos__bar b { font-size: 16px; }
    body:has(.pos__bar.is-on) .content { padding-bottom: 84px; }
}

/* Invoices */
.inv-totals { max-width: 360px; margin-inline-start: auto; padding: 0; }
.inv-lines td:first-child { min-width: 220px; }
.inv-lines td .input { min-width: 64px; }

/* Expenses */
.exp-month { align-items: center; }
.exp-month a { padding: 5px 8px; }
.exp-month .input { width: auto; height: 30px; border: 0; background: transparent; font-weight: 600; }
.exp-month .input:focus { box-shadow: none; }

/* Reports */
.rep-range { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; }
.rep-presets { display: flex; flex-wrap: wrap; max-width: 100%; }
.rep-delta { margin-inline-start: 4px; font-style: normal; font-size: 12px; font-weight: 700; white-space: nowrap; }
.rep-delta.is-up { color: var(--ok); }
.rep-delta.is-down { color: var(--danger); }
.rep-note { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12.5px; }
@media (max-width: 640px) {
    .kpis { gap: 10px; }
    .kpis .stat { padding: 12px; gap: 10px; align-items: flex-start; flex-direction: column; }
    .kpis .stat__icon { width: 34px; height: 34px; border-radius: 9px; }
    .kpis .stat b { font-size: 17px; }
    .rep-range form, .rep-range form label { width: 100%; }
    .rep-range form label .input { flex: 1; }
}
.pos-tile { min-height: 84px; border-inline-start: 3px solid color-mix(in srgb, var(--primary) 35%, var(--line)); }
.pos-tile:has(img) { border-inline-start-width: 1px; }
@media (max-width: 767px) {
    .pos__cats { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
    .pos__cats .chip, .pos__cats .btn { flex: none; }
    .pos__cats .spacer { display: none; }
}

/* ---------- Website: menus, theme, media, messages ---------- */
.menu-list { list-style: none; margin: 0; padding: 10px; display: grid; gap: 6px; min-height: 64px; }
.menu-row { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.2fr) auto auto; align-items: center; gap: 8px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.menu-row .input { background: var(--panel); }
.menu-row__tab { font-size: 12.5px; white-space: nowrap; }
.menu-row__tab input { width: 15px; height: 15px; }
.menu-empty { padding: 14px; text-align: center; font-size: 13px; border: 1.5px dashed var(--line-2); border-radius: 10px; }
.menu-page { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.menu-page:last-child { border-bottom: 0; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.preset { display: inline-flex; align-items: center; gap: 0; padding: 5px 10px 5px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); cursor: pointer; }
.preset span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--panel); margin-inline-end: -5px; }
.preset small { margin-inline-start: 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.preset:hover, .preset.is-active { border-color: var(--primary); background: var(--primary-soft); }
.colorpick { display: flex; align-items: center; gap: 8px; }
.colorpick input[type=color] { width: 40px; height: 34px; padding: 2px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); cursor: pointer; flex: none; }
.colorpick .input { flex: 1; min-width: 0; }
.fontpick { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.fontpick__item span { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; font-size: 13px; color: var(--muted); }
.fontpick__item b { font-size: 24px; color: var(--text); line-height: 1.1; }
.fontpick__item input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.fontpick__item input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.radius-demo, .header-demo { margin-inline-start: auto; width: 44px; height: 22px; background: var(--primary); flex: none; }
.radius-demo--rounded { border-radius: 7px; } .radius-demo--soft { border-radius: 999px; } .radius-demo--square { border-radius: 2px; }
.header-demo { border-radius: 5px; border: 1px solid var(--line-2); background: linear-gradient(var(--panel) 0 34%, var(--panel-2) 34%); }
.header-demo--dark { background: linear-gradient(#0f172a 0 34%, var(--panel-2) 34%); }
.theme-side { position: sticky; top: 80px; }
.tprev { --p: #2563eb; --a: #f59e0b; --d: #0f172a; --r: 12px; --r-btn: 9px; --font: system-ui; font-family: var(--font); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; color: #0f172a; font-size: 12px; }
.tprev__hdr { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid #e5e7eb; background: #fff; }
.tprev--dark .tprev__hdr { background: var(--d); color: #fff; border-color: transparent; }
.tprev__logo { display: flex; align-items: center; gap: 6px; font-weight: 700; min-width: 0; white-space: nowrap; overflow: hidden; }
.tprev__logo i { width: 16px; height: 16px; border-radius: 5px; background: var(--p); flex: none; }
.tprev__logo img { width: 18px; height: 18px; object-fit: contain; }
.tprev__nav { display: flex; gap: 10px; opacity: .75; }
.tprev__hero { display: grid; gap: 6px; justify-items: start; padding: 18px 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--p) 10%, #fff), #fff); }
.tprev__hero b { font-size: 18px; line-height: 1.15; color: var(--d); }
.tprev__hero > span:not(.row) { color: #64748b; }
.tprev__badge { padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--a) 18%, #fff); color: color-mix(in srgb, var(--a) 70%, #000); font-weight: 700; font-size: 11px; }
.tprev__btn { display: inline-block; padding: 6px 12px; border-radius: var(--r-btn); background: var(--p); color: #fff; font-weight: 600; }
.tprev__btn--ghost { background: transparent; color: var(--p); box-shadow: inset 0 0 0 1.5px var(--p); }
.tprev__cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px 14px; }
.tprev__cards span { height: 46px; border-radius: var(--r); background: #f1f5f9; border-top: 3px solid var(--a); }
.tprev__foot { padding: 10px 14px; background: var(--d); color: rgba(255,255,255,.7); font-size: 11px; }
.media-card { position: relative; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; padding: 14px; }
.media-item { margin: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); }
.media-item__img { display: block; aspect-ratio: 4 / 3; background: repeating-conic-gradient(var(--panel-2) 0 25%, var(--panel) 0 50%) 0 0 / 16px 16px; }
.media-item__img img { width: 100%; height: 100%; object-fit: contain; }
.media-item figcaption { display: grid; gap: 1px; padding: 8px 10px 4px; font-size: 12.5px; min-width: 0; }
.media-item__actions { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 8px 8px; margin-top: auto; }
.media-empty { cursor: pointer; margin: 14px; border: 1.5px dashed var(--line-2); border-radius: 12px; }
.media-empty:hover { border-color: var(--primary); background: var(--primary-soft); }
.media-over { position: absolute; inset: 0; display: none; place-items: center; align-content: center; gap: 10px; border: 2px dashed var(--primary); border-radius: var(--r-lg); background: color-mix(in srgb, var(--primary-soft) 88%, transparent); color: var(--primary); font-weight: 700; font-size: 16px; z-index: 5; pointer-events: none; }
.media-card.is-over .media-over { display: grid; }
.media-progress { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--primary); font-weight: 600; font-size: 13px; }
.media-progress__bar { width: 120px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--primary) 0 40%, var(--primary-soft) 40%); background-size: 200% 100%; animation: media-load 1s linear infinite; }
@keyframes media-load { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.inbox { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.inbox__list { overflow: hidden; }
.inbox__item { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); color: var(--text); }
.inbox__item:hover { background: var(--panel-2); text-decoration: none; }
.inbox__item.is-active { background: var(--primary-soft); }
.inbox__item.is-unread b::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-inline-end: 6px; border-radius: 50%; background: var(--primary); vertical-align: 1px; }
.inbox__item:not(.is-unread) b { font-weight: 600; }
.inbox__text { display: grid; gap: 2px; min-width: 0; flex: 1; font-size: 13px; }
.inbox__body { padding: 14px 16px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); white-space: pre-line; overflow-wrap: anywhere; line-height: 1.6; }
.inbox__back { display: none; }
@media (max-width: 1200px) { .theme-side { position: static; } }
@media (max-width: 960px) {
    .inbox { grid-template-columns: 1fr; }
    .inbox.has-current .inbox__list { display: none; }
    .inbox:not(.has-current) .inbox__view { display: none; }
    .inbox__back { display: inline-flex; }
}
@media (max-width: 640px) {
    .menu-row { grid-template-columns: auto minmax(0, 1fr) auto; }
    .menu-row [data-f=url] { grid-column: 2; grid-row: 2; }
    .menu-row__tab { grid-column: 3; grid-row: 2; }
    .menu-row__tab span { display: none; }
    .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 10px; }
}
.theme-edit .grid, .theme-edit .field { align-items: start; align-content: start; }

/* ---------- Narrow columns on laptops ---------- */
@media (max-width: 1440px) { .hide-lg { display: none; } }
.menu-row__langs { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; padding-inline-start: 28px; }
.menu-row__langs label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--muted); }

/* POS: messages appear at the top so they never cover the Charge button */
body:has(.pos) .toasts { inset-block-end: auto; inset-block-start: 72px; }

/* Drop-down lists: our own chevron instead of the browser's arrow (Chrome on Windows draws a grey box on hover) */
select:not([multiple]):not([size]) {
    -webkit-appearance: none; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2364708a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; background-size: 16px 16px;
    padding-inline-end: 38px; cursor: pointer;
}
[dir="rtl"] select:not([multiple]):not([size]) { background-position: left 12px center; }
select:not([multiple]):not([size]):hover:not(:disabled):not(:focus) { border-color: color-mix(in srgb, currentColor 35%, transparent); }
select::-ms-expand { display: none; }

/* ---------- Debts ---------- */
@media (max-width: 960px) { .hide-md { display: none !important; } }
.debt-ages__bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: var(--panel-2); gap: 2px; }
.debt-ages__bar span { display: block; height: 100%; }
.debt-ages__legend { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.debt-ages__item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: 8px; row-gap: 2px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; color: inherit; text-decoration: none; }
.debt-ages__item:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--line)); }
.debt-ages__item.is-active { border-color: var(--primary); background: var(--primary-soft); }
.debt-ages__item b { grid-column: 1 / -1; font-size: 16px; }
.debt-ages__item .muted { font-size: 12px; }
.debt-ages__dot { width: 9px; height: 9px; border-radius: 50%; }
.debt-ages__label { font-size: 12.5px; color: var(--muted); }
@media (max-width: 760px) { .debt-ages__legend { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.debt-limit { width: 90px; height: 4px; margin: 5px 0 0 auto; border-radius: 2px; background: var(--panel-2); overflow: hidden; }
[dir="rtl"] .debt-limit { margin: 5px auto 0 0; }
.debt-limit span { display: block; height: 100%; background: var(--warn); }
.debt-limit span.is-over { background: var(--danger); }
.debt-docs td:first-child { width: 36px; }
.debt-docs tr.is-off td { opacity: .5; }
.debt-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line); }
.debt-total b { font-size: 20px; color: var(--danger); }
.debt-pay__alloc { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.debt-pay__alloc li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }

/* ---------- Store categories workspace ---------- */
.catman { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 16px; align-items: start; }
.catman__tree { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; }
.catman__group { padding: 6px; border-bottom: 1px solid var(--line); }
.catman__group:last-child { border-bottom: 0; }
.catlink { display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 6px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14px; }
.catlink:hover { background: var(--panel-2); text-decoration: none; }
.catlink.is-active { background: var(--primary-soft); color: var(--primary-2); font-weight: 600; }
.catlink--dept { font-weight: 700; }
.catlink--sub { padding-inline-start: 36px; }
.catlink > span:first-of-type { flex: 1; min-width: 0; }
.catlink__n { flex: none; min-width: 26px; padding: 1px 7px; border-radius: 99px; background: var(--panel-2); color: var(--muted); font-size: 12px; font-weight: 600; text-align: center; }
.catlink.is-active .catlink__n { background: var(--panel); }
.catadd { position: relative; flex: 1; min-width: 220px; }
.catadd__list { position: absolute; z-index: 30; inset-inline: 0; top: calc(100% + 4px); max-height: 340px; overflow-y: auto; padding: 4px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow-lg); }
.catadd__row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 7px; background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer; }
.catadd__row:hover, .catadd__row:focus-visible { background: var(--primary-soft); }
.catadd__row b { display: block; font-size: 13.5px; font-weight: 600; }
.catadd__row small { color: var(--muted); font-size: 12px; }
.catadd__row .i { margin-inline-start: auto; color: var(--primary); }
.catadd__none { padding: 12px; color: var(--muted); font-size: 13.5px; text-align: center; }
.catbulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.catbulk .select { width: auto; min-width: 190px; }
.catname { unicode-bidi: plaintext; text-align: start; }
[dir="rtl"] .catname { text-align: right; }
@media (max-width: 900px) {
    .catman { grid-template-columns: minmax(0, 1fr); }
    .catman__tree { position: static; max-height: 300px; }
}
/* ---------- Live delivery map (order page) ---------- */
.livemap { height: 240px; border-radius: 10px; border: 1px solid var(--line); overflow: hidden; background: #fff; }
.livemap .leaflet-control-attribution { font-size: 10px; }
.live-pin { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; background: var(--primary); border: 3px solid #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .35); }
.live-pin--home { color: #fff; background: var(--ok); border-color: #fff; }
