/* ezPro ERP: the design system. Swiss editorial: white canvas, strong type, one accent per organisation,
   hairline rules instead of boxes, large numbers, pill statuses; a dark theme by data-theme on <html>. */
:root {
  --accent: #1f3864; --accent-ink: #fff; --accent-soft: color-mix(in srgb, var(--accent) 10%, #fff);
  --ink: #0b0f19; --ink-2: #2b3140; --muted: #6b7280; --faint: #9aa1ad;
  --line: #e6e8ec; --line-2: #f0f1f4; --rule: #0b0f19;
  --canvas: #ffffff; --surface: #ffffff; --surface-2: #f7f8fa; --hover: #f3f4f6;
  --danger: #b42318; --ok: #157347; --warn: #b35c00; --info: #175cd3;
  --radius: .5rem; --rail: 3.5rem; --top: 3.25rem;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-font-family: var(--font); --bs-body-bg: var(--canvas); --bs-body-color: var(--ink);
  --bs-primary: var(--accent); --bs-link-color: var(--accent); --bs-link-hover-color: var(--ink); --bs-border-radius: var(--radius);
  --bs-border-color: var(--line);
  color-scheme: light;
}
html[data-theme="dark"] {
  --accent-soft: color-mix(in srgb, var(--accent) 28%, #0f1420);
  --ink: #e8eaf0; --ink-2: #c3c8d4; --muted: #8b93a3; --faint: #5f6878;
  --line: #262c3a; --line-2: #1d2230; --rule: #e8eaf0;
  --canvas: #0f1218; --surface: #141923; --surface-2: #181e2a; --hover: #1c2230;
  --danger: #f97066; --ok: #4ade80; --warn: #fdb022; --info: #84caff;
  --bs-body-bg: var(--canvas); --bs-body-color: var(--ink); --bs-border-color: var(--line);
  color-scheme: dark;
}
html { scroll-behavior: smooth; }
body { background: var(--canvas); color: var(--ink); font-family: var(--font); font-size: .9rem; line-height: 1.45; -webkit-font-smoothing: antialiased; }
/* searchable selects (Tom Select) and calendars (flatpickr) follow the theme */
.ts-wrapper.form-select { padding: 0; background-image: none; }
.ts-wrapper .ts-control { background: var(--surface, #fff); color: var(--ink); border-color: var(--line); min-height: calc(1.5em + .75rem + 2px); font-size: inherit; }
.ts-wrapper.form-select-sm .ts-control, .form-select-sm + .ts-wrapper .ts-control { min-height: calc(1.5em + .5rem + 2px); padding: .25rem .5rem; font-size: .8rem; }
.ts-wrapper .ts-control input { color: var(--ink); }
.ts-dropdown { background: var(--surface, #fff); color: var(--ink); border-color: var(--line); font-size: .85rem; z-index: 1060; }
.ts-dropdown .active { background: var(--surface-2, #f3f4f6); color: var(--ink); }
.ts-dropdown .no-results { padding: .4rem .6rem; color: var(--muted); }
.table-lines .ts-wrapper .ts-control { padding: .2rem .4rem; min-height: 1.9rem; font-size: .8rem; }
.ez-dim-group { display: flex; gap: .25rem; align-items: stretch; }
.ez-dim-group > .ts-wrapper, .ez-dim-group > select { flex: 1 1 auto; }
.ez-dim-group > .ez-dim-plus { flex: 0 0 auto; }
.flatpickr-calendar { background: var(--surface, #fff); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.flatpickr-calendar .flatpickr-day { color: var(--ink); }
.flatpickr-calendar .flatpickr-day.selected { background: var(--accent); border-color: var(--accent); color: #fff; }
.flatpickr-calendar .flatpickr-months .flatpickr-month, .flatpickr-calendar .flatpickr-weekday { color: var(--ink); fill: var(--ink); }
[data-theme="dark"] .flatpickr-calendar .flatpickr-day:hover { background: var(--surface-2); }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--ink); letter-spacing: -.015em; font-weight: 650; }
.h4 { font-size: 1.35rem; }
a { text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
.btn, .nav-link, .dropdown-item, .badge, .page-link { text-decoration: none !important; }
code { color: var(--ink-2); background: var(--surface-2); padding: .05rem .3rem; border-radius: .25rem; font-size: .85em; }
hr { border-color: var(--line); opacity: 1; }
.text-muted { color: var(--muted) !important; }
.small { font-size: .8rem; }

/* Bootstrap pieces in our colours */
.btn { font-weight: 500; border-radius: var(--radius); }
.btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-color: var(--accent-ink); --bs-btn-hover-bg: color-mix(in srgb, var(--accent) 85%, #000);
  --bs-btn-hover-border-color: color-mix(in srgb, var(--accent) 85%, #000); --bs-btn-active-bg: color-mix(in srgb, var(--accent) 75%, #000); --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent); }
.btn-outline-primary { --bs-btn-color: var(--accent); --bs-btn-border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); --bs-btn-hover-bg: var(--accent); --bs-btn-hover-color: var(--accent-ink); --bs-btn-hover-border-color: var(--accent); --bs-btn-active-bg: var(--accent); }
.btn-outline-secondary { --bs-btn-color: var(--ink-2); --bs-btn-border-color: var(--line); --bs-btn-hover-bg: var(--hover); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: var(--line); --bs-btn-active-bg: var(--hover); --bs-btn-active-color: var(--ink); }
.btn-light { --bs-btn-bg: var(--surface-2); --bs-btn-border-color: var(--surface-2); --bs-btn-hover-bg: var(--hover); --bs-btn-color: var(--ink); }
.btn-link { --bs-btn-color: var(--accent); }
.form-control, .form-select { background: var(--surface); color: var(--ink); border-color: var(--line); border-radius: var(--radius); }
.form-control:focus, .form-select:focus { background: var(--surface); color: var(--ink); border-color: var(--accent); box-shadow: 0 0 0 .18rem color-mix(in srgb, var(--accent) 18%, transparent); }
.form-control::placeholder { color: var(--faint); }
.form-control:disabled, .form-select:disabled { background: var(--surface-2); color: var(--muted); }
.form-check-input { background-color: var(--surface); border-color: var(--faint); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-label { font-weight: 500; font-size: .82rem; color: var(--ink-2); margin-bottom: .25rem; }
.form-text { color: var(--muted); font-size: .76rem; }
.input-group-text { background: var(--surface-2); border-color: var(--line); color: var(--muted); }
.dropdown-menu { background: var(--surface); border: 1px solid var(--line); box-shadow: 0 12px 32px rgba(0,0,0,.12); border-radius: .6rem; font-size: .86rem; padding: .35rem; }
.dropdown-item { color: var(--ink); border-radius: .4rem; padding: .4rem .7rem; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--hover); color: var(--ink); }
.dropdown-item.active, .dropdown-item:active { background: var(--accent-soft); color: var(--ink); }
.dropdown-divider { border-color: var(--line); }
.alert { border-radius: var(--radius); border-width: 0; border-left: 3px solid; padding: .6rem .9rem; font-size: .86rem; }
.alert-success { background: color-mix(in srgb, var(--ok) 10%, var(--surface)); color: var(--ink); border-color: var(--ok); }
.alert-danger { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); color: var(--ink); border-color: var(--danger); }
.alert-warning { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); color: var(--ink); border-color: var(--warn); }
.alert-info, .alert-light { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.alert-light.border { border: 0 !important; border-left: 3px solid var(--line) !important; }
.badge { font-weight: 600; letter-spacing: .01em; }
.text-bg-light { background: var(--surface-2) !important; color: var(--ink-2) !important; }
.text-bg-secondary { background: var(--line) !important; color: var(--ink-2) !important; }
.text-bg-primary { background: var(--accent) !important; color: var(--accent-ink) !important; }
.modal-content, .offcanvas, .card, .list-group-item, .accordion-item, .popover { background: var(--surface); color: var(--ink); border-color: var(--line); }
.modal-header, .modal-footer { border-color: var(--line); }
.card { border: 1px solid var(--line); box-shadow: none; }
.nav-pills .nav-link { color: var(--ink-2); border-radius: 999px; padding: .3rem .8rem; font-size: .84rem; font-weight: 500; }
.nav-pills .nav-link.active { background: var(--ink); color: var(--canvas); }
.nav-tabs { border-bottom: 1px solid var(--line); gap: .25rem; flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500; padding: .5rem .75rem; white-space: nowrap; font-size: .86rem; border-radius: 0; margin-bottom: -1px; }
.nav-tabs .nav-link:hover { color: var(--ink); border-bottom-color: var(--line); }
.nav-tabs .nav-link.active { color: var(--ink); background: none; border-bottom-color: var(--ink); }
.pagination .page-link { color: var(--ink-2); border-color: var(--line); background: var(--surface); }
.pagination .active > .page-link { background: var(--ink); border-color: var(--ink); color: var(--canvas); }
.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--line) !important; }
.bg-light, .table-light { background: var(--surface-2) !important; }
.rounded { border-radius: var(--radius) !important; }
.text-dark { color: var(--ink) !important; }
.table-primary { --bs-table-bg: var(--accent-soft); --bs-table-color: var(--ink); }
.table-warning { --bs-table-bg: color-mix(in srgb, var(--warn) 14%, var(--surface)); --bs-table-color: var(--ink); }

/* the shell */
.app { display: flex; min-height: 100vh; }
.rail { width: var(--rail); flex-shrink: 0; position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; align-items: stretch; padding: .5rem 0; z-index: 1030; transition: width .15s ease; overflow: hidden; }
.rail:hover, .rail:focus-within { width: 13.5rem; box-shadow: 8px 0 24px rgba(0,0,0,.06); }
.rail a { display: flex; align-items: center; gap: .8rem; padding: .55rem 1rem; color: var(--ink-2); white-space: nowrap; font-size: .86rem; font-weight: 500; border-left: 2px solid transparent; }
.rail a:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.rail a.active { color: var(--ink); border-left-color: var(--accent); background: var(--accent-soft); }
.rail a i { font-size: 1.1rem; width: 1.4rem; text-align: center; flex-shrink: 0; }
.rail a .lbl { opacity: 0; transition: opacity .12s; }
.rail:hover a .lbl, .rail:focus-within a .lbl { opacity: 1; }
.rail .brand { padding: .35rem .85rem .9rem; display: flex; align-items: center; gap: .7rem; color: var(--ink); font-weight: 700; letter-spacing: -.02em; border-left: 0; }
.rail .brand .mark { width: 1.75rem; height: 1.75rem; border-radius: .45rem; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; font-size: .95rem; flex-shrink: 0; }
.rail .spacer { flex: 1; }
.rail .foot { padding: .6rem 1rem; font-size: .7rem; color: var(--muted); white-space: nowrap; opacity: 0; }
.rail:hover .foot { opacity: 1; }
.rail .count { margin-left: auto; font-size: .66rem; background: var(--warn); color: #fff; border-radius: 999px; padding: .05rem .4rem; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; height: var(--top); background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: stretch; gap: .25rem; padding: 0 1rem 0 .5rem; }
.topbar .company { display: flex; align-items: center; gap: .4rem; padding: 0 .75rem; color: var(--ink); font-weight: 600; font-size: .86rem; border: 0; background: none; max-width: 16rem; }
.topbar .company small { display: block; font-weight: 500; font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; line-height: 1; }
.topbar .company .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15; }
.topbar .company:hover { background: var(--hover); }
.modbar { display: flex; align-items: stretch; margin-left: .25rem; }
.modbar > .mod { position: relative; display: flex; align-items: center; }
.modbar > .mod > a { display: flex; align-items: center; gap: .4rem; height: 100%; padding: 0 .7rem; color: var(--ink-2); font-size: .86rem; font-weight: 500; border-bottom: 2px solid transparent; }
.modbar > .mod > a:hover { color: var(--ink); text-decoration: none; }
.modbar > .mod.current > a { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.modbar > .mod > a i { font-size: .95rem; opacity: .8; }
.mega { display: none; position: absolute; top: 100%; left: 0; min-width: 34rem; background: var(--surface); border: 1px solid var(--line); border-radius: .6rem; box-shadow: 0 16px 40px rgba(0,0,0,.14); padding: 1rem 1.1rem; z-index: 1040; }
.mod:hover .mega, .mod:focus-within .mega { display: grid; grid-template-columns: repeat(3, minmax(9rem, 1fr)); gap: .75rem 1.5rem; }
.mega .col h6 { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .45rem; font-weight: 600; }
.mega .col a { display: block; padding: .28rem 0; color: var(--ink); font-size: .85rem; border-radius: .3rem; }
.mega .col a:hover { color: var(--accent); text-decoration: none; }
.mega .col a.active { color: var(--accent); font-weight: 600; }
.mega .col a small { display: block; color: var(--muted); font-size: .72rem; font-weight: 400; }
.mega .acts { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: .7rem; display: flex; gap: .4rem; flex-wrap: wrap; }
.mega .acts a { font-size: .78rem; padding: .25rem .65rem; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); }
.mega .acts a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
/* the Reports drop-down: categories on the left, the chosen category's reports on the right */
.mega-reports { padding: 0; min-width: 0; left: auto; right: 0; }
.mod:hover .mega-reports, .mod:focus-within .mega-reports { display: flex; }
.mega-reports .cats { width: 16.5rem; flex-shrink: 0; border-right: 1px solid var(--line); padding: .6rem .5rem; display: flex; flex-direction: column; background: var(--surface-2, var(--surface)); border-radius: .6rem 0 0 .6rem; }
.mega-reports .cats > a { display: flex; align-items: center; gap: .4rem; padding: .36rem .65rem; border-radius: .4rem; color: var(--ink); font-size: .84rem; }
.mega-reports .cats > a .n { margin-left: auto; font-size: .66rem; color: var(--muted); }
.mega-reports .cats > a .bi-chevron-right { font-size: .66rem; color: var(--muted); }
.mega-reports .cats > a:hover, .mega-reports .cats > a.on { background: var(--surface); color: var(--accent); text-decoration: none; box-shadow: inset 0 0 0 1px var(--line); }
.mega-reports .cats > a.all { font-weight: 600; margin-bottom: .35rem; }
.mega-reports .cats .foot { border-top: 1px solid var(--line); margin-top: .4rem; padding-top: .4rem; }
.mega-reports .cats .foot a { display: block; padding: .28rem .65rem; font-size: .78rem; color: var(--ink-2); border-radius: .4rem; }
.mega-reports .cats .foot a:hover { color: var(--accent); text-decoration: none; }
.mega-reports .pane { width: 44rem; flex-shrink: 0; max-width: calc(100vw - 22rem); padding: 1rem 1.25rem 1.1rem; max-height: calc(100vh - 7rem); overflow-y: auto; }
.mega-reports .pane h6 { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .7rem; font-weight: 600; }
.mega-reports .pane h6 a { color: inherit; }
.mega-reports .pane h6 a:hover { color: var(--accent); text-decoration: none; }
.mega-reports .secs { display: grid; grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); gap: .6rem 1.4rem; align-items: start; }
.mega-reports .sec-title { font-size: .72rem; font-weight: 600; color: var(--ink-2); margin: 0 0 .2rem; }
.mega-reports .sec a { display: block; padding: .24rem 0; color: var(--ink); font-size: .84rem; }
.mega-reports .sec a:hover { color: var(--accent); text-decoration: none; }
.mega-reports .sec a.active { color: var(--accent); font-weight: 600; }
[dir="rtl"] .mega-reports { right: auto; left: 0; }
[dir="rtl"] .mega-reports .cats { border-right: 0; border-left: 1px solid var(--line); border-radius: 0 .6rem .6rem 0; }
[dir="rtl"] .mega-reports .cats > a .n { margin-left: 0; margin-right: auto; }
[dir="rtl"] .mega-reports .cats > a .bi-chevron-right { transform: scaleX(-1); }
.topbar .tools { margin-left: auto; display: flex; align-items: center; gap: .15rem; }
.cmd-btn { white-space: nowrap; display: inline-flex; align-items: center; gap: .5rem; height: 2rem; padding: 0 .6rem 0 .7rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--surface-2); color: var(--muted); font-size: .8rem; min-width: 13rem; }
.cmd-btn kbd { margin-left: auto; font-size: .66rem; border: 1px solid var(--line); border-radius: .3rem; padding: 0 .3rem; color: var(--muted); background: var(--surface); }
.cmd-btn:hover { border-color: var(--faint); color: var(--ink); }
.icon-btn { position: relative; display: inline-flex; width: 2.1rem; height: 2.1rem; border-radius: .5rem; align-items: center; justify-content: center; color: var(--ink-2); font-size: 1.05rem; border: 0; background: none; }
.icon-btn:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.icon-btn .badge { position: absolute; top: .05rem; right: 0; font-size: .58rem; }
.me-chip { display: flex; align-items: center; gap: .5rem; padding: .2rem .4rem .2rem .25rem; border-radius: .6rem; color: var(--ink); border: 0; background: none; font-size: .82rem; text-align: left; }
.me-chip:hover { background: var(--hover); }
.me-chip .who { white-space: nowrap; max-width: 11rem; overflow: hidden; text-overflow: ellipsis; }
.me-chip .who small { display: block; color: var(--muted); font-size: .68rem; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; }
.avatar { display: inline-flex; width: 1.8rem; height: 1.8rem; border-radius: 50%; align-items: center; flex-shrink: 0; justify-content: center; font-size: .66rem; font-weight: 700; background: var(--accent); color: var(--accent-ink); }
.content { padding: 1.5rem 2rem 4rem; max-width: 1480px; width: 100%; }
.tabs-row { padding: 0 2rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.tabs-row .nav-tabs { border-bottom: 0; }
.bottombar { display: none; }
@media (max-width: 991.98px) {
  .rail, .modbar, .cmd-btn .hint { display: none; }
  .cmd-btn { min-width: 0; }
  .content { padding: 1rem 1rem 5rem; }
  .tabs-row { padding: 0 1rem; }
  .bottombar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1030; background: var(--surface); border-top: 1px solid var(--line); justify-content: space-around; padding: .3rem 0 calc(.3rem + env(safe-area-inset-bottom)); }
  .bottombar a { display: flex; flex-direction: column; align-items: center; gap: .1rem; color: var(--muted); font-size: .62rem; padding: .2rem .5rem; border: 0; background: none; }
  .bottombar a i { font-size: 1.15rem; }
  .bottombar a.active { color: var(--accent); }
}
.mobile-menu .section { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .9rem 0 .3rem; font-weight: 600; }
.mobile-menu a { display: block; padding: .4rem 0; color: var(--ink); font-size: .9rem; }
.mobile-menu a.sub { padding-left: 1.2rem; color: var(--ink-2); font-size: .84rem; }
.mobile-menu details.sub-group summary { padding: .4rem 0 .4rem 1.2rem; color: var(--ink); font-size: .86rem; cursor: pointer; list-style: none; display: flex; align-items: center; gap: .4rem; }
.mobile-menu details.sub-group summary::before { content: "\F282"; font-family: "bootstrap-icons"; font-size: .6rem; color: var(--muted); transition: transform .15s; }
.mobile-menu details.sub-group[open] summary::before { transform: rotate(90deg); }
.mobile-menu details.sub-group summary .n { margin-left: auto; font-size: .66rem; color: var(--muted); }
.mobile-menu .sub-title { padding: .4rem 0 .1rem 2.2rem; font-size: .66rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.mobile-menu a.sub2 { padding-left: 2.2rem; }

/* the command bar */
.palette-back { position: fixed; inset: 0; background: rgba(5, 8, 15, .45); z-index: 1060; display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; }
.palette { width: min(42rem, 94vw); background: var(--surface); border: 1px solid var(--line); border-radius: .8rem; box-shadow: 0 30px 80px rgba(0,0,0,.35); overflow: hidden; }
.palette input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 1.05rem; padding: .95rem 1.1rem; border-bottom: 1px solid var(--line); }
.palette .list { max-height: 55vh; overflow-y: auto; padding: .4rem; }
.palette .grp { font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: .55rem .7rem .2rem; font-weight: 600; }
.palette .it { display: flex; align-items: center; gap: .7rem; padding: .5rem .7rem; border-radius: .45rem; color: var(--ink); cursor: pointer; }
.palette .it.on, .palette .it:hover { background: var(--accent-soft); text-decoration: none; }
.palette .it .meta { margin-left: auto; color: var(--muted); font-size: .76rem; }
.palette .foot { display: flex; gap: 1rem; padding: .45rem .9rem; border-top: 1px solid var(--line); font-size: .7rem; color: var(--muted); }
.palette kbd { border: 1px solid var(--line); border-radius: .3rem; padding: 0 .3rem; font-size: .66rem; background: var(--surface-2); }

/* page parts, editorial */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem 1rem; margin-bottom: 1.1rem; }
.page-head > div:first-child { margin-right: auto; }
.eyebrow { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; }
.panel.p-4 { padding: 1.25rem !important; }
.section-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-bottom: .6rem; }
.meta { font-size: .78rem; color: var(--muted); }
.tile, .kpi { display: block; background: var(--surface); border: 0; border-top: 1px solid var(--rule); border-radius: 0; padding: .8rem 0 .6rem; color: inherit; box-shadow: none; }
a.tile:hover, a.kpi:hover { text-decoration: none; border-top-color: var(--accent); }
.tile .label, .kpi .label { font-size: .7rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.tile .value, .kpi .value { font-size: 1.75rem; font-weight: 650; line-height: 1.15; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: .25rem; }
.tile.danger .value { color: var(--danger); }
.kpi .small, .tile .small { color: var(--muted); }
.row.g-3 > [class*="col-"] > .kpi, .row.g-3 > [class*="col-"] > .tile { height: 100%; }
.chip { display: inline-flex; gap: .4rem; align-items: center; padding: .26rem .75rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .78rem; color: var(--ink-2); font-weight: 500; }
.chip:hover { border-color: var(--faint); color: var(--ink); text-decoration: none; }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--canvas); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .num input { text-align: right; }

/* tables */
.table { --bs-table-bg: transparent; --bs-table-color: var(--ink); --bs-table-hover-bg: var(--hover); --bs-table-hover-color: var(--ink); --bs-table-striped-bg: var(--surface-2); margin-bottom: 0; color: var(--ink); }
.table > thead th { background: transparent; color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.table > :not(caption) > * > * { border-bottom-color: var(--line-2); background: transparent; color: inherit; box-shadow: none; }
.table-sm > :not(caption) > * > * { padding: .5rem .6rem; }
.panel > .table td:first-child, .panel > .table th:first-child, .panel > .table-responsive > .table td:first-child, .panel > .table-responsive > .table th:first-child { padding-left: 1rem; }
.panel > .table td:last-child, .panel > .table th:last-child, .panel > .table-responsive > .table td:last-child, .panel > .table-responsive > .table th:last-child { padding-right: 1rem; }
.table-lines td { vertical-align: middle; padding: .25rem .35rem; }
.table-lines .form-control, .table-lines .form-select { font-size: .85rem; }
.table-sm td, .table-sm th { vertical-align: middle; }
.report-table th { background: var(--surface); position: sticky; top: var(--top); z-index: 1; }
.report-table tfoot td { font-weight: 650; border-top: 1.5px solid var(--rule); }
.tree-l1 { font-weight: 700; background: var(--surface-2); }
.tree-l2 { font-weight: 600; padding-left: 1rem !important; }
.tree-l3 { padding-left: 2rem !important; color: var(--ink-2); }
.tree-l4 { padding-left: 3rem !important; color: var(--muted); }
.table-hover > tbody > tr:hover > * { background: var(--hover); }

/* statuses as pills */
.status-pill, .badge.rounded-pill { font-size: .7rem; font-weight: 600; padding: .22rem .6rem; border-radius: 999px; letter-spacing: .01em; }
.status-pill { display: inline-block; background: var(--surface-2); color: var(--ink-2); }
.status-draft, .status-awaiting, .status-soft_closed { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--warn); }
.status-posted, .status-paid, .status-issued, .status-fulfilled, .status-filed { background: color-mix(in srgb, var(--ok) 13%, var(--surface)); color: var(--ok); }
.status-open, .status-part_paid, .status-part { background: color-mix(in srgb, var(--info) 12%, var(--surface)); color: var(--info); }
.status-reversed, .status-locked, .status-cancelled, .status-converted { background: var(--line-2); color: var(--muted); }
.text-bg-success { background: color-mix(in srgb, var(--ok) 14%, var(--surface)) !important; color: var(--ok) !important; }
.text-bg-danger { background: color-mix(in srgb, var(--danger) 13%, var(--surface)) !important; color: var(--danger) !important; }
.text-bg-warning { background: color-mix(in srgb, var(--warn) 14%, var(--surface)) !important; color: var(--warn) !important; }
.text-bg-info { background: color-mix(in srgb, var(--info) 12%, var(--surface)) !important; color: var(--info) !important; }
.badge-paid { background: var(--ok); } .badge-due { background: var(--warn); } .badge-over { background: var(--danger); }
.from-cms { font-size: .7rem; color: var(--muted); border: 1px solid var(--line); border-radius: .35rem; padding: 0 .35rem; }

/* the inbox and workspaces */
.queue { border-top: 1px solid var(--rule); }
.queue .row-item { display: grid; grid-template-columns: 2.2rem 1fr auto; gap: .9rem; align-items: center; padding: .8rem 0; border-bottom: 1px solid var(--line-2); }
.queue .row-item:hover { background: var(--surface-2); }
.queue .ico { width: 2.1rem; height: 2.1rem; border-radius: .5rem; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--ink-2); font-size: 1rem; }
.queue .ico.danger { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.queue .ico.warn { background: color-mix(in srgb, var(--warn) 14%, var(--surface)); color: var(--warn); }
.queue .ico.info { background: color-mix(in srgb, var(--info) 12%, var(--surface)); color: var(--info); }
.queue .ttl { font-weight: 600; font-size: .9rem; }
.queue .txt { font-size: .78rem; color: var(--muted); }
.queue .amt { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.queue .act { font-size: .78rem; white-space: nowrap; }
.recent .row-item { display: flex; gap: .8rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--line-2); }
.recent .row-item .grow { flex: 1; min-width: 0; }
.recent .row-item .ttl { font-weight: 500; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent .row-item .txt { font-size: .75rem; color: var(--muted); }
.acts-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.acts-row .btn { border-radius: 999px; }
.bignum { font-size: 2.6rem; font-weight: 700; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.dl-grid { display: grid; grid-template-columns: minmax(10rem, 16rem) 1fr; gap: .35rem 1rem; font-size: .9rem; }
.dl-grid dt { color: var(--muted); font-weight: 500; }
.dl-grid dd { margin: 0; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11.5rem, 1fr)); gap: .5rem .75rem; }
.filter { display: flex; flex-direction: column; gap: .2rem; margin: 0; }
.filter > span { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.filter.on .form-select { border-color: var(--accent); background-color: var(--accent-soft); font-weight: 500; }
.side-link { display: flex; justify-content: space-between; align-items: center; padding: .45rem .65rem; border-radius: .45rem; color: var(--ink-2); }
.side-link:hover { background: var(--hover); text-decoration: none; }
.side-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.print-only { display: none; }
[x-cloak] { display: none !important; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--canvas); }
.login-wrap main { width: 100%; }
.login-wrap main:has(.login-page) { max-width: none; padding: 0 !important; }
.login-wrap:has(.login-page) { display: block; }
.login-wrap .text-white, .login-wrap .text-white * { color: var(--ink) !important; }
.login-wrap .card { border: 1px solid var(--line); box-shadow: none; }
@media print { .rail, .topbar, .bottombar, .tabs-row, .no-print { display: none !important; } .content { padding: 0; max-width: none; } .print-only { display: block; } body { background: #fff; color: #000; } }

/* page-level polish for the existing pages inside the new shell */
.content > .d-flex:first-child, .content > .page-head:first-child { margin-bottom: 1.25rem !important; }
.content h1.h4 { font-size: 1.5rem; letter-spacing: -.02em; }
.content > .d-flex:first-child .small.text-muted, .content > .d-flex:first-child .text-muted.small { font-size: .8rem; }
.btn { font-size: .86rem; padding: .4rem .85rem; }
.btn-sm { font-size: .78rem; padding: .25rem .6rem; }
.btn-primary, .btn-outline-primary { font-weight: 600; }
.form-control, .form-select { font-size: .88rem; }
.form-control-sm, .form-select-sm { font-size: .8rem; }
.panel.p-4 > .fw-semibold:first-child, .panel.p-3 > .fw-semibold:first-child, .panel > .card-body > .fw-semibold:first-child,
.panel .fw-semibold.mb-2:first-child, .panel .fw-semibold.mb-1:first-child { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.panel.table-responsive, .panel > .table-responsive { border-radius: var(--radius); }
.table > tbody > tr:last-child > * { border-bottom-color: transparent; }
.table tfoot td, .table tfoot th { border-top: 1.5px solid var(--rule); font-weight: 650; }
.list-group-item { border-color: var(--line-2); }
.modal-content { border-radius: .75rem; }
.alert-dismissible .btn-close { padding: .75rem; }
.progress { background: var(--line-2); border-radius: 999px; }
.badge.bg-success, .bg-success { background: var(--ok) !important; }
.badge.bg-warning, .bg-warning { background: var(--warn) !important; }
.badge.bg-danger, .bg-danger { background: var(--danger) !important; }
.text-success { color: var(--ok) !important; } .text-danger { color: var(--danger) !important; } .text-warning { color: var(--warn) !important; }
.table-responsive { scrollbar-width: thin; }
details > summary { cursor: pointer; }
.kpi .label { font-size: .68rem; }
.panel .row.g-2 .border.rounded { border-color: var(--line) !important; border-radius: var(--radius) !important; }
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.login-page .side { background: var(--ink); color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.login-page .side .brand { display: flex; align-items: center; gap: .7rem; font-weight: 700; font-size: 1.1rem; letter-spacing: -.02em; }
.login-page .side .brand .mark { width: 2.2rem; height: 2.2rem; border-radius: .5rem; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.login-page .side h2 { font-size: 2.4rem; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; color: #fff; max-width: 22ch; }
.login-page .side p { color: #c9cfdb; max-width: 44ch; font-size: .95rem; }
.login-page .side .points { display: grid; gap: .6rem; margin-top: 1.5rem; }
.login-page .side .points div { border-top: 1px solid rgba(255,255,255,.18); padding-top: .55rem; font-size: .85rem; color: #e5e8ef; }
.login-page .side .foot { font-size: .72rem; color: #8b93a3; }
.login-page .form { display: flex; align-items: center; justify-content: center; padding: 2rem; background: var(--canvas); }
.login-page .form > div { width: min(24rem, 100%); }
@media (max-width: 991.98px) { .login-page { grid-template-columns: 1fr; } .login-page .side { padding: 2rem 1.5rem; } .login-page .side h2 { font-size: 1.7rem; } }

/* right to left (Arabic): the rail moves to the right, the type to the Arabic face, directions mirror */
[dir="rtl"] body, [dir="rtl"] .btn, [dir="rtl"] .form-control, [dir="rtl"] .form-select { font-family: "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif; }
[dir="rtl"] .app { flex-direction: row-reverse; }
[dir="rtl"] .rail { border-right: 0; border-left: 1px solid var(--line); }
[dir="rtl"] .rail:hover, [dir="rtl"] .rail:focus-within { box-shadow: -8px 0 24px rgba(0,0,0,.06); }
[dir="rtl"] .rail a { border-left: 0; border-right: 2px solid transparent; }
[dir="rtl"] .rail a.active { border-right-color: var(--accent); }
[dir="rtl"] .topbar { padding: 0 .5rem 0 1rem; }
[dir="rtl"] .modbar { margin-left: 0; margin-right: .25rem; }
[dir="rtl"] .mega { left: auto; right: 0; }
[dir="rtl"] .topbar .tools { margin-left: 0; margin-right: auto; }
[dir="rtl"] .cmd-btn kbd { margin-left: 0; margin-right: auto; }
[dir="rtl"] .num { text-align: left; }
[dir="rtl"] .text-end { text-align: left !important; }
[dir="rtl"] .queue .row-item { grid-template-columns: 2.2rem 1fr auto; }
[dir="rtl"] .alert { border-left: 0; border-right: 3px solid; }
[dir="rtl"] .eyebrow, [dir="rtl"] .tile .label, [dir="rtl"] .kpi .label, [dir="rtl"] .table > thead th, [dir="rtl"] .section-title { letter-spacing: 0; }
[dir="rtl"] .dropdown-menu-end { --bs-position: start; }
[dir="rtl"] .login-page .side { direction: rtl; }
[dir="rtl"] .bottombar a { font-family: inherit; }


/* report options ("Customise this report"): one panel on every report, inside its filter form */
.report-options { flex-basis: 100%; width: 100%; border: 1px solid var(--line); border-radius: .6rem; background: var(--surface); margin-top: .35rem; }
.report-options > summary { cursor: pointer; list-style: none; padding: .45rem .8rem; font-size: .82rem; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; }
.report-options > summary::-webkit-details-marker { display: none; }
.report-options > summary::after { content: "\F282"; font-family: "bootstrap-icons"; font-size: .65rem; margin-left: auto; color: var(--muted); transition: transform .15s; }
.report-options[open] > summary::after { transform: rotate(90deg); }
.report-options[open] > summary { border-bottom: 1px solid var(--line); }
.report-options-body { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .75rem 1.5rem; padding: .8rem .9rem; }
.report-options .opt-title { font-size: .66rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-bottom: .35rem; }
.report-options .opt-label { font-size: .78rem; font-weight: 600; color: var(--ink-2); margin: .3rem 0 .15rem; display: block; }
.report-options .form-check { margin-bottom: .1rem; }
.report-options .form-check-label, .report-options .form-check-input { font-size: .82rem; }
.report-options .form-select-sm { font-size: .8rem; }
.report-options-foot { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; padding: .55rem .9rem; border-top: 1px solid var(--line); background: var(--surface-2, var(--surface)); border-radius: 0 0 .6rem .6rem; }
@media print { .report-options { display: none; } }
[dir="rtl"] .report-options > summary::after { margin-left: 0; margin-right: auto; transform: scaleX(-1); }
[dir="rtl"] .report-options[open] > summary::after { transform: rotate(-90deg); }
