:root {
  --bg: #f4f6fa; --panel: #ffffff; --panel-2: #f8f9fc; --text: #172033; --muted: #687188; --line: #e3e7ef; --line-2: #cfd5e1;
  --brand: #0f766e; --brand-2: #115e59; --brand-soft: #e6f4f2; --accent: #2563eb; --ok: #15803d; --ok-soft: #e8f6ec; --bad: #c62828; --bad-soft: #fdecec; --warn: #b45309; --warn-soft: #fdf3e2;
  --side: #0e1726; --side-2: #172235; --side-t: #c9d2e3; --side-m: #7d89a3; --side-h: #fff;
  --r: 12px; --sh: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 14px rgba(16, 24, 40, .05);
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0d1320; --panel: #141c2c; --panel-2: #18223a; --text: #e6ebf5; --muted: #8f9ab2; --line: #243049; --line-2: #33415f;
  --brand: #2dd4bf; --brand-2: #5eead4; --brand-soft: #0f2f30; --accent: #60a5fa; --ok: #4ade80; --ok-soft: #12301f; --bad: #f87171; --bad-soft: #3a1717; --warn: #fbbf24; --warn-soft: #3a2b0d;
  --side: #0a101c; --side-2: #131c2e; --sh: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.ok-t { color: var(--ok); } .bad-t { color: var(--bad); } .warn-t { color: var(--warn); }
.spacer { flex: 1; }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; flex: none; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; font-weight: 600; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--panel-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #062421; }
.btn.primary:hover { background: var(--brand-2); }
.btn.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.btn.bad:hover { background: var(--bad-soft); }
.btn.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { min-height: 30px; padding: 3px 10px; font-size: 13px; }
.btn.icon { padding: 6px; width: 36px; }
.btn.sm.icon { width: 30px; }
.input { width: 100%; min-height: 38px; padding: 7px 11px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--panel); outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.input[readonly] { background: var(--panel-2); }
textarea.input { resize: vertical; }
select.input { padding-inline-end: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
kbd { font: 11px var(--font); padding: 1px 5px; border: 1px solid var(--line-2); border-radius: 5px; background: var(--panel-2); }

/* shell */
.shell { display: flex; min-height: 100vh; }
.side { width: 250px; flex: none; background: var(--side); color: var(--side-t); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; border-bottom: 1px solid var(--side-2); }
.brand .logo { width: 40px; height: 40px; border-radius: 11px; background: var(--brand); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 18px; overflow: hidden; flex: none; }
.brand .logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.brand b { display: block; color: var(--side-h); line-height: 1.3; }
.brand small { color: var(--side-m); font-size: 12px; }
.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 9px; color: var(--side-t); background: none; border: 0; cursor: pointer; text-align: start; font-weight: 600; }
.nav-a:hover { background: var(--side-2); color: var(--side-h); }
.nav-a.on { background: var(--brand); color: #fff; }
.nav-a .chev { margin-inline-start: auto; width: 15px; transition: transform .2s; opacity: .6; }
.nav-g.open .chev { transform: rotate(180deg); }
.nav-sub { display: none; flex-direction: column; padding: 2px 0 6px; margin-inline-start: 19px; border-inline-start: 1px solid var(--side-2); }
.nav-g.open .nav-sub { display: flex; }
.nav-sub a { color: var(--side-m); padding: 6px 14px; border-radius: 0 8px 8px 0; font-size: 13.5px; }
[dir="rtl"] .nav-sub a { border-radius: 8px 0 0 8px; }
.nav-sub a:hover { color: var(--side-h); }
.nav-sub a.on { color: var(--side-h); background: var(--side-2); box-shadow: inset 3px 0 0 var(--brand); }
[dir="rtl"] .nav-sub a.on { box-shadow: inset -3px 0 0 var(--brand); }
.side-foot { padding: 10px 16px; font-size: 12px; }
.side-dim { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 22px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); min-height: 60px; }
.top h1 { font-size: 19px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-act { display: flex; gap: 6px; flex-wrap: wrap; }
.user-btn { gap: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.content { padding: 20px 22px 60px; }
.only-m { display: none; }

/* cards & layout */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh); }
.card-h { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-h h2, .card-h h3 { margin: 0; font-size: 15px; }
.card-b { padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { width: auto; min-width: 140px; }
.toolbar .search { flex: 1; min-width: 200px; max-width: 380px; position: relative; }
.toolbar .search .input { width: 100%; padding-inline-start: 34px; }
.toolbar .search .ic { position: absolute; inset-inline-start: 10px; top: 10px; color: var(--muted); }

/* tables */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: start; font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--brand) 5%, transparent); }
.tbl .n { text-align: end; white-space: nowrap; }
.tbl tfoot td { font-weight: 800; background: var(--panel-2); border-top: 2px solid var(--line-2); }
.tbl .empty-row { text-align: center; color: var(--muted); padding: 34px; }
.tbl tr.grp td { font-weight: 700; background: color-mix(in srgb, var(--panel-2) 70%, transparent); }
.tbl tr.l1 td { font-weight: 800; }
.tbl tr.sub td { color: var(--muted); font-size: 13px; }
.pager { display: flex; align-items: center; gap: 8px; padding: 10px 14px; }

/* forms */
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field .req { color: var(--bad); font-style: normal; }
.span2 { grid-column: 1 / -1; }
.form-sec { font-weight: 800; color: var(--brand); padding-top: 8px; border-top: 1px dashed var(--line); margin-top: 4px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 38px; }
.switch input { display: none; }
.switch i { width: 40px; height: 22px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .2s; flex: none; }
.switch i::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(18px); }
[dir="rtl"] .switch input:checked + i::after { transform: translateX(-18px); }
.switch em { font-style: normal; color: var(--muted); font-size: 13px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.checks label { display: flex; gap: 8px; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }

/* modal & toast */
.overlay { position: fixed; inset: 0; background: rgba(10, 16, 28, .45); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.overlay.out { opacity: 0; transition: opacity .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--panel); border-radius: 16px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); animation: pop .18s; }
@keyframes pop { from { transform: translateY(8px) scale(.98); } }
.modal.sm { width: min(420px, 100%); } .modal.wide { width: min(860px, 100%); } .modal.xl { width: min(1100px, 100%); }
.modal-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line); }
[dir="rtl"] .modal-h { padding: 12px 18px 12px 14px; }
.modal-h b { flex: 1; font-size: 16px; }
.modal-b { padding: 18px; overflow-y: auto; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.confirm-msg { margin: 0; }
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-list .btn { justify-content: flex-start; }
.toasts { position: fixed; bottom: 20px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
[dir="rtl"] .toasts { transform: translateX(50%); }
.toast { background: #1f2937; color: #fff; padding: 10px 18px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: 90vw; animation: pop .2s; }
.toast.ok { background: var(--ok); color: #fff; } .toast.bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transition: opacity .3s; }

/* picker */
.pick-box { position: fixed; z-index: 300; background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.18); overflow-y: auto; padding: 4px; }
.pick-row { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 7px; cursor: pointer; white-space: nowrap; overflow: hidden; }
.pick-row b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.pick-row.on, .pick-row:hover { background: var(--brand-soft); }
.pick-end { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; }
.pick-empty { padding: 10px; color: var(--muted); }

/* dashboard */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.kpi { padding: 16px; display: flex; gap: 12px; align-items: flex-start; }
.kpi .ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.kpi small { color: var(--muted); font-weight: 600; display: block; }
.kpi b { font-size: 21px; display: block; margin-top: 2px; }
.alerts { display: flex; gap: 10px; flex-wrap: wrap; }
.alert { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-weight: 600; }
.bars { display: flex; align-items: flex-end; gap: 16px; height: 200px; padding: 10px 6px 0; }
.bars .m { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .pair { display: flex; gap: 4px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bars i { width: min(22px, 40%); border-radius: 5px 5px 0 0; background: var(--brand); min-height: 2px; }
.bars i.p { background: var(--accent); opacity: .55; }
.bars small { color: var(--muted); font-size: 11.5px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--brand); margin-inline-end: 5px; }
.legend i.p { background: var(--accent); opacity: .55; }

/* chart of accounts */
.coa { padding: 6px 0; }
.coa-row { display: flex; align-items: center; gap: 8px; padding: 6px 14px; cursor: pointer; border-radius: 8px; }
.coa-row:hover { background: var(--panel-2); }
.coa-row.on { background: var(--brand-soft); }
.coa-row .tg { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; flex: none; color: var(--muted); }
.coa-row .tg .ic { width: 15px; transition: transform .15s; }
.coa-row.closed .tg .ic { transform: rotate(90deg); }
[dir="rtl"] .coa-row.closed .tg .ic { transform: rotate(-90deg); }
.coa-row .code { color: var(--muted); min-width: 70px; }
.coa-row.grp .nm { font-weight: 700; }
.coa-row .bal { margin-inline-start: auto; }
.coa-row.off { opacity: .5; }

/* documents */
.doc-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.doc-head h2 { margin: 0; font-size: 18px; }
.lines { width: 100%; border-collapse: collapse; }
.lines th { font-size: 12px; color: var(--muted); font-weight: 700; padding: 8px 6px; text-align: start; border-bottom: 1px solid var(--line); background: var(--panel-2); white-space: nowrap; }
.lines td { padding: 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lines td.ln { color: var(--muted); text-align: center; padding-top: 12px; width: 34px; }
.lines .input { min-height: 34px; padding: 5px 8px; border-color: transparent; background: transparent; }
.lines .input:hover { border-color: var(--line-2); }
.lines .input:focus { border-color: var(--brand); background: var(--panel); }
.lines td.tot { text-align: end; padding: 11px 8px; font-weight: 700; white-space: nowrap; }
.lines .w-item { min-width: 240px; } .lines .w-n { width: 110px; } .lines .w-s { width: 80px; } .lines .w-u { width: 110px; } .lines .w-acc { min-width: 260px; }
.lines .meta { display: flex; gap: 4px; flex-wrap: wrap; padding: 0 8px 4px; }
.lines .meta .chip { font-size: 11px; cursor: pointer; }
.lines tr.add td { padding: 8px; border-bottom: 0; }
.totals { display: flex; flex-direction: column; gap: 6px; min-width: 280px; }
.totals .r { display: flex; justify-content: space-between; gap: 20px; }
.totals .r span { color: var(--muted); }
.totals .grand { font-size: 20px; font-weight: 800; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; }
.totals .grand span { color: var(--text); }
.doc-foot { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; justify-content: space-between; }
.doc-foot .memo { flex: 1; min-width: 260px; }
.status-posted { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.status-draft { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.stars { display: inline-block; position: relative; width: 70px; height: 13px; vertical-align: -1px; background: var(--line); -webkit-mask: repeating-linear-gradient(90deg, #000 0 12px, transparent 12px 14px); mask: repeating-linear-gradient(90deg, #000 0 12px, transparent 12px 14px); border-radius: 2px; }
.stars i { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--warn); }
.pbar.over i { background: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chips .chip button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.input.sm { padding: 4px 8px; font-size: 13px; width: auto; max-width: 190px; }
.rb-chart { padding: 16px; }
.rb-chart.pie { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.hbars { display: flex; flex-direction: column; gap: 6px; }
.hb { display: grid; grid-template-columns: minmax(90px, 220px) 1fr minmax(80px, auto); gap: 10px; align-items: center; font-size: 13px; }
.hb > div { background: var(--panel-2); border-radius: 6px; height: 16px; overflow: hidden; }
.hb i { display: block; height: 100%; background: var(--brand); border-radius: 6px; }
.hb b { text-align: end; }
.legend2 { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.legend2 i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-inline-end: 6px; }
.periods { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.period { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--ok-soft); color: inherit; cursor: pointer; font: inherit; text-align: start; }
.period small { display: flex; gap: 4px; align-items: center; font-size: 12px; }
.period small svg { width: 13px; height: 13px; }
.period.closed { background: var(--panel-2); color: var(--muted); }
.period:disabled { cursor: default; opacity: .75; }
.period:not(:disabled):hover { border-color: var(--brand); }
.kpi .delta { display: block; font-style: normal; font-size: 12px; font-weight: 600; }
.status-pending { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.status-approved { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.status-cancelled { background: var(--bad-soft); color: var(--bad); border-color: transparent; text-decoration: line-through; }
.bell { position: relative; }
.bell .badge { position: absolute; top: 2px; inset-inline-end: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--bad); color: #fff; font: 700 10px/16px system-ui, sans-serif; font-style: normal; text-align: center; }
.bell .badge[hidden] { display: none; }
.notes { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow: auto; }
.note { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; color: inherit; text-decoration: none; }
.note:hover { background: var(--panel-2); }
.note.new { border-inline-start: 3px solid var(--brand); background: var(--brand-soft); }
.note small { white-space: nowrap; }
.qr-box { display: flex; justify-content: center; padding: 12px; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.qr-box svg { width: 190px; height: 190px; }
.matrix th, .matrix td { text-align: center; white-space: nowrap; }
.matrix th:first-child, .matrix td:first-child { text-align: start; }
.matrix input { width: 16px; height: 16px; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
.timeline { display: flex; flex-direction: column; gap: 8px; }
.timeline div { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.stages { display: flex; gap: 6px; flex-wrap: wrap; }
.stages .btn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.balance-hint { font-size: 12.5px; }

/* reports */
.rep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.rep-card { padding: 16px; display: flex; gap: 12px; align-items: flex-start; cursor: pointer; transition: border-color .15s, transform .15s; }
.rep-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.rep-card .ico { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.rep-card b { display: block; }
.rep-card small { color: var(--muted); }
.rep-sec { font-size: 14px; color: var(--muted); margin: 18px 0 10px; font-weight: 700; }
.rep-params { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.rep-params .field { min-width: 150px; }
.rep-params .field.w { min-width: 280px; }
.rep-head { display: none; }
.statement { max-width: 760px; }
.statement .tbl td:first-child { width: 60%; }
.statement .total td { font-weight: 800; border-top: 2px solid var(--line-2); }
.statement .gt td { font-weight: 900; font-size: 15px; background: var(--brand-soft); }

/* login / setup */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent), var(--bg); }
.auth-card { width: min(460px, 100%); padding: 30px; }
.auth-card.wide { width: min(720px, 100%); }
.auth-card h1 { margin: 0 0 4px; font-size: 22px; }
.auth-logo { width: 54px; height: 54px; border-radius: 15px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 24px; font-weight: 800; margin-bottom: 14px; overflow: hidden; }
.auth-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.steps { display: flex; gap: 6px; margin: 14px 0 18px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps i.on { background: var(--brand); }
.countries { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.country { padding: 14px 10px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; text-align: center; background: var(--panel); }
.country.on { border-color: var(--brand); background: var(--brand-soft); }
.country b { display: block; } .country small { color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; cursor: pointer; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.tabs a.tab { padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.tabs a.tab.on { color: var(--brand); border-bottom-color: var(--brand); }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 90; transform: translateX(-100%); transition: transform .25s; }
  [dir="rtl"] .side { transform: translateX(100%); }
  body.nav-open .side { transform: none; }
  body.nav-open .side-dim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 80; }
  .only-m { display: inline-flex; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .content { padding: 14px 12px 60px; }
  .top { padding: 8px 12px; }
  .hide-s { display: none; }
}
@media (max-width: 640px) {
  .form, .form.g3, .form.g4, .g4 { grid-template-columns: 1fr; }
  .toolbar .search { max-width: none; }
  .top h1 { font-size: 16px; flex: 1; min-width: 0; }
  .top { flex-wrap: wrap; }
  .top-act { order: 9; width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .top > .spacer { display: none; }
  .top [data-lang] { padding: 4px 8px; }
  .countries { grid-template-columns: 1fr; }
  .modal-b { padding: 14px; }
  .totals { min-width: 0; width: 100%; }
}

/* print (reports) */
@media print {
  body { background: #fff; color: #000; font-size: 12px; }
  .side, .top, .toolbar, .rep-params, .no-print, .pager, .toasts { display: none !important; }
  .content { padding: 0; }
  .card { border: 0; box-shadow: none; }
  .rep-head { display: block; text-align: center; margin-bottom: 10px; }
  .tbl th { position: static; background: #eee !important; color: #000; }
  .tbl td, .tbl th { padding: 4px 6px; border-bottom: 1px solid #ccc; }
  .tbl-wrap { overflow: visible; }
}

/* v1.5: CRM board, progress bars, budget grid, bank reconciliation */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kcol { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-height: 140px; display: flex; flex-direction: column; gap: 8px; }
.kcol.over { border-color: var(--brand); background: var(--brand-soft); }
.kcol-h { display: flex; align-items: center; gap: 6px; padding: 2px 2px 6px; border-bottom: 1px solid var(--line); }
.kcard { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; cursor: grab; display: flex; flex-direction: column; gap: 3px; font-size: 13.5px; }
.kcard:hover { border-color: var(--brand); }
.kcard small { color: var(--muted); }
.pbar { display: inline-block; width: 70px; height: 6px; border-radius: 4px; background: var(--line); vertical-align: middle; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
table.lines.budget .input { min-width: 74px; padding-inline: 6px; }
table.lines.budget td:first-child .input { min-width: 220px; }
.tbl tr.on td { background: var(--ok-soft); }
.act-add { flex-wrap: wrap; }
@media (max-width: 720px) { .kanban { grid-auto-columns: 82%; } }

/* ---------- looks: palette, sidebar, density, font, corners (set on <html> by E.ui) ---------- */
:root[data-palette="blue"] { --brand: #1d4ed8; --brand-2: #1e40af; --brand-soft: #e8eefc; }
:root[data-palette="purple"] { --brand: #6d28d9; --brand-2: #5b21b6; --brand-soft: #f0eafc; }
:root[data-palette="rose"] { --brand: #be123c; --brand-2: #9f1239; --brand-soft: #fdecef; }
:root[data-palette="orange"] { --brand: #c2410c; --brand-2: #9a3412; --brand-soft: #fdefe6; }
:root[data-palette="green"] { --brand: #15803d; --brand-2: #166534; --brand-soft: #e8f6ec; }
:root[data-palette="slate"] { --brand: #334155; --brand-2: #1e293b; --brand-soft: #eceff4; }
:root[data-palette="gold"] { --brand: #a16207; --brand-2: #854d0e; --brand-soft: #fbf3dc; }
:root[data-theme="dark"][data-palette="blue"] { --brand: #60a5fa; --brand-2: #93c5fd; --brand-soft: #14264a; }
:root[data-theme="dark"][data-palette="purple"] { --brand: #a78bfa; --brand-2: #c4b5fd; --brand-soft: #261a47; }
:root[data-theme="dark"][data-palette="rose"] { --brand: #fb7185; --brand-2: #fda4af; --brand-soft: #3b1420; }
:root[data-theme="dark"][data-palette="orange"] { --brand: #fb923c; --brand-2: #fdba74; --brand-soft: #3a2010; }
:root[data-theme="dark"][data-palette="green"] { --brand: #4ade80; --brand-2: #86efac; --brand-soft: #12301f; }
:root[data-theme="dark"][data-palette="slate"] { --brand: #cbd5e1; --brand-2: #e2e8f0; --brand-soft: #232d40; }
:root[data-theme="dark"][data-palette="gold"] { --brand: #facc15; --brand-2: #fde047; --brand-soft: #33290a; }
:root[data-theme="dark"] .btn.primary, :root[data-theme="dark"] .nav-a.on, :root[data-theme="dark"] .avatar, :root[data-theme="dark"] .stages .btn.on { color: #0b1220; }

:root[data-side="light"] { --side: var(--panel); --side-2: var(--panel-2); --side-t: var(--text); --side-m: var(--muted); --side-h: var(--text); }
:root[data-side="light"] .side { border-inline-end: 1px solid var(--line); }
:root[data-side="light"] .nav-sub a.on { color: var(--brand); }
:root[data-side="brand"] { --side: color-mix(in srgb, var(--brand) 82%, #000); --side-2: color-mix(in srgb, var(--brand) 62%, #000); --side-t: rgba(255, 255, 255, .88); --side-m: rgba(255, 255, 255, .68); --side-h: #fff; }
:root[data-theme="dark"][data-side="brand"] { --side: color-mix(in srgb, var(--brand) 24%, #0a101c); --side-2: color-mix(in srgb, var(--brand) 36%, #0a101c); }
:root[data-side="brand"] .nav-a.on { background: rgba(255, 255, 255, .2); color: #fff; }
:root[data-side="brand"] .brand .logo { background: rgba(255, 255, 255, .2); }
:root[data-side="brand"] .nav-sub a.on { box-shadow: inset 3px 0 0 #fff; }
[dir="rtl"]:root[data-side="brand"] .nav-sub a.on { box-shadow: inset -3px 0 0 #fff; }

:root[data-density="compact"] body { font-size: 13px; }
:root[data-density="compact"] .btn { min-height: 31px; padding: 3px 11px; }
:root[data-density="compact"] .btn.sm { min-height: 26px; padding: 2px 8px; }
:root[data-density="compact"] .btn.icon { width: 31px; padding: 4px; }
:root[data-density="compact"] .input { min-height: 32px; padding: 4px 9px; }
:root[data-density="compact"] .tbl th { padding: 6px 9px; }
:root[data-density="compact"] .tbl td { padding: 5px 9px; }
:root[data-density="compact"] .card-h { padding: 8px 12px; }
:root[data-density="compact"] .card-b, :root[data-density="compact"] .kpi { padding: 11px; }
:root[data-density="compact"] .content { padding: 14px 16px 50px; }
:root[data-density="compact"] .stack { gap: 11px; }
:root[data-density="compact"] .nav-a { padding: 6px 10px; }
:root[data-density="compact"] .nav-sub a { padding: 4px 14px; }
:root[data-density="compact"] .side { width: 224px; }
:root[data-density="roomy"] body { font-size: 15.5px; }
:root[data-density="roomy"] .btn { min-height: 42px; padding: 8px 17px; }
:root[data-density="roomy"] .input { min-height: 44px; padding: 9px 13px; }
:root[data-density="roomy"] .tbl td { padding: 12px 14px; }
:root[data-density="roomy"] .nav-a { padding: 11px 12px; }
:root[data-density="roomy"] .side { width: 270px; }

:root[data-font="cairo"] { --font: 'Cairo', 'Segoe UI', Tahoma, sans-serif; }
:root[data-font="tajawal"] { --font: 'Tajawal', 'Segoe UI', Tahoma, sans-serif; }
:root[data-font="almarai"] { --font: 'Almarai', 'Segoe UI', Tahoma, sans-serif; }
:root[data-font="kufi"] { --font: 'Noto Kufi Arabic', 'Segoe UI', Tahoma, sans-serif; }
:root[data-font="system"] { --font: 'Segoe UI', Tahoma, Arial, sans-serif; }

:root[data-radius="sharp"] { --r: 3px; }
:root[data-radius="sharp"] .btn, :root[data-radius="sharp"] .input, :root[data-radius="sharp"] .nav-a, :root[data-radius="sharp"] .chip, :root[data-radius="sharp"] .modal, :root[data-radius="sharp"] .kpi .ico, :root[data-radius="sharp"] .brand .logo { border-radius: 3px; }
:root[data-radius="round"] { --r: 20px; }
:root[data-radius="round"] .btn { border-radius: 99px; }
:root[data-radius="round"] .input { border-radius: 16px; }
:root[data-radius="round"] .nav-a { border-radius: 99px; }
:root[data-radius="round"] .modal { border-radius: 24px; }

.kpi.click { cursor: pointer; transition: border-color .15s; }
.kpi.click:hover { border-color: var(--brand); }
.ui-sec { font-weight: 700; margin: 0 0 8px; }
.ui-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.ui-opt { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel); cursor: pointer; font-weight: 600; }
.ui-opt.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.ui-opt i { width: 18px; height: 18px; border-radius: 50%; display: inline-block; flex: none; }
.ui-look { display: flex; flex-direction: column; gap: 6px; width: 132px; padding: 8px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel); cursor: pointer; font-weight: 600; text-align: center; }
.ui-look.on { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.ui-look .pv { height: 62px; border-radius: 7px; display: flex; overflow: hidden; border: 1px solid rgba(128, 128, 128, .3); direction: rtl; }
.ui-look .pv b { width: 26%; display: block; }
.ui-look .pv span { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 6px; }
.ui-look .pv span i { display: block; height: 7px; border-radius: 4px; background: rgba(128, 128, 128, .28); }
.ui-look .pv span i:first-child { width: 55%; }
