/* Aquarius ERP — base styles.
   Uses CSS logical properties (inline-start/end) so one stylesheet serves RTL and LTR. */
:root {
  --bg: #f3f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e3e8ef;
  --text: #1e293b;
  --muted: #64748b;
  /* Aquarius brand (aquariustech.ae): turquoise #0ed0d2 on navy #011129. --primary is a deeper turquoise so
     white text on buttons stays readable (WCAG AA). */
  --brand: #0ed0d2;
  --primary: #087f81;
  --primary-600: #066a6c;
  --primary-50: #e6f9f9;
  --accent: #0ed0d2;
  --danger: #c0392b;
  --danger-50: #fdecea;
  --success: #1e8e5a;
  --success-50: #e6f6ee;
  --warning-50: #fff6e5;
  --side: #011129;
  --side-text: #c3cedc;
  --side-active: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  /* Inter draws Latin letters and figures (tabular digits); Arabic falls through to IBM Plex Sans Arabic */
  --font: "Inter", "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --sidebar-w: 256px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.55; color: var(--text); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0; font-weight: 600; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.icon { flex: none; vertical-align: middle; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--side); color: var(--side-text); flex: none;
  position: sticky; top: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column;
}
.brand { padding: 18px 18px 14px; border-block-end: 1px solid rgba(255, 255, 255, .08); }
.brand-name { color: #fff; font-weight: 700; letter-spacing: .5px; font-size: 1rem; display: flex; align-items: center; gap: 8px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, var(--brand), var(--primary)); display: grid; place-items: center; color: var(--side); font-weight: 800; }
.brand-company { font-size: .8rem; color: var(--side-text); margin-top: 6px; }
.brand-logo { display: block; max-height: 56px; max-width: 100%; background: #fff; border-radius: 8px; padding: 4px 8px; }
.brand-mark-img { flex: none; display: block; }
.powered { display: flex; align-items: center; gap: 8px; padding: 12px 18px; font-size: .75rem; color: var(--side-text);
  border-block-start: 1px solid rgba(255, 255, 255, .08); opacity: .85; }
.powered strong { color: #fff; font-weight: 600; }
.doc-logo { display: block; max-height: 64px; max-width: 220px; margin-bottom: 6px; }
.letterhead { display: none; }
.nav { padding: 10px 8px 24px; flex: 1; min-height: 0; overflow-y: auto; }  /* only the sections scroll; the footer stays */
.nav details { margin-bottom: 2px; }
.nav summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 8px; color: var(--side-text); font-weight: 500; user-select: none;
}
.nav summary::-webkit-details-marker { display: none; }
.nav summary:hover { background: rgba(255, 255, 255, .06); }
.nav summary .chev { margin-inline-start: auto; transition: transform .15s; opacity: .6; }
[dir="rtl"] .nav summary .chev { transform: scaleX(-1); }
.nav details[open] summary .chev { transform: rotate(90deg); }
.nav ul { list-style: none; margin: 2px 0 6px; padding: 0; }
.nav li a {
  display: block; padding: 7px 10px; padding-inline-start: 38px; border-radius: 8px; color: var(--side-text); font-size: .93rem;
}
.nav li a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.nav li a.active { background: rgba(14, 208, 210, .16); color: var(--side-active); box-shadow: inset 3px 0 0 var(--brand); }
[dir="rtl"] .nav li a.active { box-shadow: inset -3px 0 0 var(--brand); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: var(--surface); border-block-end: 1px solid var(--border); display: flex; align-items: center;
  gap: 12px; padding: 0 20px; position: sticky; top: 0; z-index: 20;
}
.topbar .search { flex: 1; max-width: 460px; position: relative; }
.topbar .search input { padding-inline-start: 34px; }
.topbar .search .icon { position: absolute; inset-inline-start: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.topbar .spacer { flex: 1; }
.btn.menu-btn { display: none; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--side-text); font-weight: 500; margin-bottom: 2px; }
.nav-link:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.nav-link.active { background: rgba(14, 208, 210, .16); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
[dir="rtl"] .nav-link.active { box-shadow: inset -3px 0 0 var(--brand); }
.content { padding: 22px 24px 48px; max-width: 1400px; width: 100%; }

/* ---------- user menu ---------- */
.dropdown { position: relative; }
.dropdown summary { list-style: none; cursor: pointer; }
.dropdown summary::-webkit-details-marker { display: none; }
.dropdown-menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .12); min-width: 220px; padding: 6px; z-index: 30;
}
.dropdown-menu a, .dropdown-menu button {
  display: flex; gap: 8px; align-items: center; width: 100%; padding: 8px 10px; border-radius: 6px; background: none; border: 0;
  font: inherit; color: var(--text); cursor: pointer; text-align: start;
}
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-2); text-decoration: none; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--border); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; font-weight: 700; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; line-height: 1.4;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-danger { color: var(--danger); border-color: #f1c4bf; }
.btn-danger:hover { background: var(--danger-50); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 4px 10px; font-size: .85rem; }
.input, select.input, textarea.input, .topbar input {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font: inherit; color: var(--text);
}
.input:focus, .topbar input:focus { outline: 2px solid var(--primary-50); border-color: var(--primary); }
.input:disabled { background: var(--surface-2); color: var(--text); }
.check { width: 17px; height: 17px; accent-color: var(--primary); vertical-align: middle; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 6px 14px; }
.checklist div, .checklist li { display: flex; }
.checklist label { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.checklist input { accent-color: var(--primary); width: 16px; height: 16px; }

/* ---------- page head / cards ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.card-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 14px 18px; }
.cols-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* ---------- forms ---------- */
.field label { display: block; font-weight: 500; margin-bottom: 5px; font-size: .9rem; }
.field .req { color: var(--danger); margin-inline-start: 3px; }
.field .help { display: block; color: var(--muted); margin-top: 4px; font-size: .8rem; }
.field .error { display: block; color: var(--danger); margin-top: 4px; font-size: .82rem; }
.field.has-error .input { border-color: var(--danger); }
.field-check { display: flex; flex-direction: column; justify-content: center; }
.field-check label { display: flex; gap: 8px; align-items: center; margin: 0; }
.field-wide { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.form-errors { background: var(--danger-50); color: var(--danger); padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid #f1c4bf; }
.form-errors ul { margin: 6px 0 0; padding-inline-start: 20px; }
.form-errors a { color: var(--danger); text-decoration: underline; }
.card.has-error { border-color: var(--danger); box-shadow: 0 0 0 2px var(--danger-50); }
.table td .input.error-field, .has-error .input, .has-error select { border-color: var(--danger); }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; margin: 0 0 12px; }

/* ---------- filters & tables ---------- */
.filterbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.filterbar .input { width: auto; min-width: 160px; }
.filterbar input[name="q"] { min-width: 240px; flex: 1; max-width: 360px; }
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { background: var(--surface-2); font-weight: 600; font-size: .82rem; color: var(--muted); position: sticky; top: 0; }
.table th a { color: inherit; }
.table tbody tr:hover { background: #f2fbfb; }
.table tr.rowlink { cursor: pointer; }
.table td.empty { text-align: center; color: var(--muted); padding: 36px; }
.table tbody tr:last-child td { border-bottom: 0; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--muted); flex-wrap: wrap; gap: 8px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge-success { background: var(--success-50); color: var(--success); border-color: #bfe6d1; }
.badge-danger { background: var(--danger-50); color: var(--danger); border-color: #f1c4bf; }
.badge-warning { background: var(--warning-50); color: #9a6210; border-color: #f4d9a8; }
.badge-info { background: var(--primary-50); color: var(--primary); border-color: #b5ecec; }

/* ---------- messages ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; border: 1px solid; }
.messages .success { background: var(--success-50); color: var(--success); border-color: #bfe6d1; }
.messages .error { background: var(--danger-50); color: var(--danger); border-color: #f1c4bf; }
.messages .info, .messages .warning { background: var(--warning-50); color: #8a5a10; border-color: #f4d9a8; }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); color: var(--text); transition: border-color .15s, transform .15s; }
.kpi:hover { border-color: var(--primary); text-decoration: none; transform: translateY(-1px); }
.kpi .label { color: var(--muted); font-size: .85rem; }
.kpi .value { font-size: 1.7rem; font-weight: 700; margin-top: 4px; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.steps li:last-child { border-bottom: 0; }
.step-dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); display: grid; place-items: center; flex: none; }
.steps li.done .step-dot { background: var(--success); border-color: var(--success); color: #fff; }
.steps li.done a { color: var(--muted); text-decoration: line-through; }
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 6px 0 10px; }
.progress span { display: block; height: 100%; background: var(--success); }
.feed { list-style: none; padding: 0; margin: 0; }
.feed li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.feed li:last-child { border-bottom: 0; }

/* ---------- role matrix ---------- */
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: start; }
.matrix .module-row td { background: var(--surface-2); font-weight: 600; text-align: start; }
.matrix td.na { color: #cbd5e1; }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: radial-gradient(circle at 20% 20%, #0b3f4f, var(--side) 62%); color: #e6edf5; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero h2 { font-size: 1.9rem; color: #fff; margin: 0 0 12px; line-height: 1.3; }
.hero-brand { font-size: 1.5rem; gap: 12px; }
.hero-ar { color: var(--brand); font-weight: 600; }
.auth-hero ul li::marker { color: var(--brand); }
.auth-mobile-brand { display: none; color: var(--text); font-size: 1.15rem; margin-bottom: 14px; }
.auth-hero ul { padding-inline-start: 18px; color: var(--side-text); }
.auth-panel { display: grid; place-items: center; padding: 32px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card .field { margin-bottom: 14px; }
.lang-switch { display: inline-flex; }

/* ---------- misc ---------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.diff td { white-space: normal; word-break: break-word; }
.print-only { display: none; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
/* tabs on a record page (contract): one panel shown at a time */
.tabs { flex-wrap: wrap; margin-top: 18px; }
.tabs .tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font: inherit; font-weight: 600;
  color: var(--muted); cursor: pointer; margin-bottom: -1px; }
.tabs .tab:hover { color: var(--text); }
.tabs .tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
@media print { [data-tab-panel] { display: block !important; } }
/* a posted contract read as a summary */
.kv-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 24px; margin: 0; }
.kv-cols > div { display: grid; gap: 2px; min-width: 0; }
.kv-cols > div.wide { grid-column: 1 / -1; }
.kv-cols dt { font-size: .82rem; }
.contract-terms { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.contract-terms summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.contract-terms h4 { margin: 12px 0 4px; font-size: .9rem; }
.contract-terms p { margin: 0; white-space: normal; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .cols-2 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 40; }
  .btn.menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 0 12px; }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-mobile-brand { display: flex; }
  .user-chip .who, .hide-sm { display: none; }
  .topbar { gap: 6px; }
}

/* ---------- print ---------- */
@media print {
  .sidebar, .topbar, .filterbar, .actions, .pager, .form-actions, .no-print { display: none !important; }
  .print-only { display: block; }
  .letterhead { display: flex !important; align-items: center; gap: 16px; justify-content: space-between;
    border-bottom: 2px solid var(--primary); padding-bottom: 8px; margin-bottom: 14px; }
  .letterhead img { max-height: 60px; max-width: 200px; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .table-wrap, .card { box-shadow: none; border: 0; }
  .table th { position: static; }
  .table th, .table td { padding: 5px 8px; font-size: 11px; }
}

/* Searchable selection lists (combobox) and quick-add dialog */
.combo { position: relative; }
.combo-native { position: absolute; inset-inline-start: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.combo-list { position: absolute; z-index: 50; inset-inline: 0; top: calc(100% + 2px); max-height: 280px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 4px; min-width: 220px; }
/* a searchable list inside a table (contract charges, voucher lines…) must open over the rows, not be cut off
   by the table's scroll box */
.table-wrap:has(.combo) { overflow: visible; }
.table .combo-list { min-width: 260px; }
.table td:has(> .combo) { min-width: 200px; }
.combo-item { padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.combo-item.active, .combo-item:hover { background: var(--primary-50); color: var(--primary); }
.combo-add { border-top: 1px solid var(--border); margin-top: 4px; font-weight: 600; color: var(--primary); }
.combo-empty { padding: 7px 10px; color: var(--muted); }
dialog.modal { border: none; border-radius: var(--radius); padding: 20px; width: min(720px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
dialog.modal::backdrop { background: rgba(15, 23, 42, .45); }
.combo-group { padding: 6px 10px 2px; color: var(--muted); font-size: .82rem; font-weight: 600; white-space: pre; cursor: default; }
.combo-item { white-space: pre-wrap; }

/* Cheque statuses (Phase 6): one colour per status for rows, badges and the status bar */
.chq-new { --chq: #ffffff; --chq-ink: #334155; --chq-line: #cbd5e1; }
.chq-deposited { --chq: #fef9c3; --chq-ink: #854d0e; --chq-line: #fde047; }
.chq-on_hold { --chq: #dbeafe; --chq-ink: #1e40af; --chq-line: #93c5fd; }
.chq-cleared { --chq: #dcfce7; --chq-ink: #166534; --chq-line: #86efac; }
.chq-bounced { --chq: #ffedd5; --chq-ink: #9a3412; --chq-line: #fdba74; }
.chq-returned { --chq: #ede9fe; --chq-ink: #5b21b6; --chq-line: #c4b5fd; }
.chq-replaced { --chq: #ccfbf1; --chq-ink: #115e59; --chq-line: #5eead4; }
.chq-cancelled { --chq: #fee2e2; --chq-ink: #991b1b; --chq-line: #fca5a5; }
tr.chq-row > td { background: var(--chq); }
tr.chq-row > td:first-child { box-shadow: inset 4px 0 0 var(--chq-line); }
[dir="rtl"] tr.chq-row > td:first-child { box-shadow: inset -4px 0 0 var(--chq-line); }
.chq-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600;
  background: var(--chq); color: var(--chq-ink); border: 1px solid var(--chq-line); white-space: nowrap; }
.chq-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chq-bar a { flex: 1 1 140px; display: block; padding: 8px 12px; border-radius: var(--radius); text-decoration: none;
  background: var(--chq); color: var(--chq-ink); border: 1px solid var(--chq-line); }
.chq-bar a.on { outline: 2px solid var(--chq-ink); }
.chq-bar strong { display: block; font-size: 1.05rem; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) tr.chq-row > td { background: color-mix(in srgb, var(--chq) 18%, transparent); }
}

/* Alerts bell (Phase 8) */
.bell { position: relative; }
.bell-count { position: absolute; top: 2px; inset-inline-end: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--danger, #c62828); color: #fff; font-size: .7rem; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.alert-card { border-inline-start: 4px solid var(--border); }
.alert-card.sev-danger { border-inline-start-color: var(--danger, #c62828); }
.alert-card.sev-warning { border-inline-start-color: #d97706; }
.alert-card.sev-info { border-inline-start-color: var(--primary); }

/* ---------- printed tax documents (tax invoice, credit note) — A4, Arabic and English (D-89) ---------- */
.taxdoc { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 28px 32px; max-width: 900px; margin: 0 auto 16px; color: #111827; font-size: 13px;
  --doc-accent: var(--primary); }
.taxdoc .bi-ar { display: block; }
.taxdoc .bi-en { display: block; font-size: .78em; color: #6b7280; font-weight: 400; }
.taxdoc-head { display: grid; grid-template-columns: 1.3fr 1fr 1.1fr; gap: 18px; align-items: start;
  border-bottom: 3px solid var(--doc-accent); padding-bottom: 14px; margin-bottom: 16px; }
.taxdoc-company strong { font-size: 1.05rem; }
.taxdoc-trn { margin-top: 4px; font-weight: 600; }
.taxdoc-trn .bi-ar, .taxdoc-trn .bi-en, .taxdoc-party .small .bi-ar, .taxdoc-party .small .bi-en,
.taxdoc-company .small .bi-ar, .taxdoc-company .small .bi-en { display: inline; }
.taxdoc-title { text-align: center; align-self: center; border: 2px solid var(--doc-accent); border-radius: 10px; padding: 10px 6px; }
.taxdoc-title .ar { font-size: 1.45rem; font-weight: 700; color: var(--doc-accent); }
.taxdoc-title .en { font-size: 1rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: #374151; }
.taxdoc-info { width: 100%; border-collapse: collapse; }
.taxdoc-info th, .taxdoc-info td { padding: 4px 6px; border-bottom: 1px solid #eef2f6; text-align: start; vertical-align: top; }
.taxdoc-info th { color: #4b5563; font-weight: 600; width: 50%; }
.taxdoc-party { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.taxdoc-party > div, .taxdoc-box { border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 12px; }
.taxdoc-box { margin-top: 12px; }
.taxdoc-box-title { font-weight: 700; color: var(--doc-accent); margin-bottom: 4px; }
.taxdoc-box-title .bi-ar, .taxdoc-box-title .bi-en { display: inline; }
.taxdoc-box-title .bi-en { margin-inline-start: 4px; }
.taxdoc-lines { width: 100%; border-collapse: collapse; }
.taxdoc-lines th { background: var(--side); color: #fff; padding: 7px 8px; font-weight: 600; text-align: start; vertical-align: bottom; }
.taxdoc-lines th .bi-en { color: #c3cedc; }
.taxdoc-lines td { padding: 7px 8px; border-bottom: 1px solid #e5e7eb; vertical-align: top; }
.taxdoc-lines tbody tr:nth-child(even) td { background: #f9fafb; }
.taxdoc-totals { display: flex; justify-content: flex-end; margin-top: 10px; }
.taxdoc-totals table { min-width: 340px; border-collapse: collapse; }
.taxdoc-totals th, .taxdoc-totals td { padding: 6px 10px; border-bottom: 1px solid #e5e7eb; text-align: start; }
.taxdoc-totals td { text-align: end; white-space: nowrap; }
.taxdoc-totals th .bi-ar, .taxdoc-totals th .bi-en { display: inline; }
.taxdoc-totals th .bi-en { margin-inline-start: 6px; }
.taxdoc-totals .grand th, .taxdoc-totals .grand td { background: color-mix(in srgb, var(--doc-accent) 10%, #fff); color: var(--doc-accent); font-weight: 700; font-size: 1.05em;
  border-bottom: 2px solid var(--doc-accent); }
.taxdoc-words { margin-top: 12px; padding: 10px 12px; border-inline-start: 4px solid var(--brand); background: #f8fafc; border-radius: 6px; }
.taxdoc-words .bi-ar, .taxdoc-words .bi-en { display: inline; }
.taxdoc-words .bi-en { margin-inline-start: 6px; }
.taxdoc-words .ar { font-weight: 600; }
.taxdoc-words .en { color: #374151; }
.taxdoc-kv th { text-align: start; padding: 2px 12px 2px 0; color: #4b5563; font-weight: 600; }
.taxdoc-kv th .bi-ar, .taxdoc-kv th .bi-en { display: inline; }
.taxdoc-kv th .bi-en { margin-inline-start: 6px; }
.taxdoc-sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 36px; text-align: center; font-size: .9em; }
.taxdoc-sign .line { border-top: 1px solid #9ca3af; margin: 38px 10px 6px; }
.taxdoc-signed { margin: 22px 10px 6px; padding-bottom: 4px; border-bottom: 1px solid #9ca3af; font-weight: 600; }
.taxdoc-stamp { display: block; max-height: 80px; max-width: 160px; margin: 0 auto 6px; }
.taxdoc-foot { margin-top: 18px; text-align: center; border-top: 1px solid #e5e7eb; padding-top: 8px; }
.taxdoc-foot .bi-ar, .taxdoc-foot .bi-en { display: inline; }
.taxdoc-foot .bi-en { margin-inline-start: 6px; }
@media screen and (max-width: 760px) {
  .taxdoc { padding: 16px; }
  .taxdoc-head, .taxdoc-party { grid-template-columns: 1fr; }
  .taxdoc-lines { display: block; overflow-x: auto; }
}
@page { size: A4; margin: 12mm 12mm 14mm; }
@media print {
  .taxdoc { border: 0; box-shadow: none; padding: 0; max-width: none; margin: 0; font-size: 11.5px; }
  .taxdoc, .taxdoc * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .taxdoc-lines thead { display: table-header-group; }
  .taxdoc-lines tr, .taxdoc-totals, .taxdoc-sign, .taxdoc-box { break-inside: avoid; }
  .taxdoc-head { padding-bottom: 10px; margin-bottom: 10px; }
  .taxdoc-lines th, .taxdoc-lines td { padding: 5px 7px; }
  .taxdoc-totals th, .taxdoc-totals td { padding: 4px 8px; }
  .taxdoc-party { margin-bottom: 10px; }
  .taxdoc-party > div, .taxdoc-box { padding: 7px 10px; }
  .taxdoc-box, .taxdoc-words { margin-top: 8px; }
  .taxdoc-sign { margin-top: 18px; }
  .taxdoc-sign .line { margin-top: 26px; }
  .taxdoc-signed { margin-top: 12px; }
}


/* ---------- design refresh (D-92): type scale, density and calm surfaces like leading business apps ---------- */
@media screen {
  body { font-size: 13.5px; line-height: 1.5; letter-spacing: .005em; -webkit-font-smoothing: antialiased; }
  h1 { font-size: 1.32rem; font-weight: 600; letter-spacing: -.01em; }
  h2 { font-size: 1.02rem; font-weight: 600; }
  .num, .table td.num, .kpi .value { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
  .muted, .page-head p { color: #667085; }

  /* layout */
  .content { padding: 20px 28px 48px; max-width: 1480px; }
  .page-head { margin-bottom: 18px; align-items: center; }
  .page-head .actions { gap: 8px; }
  .topbar { min-height: 56px; }

  /* surfaces: hairline border, almost no shadow */
  :root { --shadow: 0 1px 2px rgba(16, 24, 40, .04); --border: #e4e7ec; --surface-2: #f9fafb; --bg: #f5f6f8; }
  .card { padding: 18px 20px; border-radius: 12px; }
  .card + .card { margin-top: 14px; }
  .section-title { font-size: .74rem; letter-spacing: .5px; color: #667085; margin-bottom: 14px; }

  /* KPI tiles */
  .kpis { grid-template-columns: repeat(auto-fill, minmax(min(190px, 100%), 1fr)); gap: 12px; }
  .kpi { padding: 14px 16px; border-radius: 12px; }
  .kpi:hover { transform: none; box-shadow: 0 2px 8px rgba(16, 24, 40, .06); }
  .kpi .label { font-size: .8rem; font-weight: 500; color: #667085; }
  .kpi .value { font-size: 1.38rem; font-weight: 600; margin-top: 6px; letter-spacing: -.01em; color: #101828; }

  /* controls */
  .btn { padding: 6px 13px; font-size: .9rem; border-radius: 8px; min-height: 34px; border-color: #d0d5dd; }
  .btn-primary { border-color: var(--primary); }
  .btn-sm { min-height: 28px; padding: 3px 10px; font-size: .82rem; }
  .input, select.input, textarea.input, .topbar input { padding: 7px 11px; min-height: 36px; font-size: .92rem; border-color: #d0d5dd; }
  textarea.input { min-height: 72px; }
  .input:focus, .topbar input:focus { outline: 3px solid rgba(8, 127, 129, .14); outline-offset: 0; border-color: var(--primary); }
  .field label { font-size: .84rem; font-weight: 500; color: #344054; margin-bottom: 5px; }
  .field .help { font-size: .76rem; color: #667085; }
  .grid { gap: 14px 20px; }
  .filterbar .input { min-height: 34px; }

  /* tables: compact rows, quiet header, figures aligned to the end */
  .table-wrap { border-radius: 12px; }
  .table { font-size: .9rem; }
  .table th, .table td { padding: 8px 14px; border-bottom-color: #eaecf0; }
  .table th { font-size: .74rem; font-weight: 600; color: #667085; text-transform: none; letter-spacing: .2px; background: #f9fafb; }
  .table th.num, .table td.num { text-align: end; }
  .table tbody tr:hover { background: #f5fbfb; }
  .table td a { font-weight: 500; }
  .table .code, .code { color: #98a2b3; font-size: .82em; font-weight: 400; margin-inline-start: 4px; font-variant-numeric: tabular-nums; }

  /* badges and messages */
  .badge { font-size: .74rem; font-weight: 500; padding: 2px 8px; }

  /* sidebar: regular weight, only the current page stands out */
  .nav-link, .nav summary { font-size: .92rem; padding: 8px 10px; font-weight: 400; }
  .nav details[open] > summary { color: #fff; }
  .nav li a { font-size: .88rem; padding-block: 6px; font-weight: 400; }
  .nav-link.active, .nav li a.active { font-weight: 600; }

  /* notification counter sits on the corner of the bell, not over it */
  .bell { padding-inline: 10px; }
  .bell-count { top: -4px; inset-inline-end: -6px; height: 17px; min-width: 17px; font-size: .66rem; line-height: 17px;
    box-shadow: 0 0 0 2px var(--surface); }
  .brand-company { font-size: .78rem; }
}


/* ---------- collapsible sidebar (D-93): icons only, remembered per browser; desktop only ---------- */
.nav-collapse { display: flex; align-items: center; gap: 10px; margin: 0 8px 6px; padding: 8px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--side-text); font: inherit; font-size: .85rem; cursor: pointer; text-align: start; }
.nav-collapse:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-collapse-icon { display: inline-flex; transform: scaleX(-1); transition: transform .15s; }
[dir="rtl"] .nav-collapse-icon { transform: none; }
@media (min-width: 901px) {
  .sidebar { transition: width .18s ease; }
  html.nav-collapsed .sidebar { width: 68px; overflow-x: hidden; }
  html.nav-collapsed .sidebar .nav-text, html.nav-collapsed .sidebar .chev, html.nav-collapsed .brand-company,
  html.nav-collapsed .powered span, html.nav-collapsed .nav details > ul { display: none; }
  html.nav-collapsed .brand { padding: 16px 10px 12px; display: flex; justify-content: center; }
  html.nav-collapsed .brand-name { justify-content: center; }
  html.nav-collapsed .brand-logo { max-width: 44px; max-height: 44px; padding: 3px; }
  html.nav-collapsed .nav { padding-inline: 8px; }
  html.nav-collapsed .nav-link, html.nav-collapsed .nav summary { justify-content: center; padding: 10px 0; }
  html.nav-collapsed .nav details[open] > summary { background: rgba(255, 255, 255, .06); }
  html.nav-collapsed .nav-collapse { justify-content: center; margin-inline: 8px; }
  html.nav-collapsed .nav-collapse-icon { transform: none; }
  html.nav-collapsed[dir="rtl"] .nav-collapse-icon { transform: scaleX(-1); }
  html.nav-collapsed .powered { justify-content: center; padding-inline: 0; }
}
@media (max-width: 900px) { .nav-collapse { display: none; } }
/* the ☰ button in the top bar: collapses the menu on a desktop, opens it on a phone */
.btn.menu-btn { display: inline-flex; }


/* ---------- module home pages (D-94) ---------- */
.nav-hub { display: flex; align-items: center; gap: 10px; color: inherit; flex: 1; min-width: 0; }
.nav-hub:hover { text-decoration: none; color: #fff; }
.nav summary.active { background: rgba(14, 208, 210, .16); color: #fff; box-shadow: inset 3px 0 0 var(--brand); }
[dir="rtl"] .nav summary.active { box-shadow: inset -3px 0 0 var(--brand); }
html.nav-collapsed .nav-hub { justify-content: center; flex: none; }
.hub-kpis .kpi .hint { font-size: .78rem; color: #667085; margin-top: 2px; }
.kpi-warning { border-inline-start: 3px solid #f79009; }
.kpi-danger { border-inline-start: 3px solid var(--danger); }
.kpi-danger .value { color: var(--danger); }
.hub-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 12px; }
.hub-tile { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); transition: border-color .15s, box-shadow .15s; }
.hub-tile:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(16, 24, 40, .06); text-decoration: none; }
.hub-tile-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hub-tile-label { font-weight: 600; color: #101828; }
.hub-count { background: var(--primary-50); color: var(--primary); border-radius: 999px; padding: 1px 10px; font-size: .8rem; font-weight: 600; }
.hub-tile-desc { color: #667085; font-size: .82rem; margin-top: 4px; line-height: 1.45; }
.hub-tile-report .hub-tile-label { font-weight: 500; }

/* ---------- executive dashboard (D-96) ---------- */
.dash-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 22px 26px; margin-bottom: 18px; border-radius: 14px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, rgba(14, 208, 210, .38) 0%, rgba(14, 208, 210, 0) 55%),
              linear-gradient(120deg, #011129 0%, #06304a 55%, #087f81 100%);
  box-shadow: 0 8px 24px rgba(1, 17, 41, .18); }
.dash-hero h1 { color: #fff; font-size: 1.5rem; }
.dash-hero p { margin: 4px 0 0; color: #b9d7e3; }
.dash-date { font-size: .8rem; letter-spacing: .04em; color: #7fe9ea; margin-bottom: 4px; }
.dash-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dash-hero-actions .btn { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .22); color: #fff; }
.dash-hero-actions .btn:hover { background: rgba(255, 255, 255, .22); text-decoration: none; }

.dash-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1680px) { .dash-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .dash-kpis { grid-template-columns: 1fr; } }
.dash-kpi { --c: #087f81; --c-50: #e6f9f9; position: relative; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text); overflow: hidden;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05); transition: box-shadow .15s, border-color .15s; }
.dash-kpi::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px; background: var(--c); }
.dash-kpi:hover { text-decoration: none; border-color: var(--c); box-shadow: 0 6px 16px rgba(16, 24, 40, .08); }
/* "Action needed today" (D-111): what to do now, worst first by colour */
.dash-todo { margin-bottom: 16px; }
.todo-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.todo-list a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); background: var(--surface); border-inline-start: 4px solid var(--tc, var(--primary)); }
.todo-list a:hover { text-decoration: none; box-shadow: 0 4px 12px rgba(16, 24, 40, .08); }
.todo-list b { font-size: 1.5rem; line-height: 1; min-width: 2ch; color: var(--tc, var(--primary)); }
.todo-list span { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; font-weight: 500; }
.todo-list small { color: var(--muted); font-weight: 400; }
.todo-list .todo-go { flex: none; color: var(--primary); font-size: .82rem; font-weight: 600; }
.todo-critical { --tc: #b42318; }
.todo-warning { --tc: #b77900; }
.todo-info { --tc: #087f81; }
.dash-setup { margin-bottom: 16px; }
.dk-teal { --c: #087f81; --c-50: #e3f7f7; }
.dk-blue { --c: #2a78d6; --c-50: #e9f1fc; }
.dk-green { --c: #0ca30c; --c-50: #e7f6e7; }
.dk-red { --c: #d03b3b; --c-50: #fbeaea; }
.dk-amber { --c: #c98a00; --c-50: #fdf4dc; }
.dk-navy { --c: #011129; --c-50: #e7ebf2; }
.dk-icon { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--c-50); color: var(--c); }
.dk-body { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.dk-label { font-size: .78rem; font-weight: 500; color: #667085; }
.dk-value { font-size: 1.5rem; font-weight: 700; color: #101828; letter-spacing: -.02em; line-height: 1.25; margin-top: 2px; }
.dk-value small { font-size: .7rem; font-weight: 600; color: #98a2b3; letter-spacing: 0; }
.dk-hint { font-size: .76rem; color: #667085; margin-top: 2px; }
.dk-delta { font-weight: 600; margin-inline-end: 4px; }
.dk-delta.up { color: #0a7f0a; }
.dk-delta.down { color: #b42318; }
.dk-tone-danger .dk-value { color: #b42318; }
.dk-meter { display: block; height: 4px; border-radius: 4px; background: #eef1f4; margin-top: 8px; overflow: hidden; }
.dk-meter span { display: block; height: 100%; border-radius: 4px; background: var(--c); }

.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }
.dash-grid > .card + .card { margin-top: 0; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.span-8 { grid-column: span 8; }
@media (max-width: 1200px) { .span-4 { grid-column: span 6; } .span-8 { grid-column: span 12; } }
@media (max-width: 760px) { .dash-grid > * { grid-column: span 12; } .dash-hero { padding: 18px; } }
.dash-card { display: flex; flex-direction: column; min-width: 0; }
.dash-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.dash-card-head h2 { margin: 0 0 2px; font-size: 1rem; color: #101828; }
.dash-card-head > a { white-space: nowrap; font-weight: 500; }

.chart { width: 100%; height: auto; display: block; direction: ltr; overflow: visible; }
.chart .grid { stroke: #e1e0d9; stroke-width: 1; stroke-dasharray: 2 3; }
.chart .baseline { stroke: #c4c3bb; stroke-width: 1; }
.chart .axis { fill: #898781; font-size: 11px; font-family: var(--font); }
.chart .hit { fill: transparent; }
.chart .bar { fill: #0ed0d2; transition: opacity .15s; }
.chart .bar-current { fill: #087f81; }
.chart .bar.p1 { fill: #2a78d6; }
.chart .bar.p2 { fill: #eb6834; }
.chart .mark:hover .hit { fill: rgba(1, 17, 41, .04); }
.chart:hover .mark:not(:hover) .bar { opacity: .55; }

.dash-hero-num { font-size: 52px; font-weight: 700; line-height: 1; color: #101828; letter-spacing: -.03em; margin: 4px 0 6px; }
.dash-hero-num span { font-size: 24px; color: #667085; margin-inline-start: 2px; }
.stack-bar { display: flex; gap: 2px; height: 14px; margin: 16px 0 12px; border-radius: 4px; overflow: hidden; background: #eef1f4; }
.stack-bar .seg { display: block; min-width: 3px; transition: filter .15s; }
.stack-bar .seg:hover { filter: brightness(.9); }
.s1 { background: #087f81; }
.s2 { background: #eb6834; }
.s3 { background: #2a78d6; }
.s4 { background: #eda100; }
.s5 { background: #b8b7b0; }
.sw.p1 { background: #2a78d6; }
.sw.p2 { background: #eb6834; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .85rem; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend li a { color: var(--text); flex: 1; }
.legend li b { font-weight: 600; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-inline { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: #475467; }

.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hb-top { display: flex; justify-content: space-between; gap: 10px; font-size: .85rem; margin-bottom: 5px; }
.hb-name { color: #344054; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-top .neg { color: #b42318; }
.hb-track { height: 8px; border-radius: 4px; background: #eef1f4; overflow: hidden; }
.hb-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: #087f81; }
[dir="rtl"] .hb-fill { border-radius: 4px 0 0 4px; }
.hb-fill.neg { background: #d03b3b; }
.hb-fill.occ { background: linear-gradient(90deg, #087f81, #0ed0d2); }
[dir="rtl"] .hb-fill.occ { background: linear-gradient(270deg, #087f81, #0ed0d2); }
.hb-fill.a1 { background: #f6c39f; }
.hb-fill.a2 { background: #ef9a62; }
.hb-fill.a3 { background: #dd6a35; }
.hb-fill.a4 { background: #b0421a; }

.dash-list { list-style: none; margin: 0; padding: 0; }
.dash-list li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid #f0f2f5; font-size: .86rem; }
.dash-list li:first-child { border-top: 0; }
.dl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dl-main a { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-main b { font-weight: 600; color: #101828; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-date, .dl-days { flex: none; min-width: 58px; text-align: center; font-size: .75rem; font-weight: 600; padding: 4px 6px; border-radius: 8px;
  background: #f2f4f7; color: #475467; }
.dl-date.today, .dl-days.soon { background: #fdf4dc; color: #8a5a00; }
.dl-date.late, .dl-days.late { background: #fbeaea; color: #b42318; }
.dash-list li.dash-empty { color: #0a7f0a; justify-content: center; padding: 18px 0; }
.status-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: .74rem; font-weight: 600; margin-top: 4px; }
.status-pill.critical { background: #fbeaea; color: #b42318; }
.status-pill.warning { background: #fdf4dc; color: #8a5a00; }
.dash-card > .status-pill { align-self: flex-start; margin-top: 10px; }

.dash-mini { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.dash-mini a { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: #475467; font-size: .82rem; }
.dash-mini a:hover { border-color: var(--primary); text-decoration: none; }
.dash-mini b { color: #101828; }
.chart-tip { position: fixed; z-index: 1000; pointer-events: none; max-width: 280px; padding: 7px 10px; border-radius: 8px; background: #101828;
  color: #fff; font-size: .78rem; line-height: 1.4; box-shadow: 0 6px 18px rgba(0, 0, 0, .2); font-variant-numeric: tabular-nums; }
@media print { .dash-hero { background: none; color: #000; box-shadow: none; } .dash-hero-actions, .chart-tip { display: none; } }

/* add a charge to a posted contract (D-97) */
.add-charge { margin-top: 12px; }
.add-charge > summary { list-style: none; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.add-charge > summary::-webkit-details-marker { display: none; }
.add-charge[open] > summary { margin-bottom: 12px; }
.add-charge > form { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: var(--surface-2); }

/* ---------- app-wide colour theme (D-98): the dashboard's look on every screen ---------- */
@media screen {
  body { background: #f2f5f8; }

  /* page header = the dashboard banner */
  .page-head { position: relative; align-items: center; padding: 18px 24px; margin-bottom: 18px; border-radius: 14px; color: #fff;
    background: radial-gradient(120% 160% at 100% 0%, rgba(14, 208, 210, .34) 0%, rgba(14, 208, 210, 0) 55%),
                linear-gradient(120deg, #011129 0%, #06304a 58%, #087f81 100%);
    box-shadow: 0 8px 22px rgba(1, 17, 41, .14); }
  .page-head h1 { color: #fff; font-size: 1.35rem; }
  .page-head p, .page-head .muted, .page-head .small { color: #b9d7e3; }
  .page-head a:not(.btn) { color: #7fe9ea; }
  .page-head .num { color: inherit; }
  .page-head .btn { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .22); color: #fff; }
  .page-head .btn:hover { background: rgba(255, 255, 255, .2); text-decoration: none; }
  .page-head .btn-primary { background: #0ed0d2; border-color: #0ed0d2; color: #011129; font-weight: 600; }
  .page-head .btn-primary:hover { background: #3fe0e2; }
  .page-head .btn-danger { background: rgba(208, 59, 59, .85); border-color: rgba(255, 255, 255, .2); }
  .page-head .badge { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .25); color: #fff; }
  .page-head .badge-success { background: rgba(12, 163, 12, .25); color: #c9f5c9; }
  .page-head .badge-danger { background: rgba(208, 59, 59, .3); color: #ffd6d6; }
  .page-head .badge-warning { background: rgba(250, 178, 25, .25); color: #ffe7b0; }
  .page-head .badge-info { background: rgba(14, 208, 210, .22); color: #bff6f6; }

  /* figure tiles: a coloured accent and tinted value chip, like the dashboard */
  .kpis .kpi, .hub-kpis .kpi { --c: #087f81; position: relative; overflow: hidden; border-radius: 12px; border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
  .kpis .kpi::before, .hub-kpis .kpi::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 3px; background: var(--c); }
  /* one accent for figure tiles: colour is kept for meaning (overdue, warnings) — D-111 */
  .kpis .kpi.kpi-warning, .hub-kpis .kpi.kpi-warning { --c: #f79009; border-inline-start: 1px solid var(--border); }
  .kpis .kpi.kpi-danger, .hub-kpis .kpi.kpi-danger { --c: #d03b3b; border-inline-start: 1px solid var(--border); }
  a.kpi:hover { border-color: var(--c); box-shadow: 0 6px 16px rgba(16, 24, 40, .08); }
  .kpi .value { color: #101828; }

  /* cards and section titles */
  .card { border-radius: 12px; border-color: #e6eaf0; box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
  .card h2 { color: #101828; }
  .section-title { display: flex; align-items: center; gap: 8px; color: #06304a; font-weight: 700; }
  .section-title::before, .card-title > h2::before, .card > h2:first-child::before { content: ""; display: inline-block; width: 4px; height: 14px;
    border-radius: 2px; background: linear-gradient(180deg, #0ed0d2, #087f81); margin-inline-end: 8px; vertical-align: -1px; }
  .section-title::before { margin-inline-end: 0; }

  /* tables: tinted header, teal hover, bold document links */
  .table-wrap { border-radius: 12px; border-color: #e6eaf0; }
  .table th { background: #e4f3f4; color: #06304a; font-weight: 600; border-bottom: 2px solid #bfe3e4; }
  .table tbody tr:nth-child(even) { background: #fbfcfd; }
  .table tbody tr:hover { background: #e9f8f8; }
  .table td:first-child > a { font-weight: 600; }
  .table tfoot td, .table tfoot th { background: #eef7f8; color: #06304a; }

  /* module home tiles: coloured counters */
  .hub-tile { border-radius: 12px; position: relative; overflow: hidden; }
  .hub-tile::after { content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px; background: linear-gradient(90deg, #087f81, #0ed0d2); opacity: 0; transition: opacity .15s; }
  .hub-tile:hover::after { opacity: 1; }
  .hub-count { background: linear-gradient(135deg, #087f81, #0ed0d2); color: #fff; }

  /* primary buttons and active filters */
  .btn-primary { background: linear-gradient(135deg, #087f81, #0aa3a5); border-color: #087f81; }
  .btn-primary:hover { background: linear-gradient(135deg, #066a6c, #088f91); }
}


/* data import (D-99) */
.import-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.import-steps > .card + .card { margin-top: 0; }
.import-steps .step-no { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; margin-bottom: 8px;
  background: linear-gradient(135deg, #087f81, #0ed0d2); color: #fff; font-weight: 700; }
@media (max-width: 900px) { .import-steps { grid-template-columns: 1fr; } }

/* unit handover reports (D-102) */
.insp-sign { display: none; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-top: 40px; font-size: 12px; text-align: center; }
.insp-sign .sig-line { border-bottom: 1px solid #000; height: 48px; margin-bottom: 6px; }
@media print { .insp-sign { display: grid; } }
tr.cond-damaged td, tr.cond-missing td { background: #fdf1ef; }
.insp-facts th { background: transparent; border-bottom: 1px solid var(--border); color: #667085; font-weight: 500; width: 14%; }
.insp-facts td { width: 19%; }

/* module pages for every module + favourites (D-105) */
.hub-tile-wrap { position: relative; }
.hub-tile-wrap .hub-tile { height: 100%; padding-inline-end: 44px; }
.hub-fav { position: absolute; inset-inline-end: 10px; bottom: 10px; margin: 0; }
.hub-fav button { border: 0; background: transparent; color: #cbd5e1; cursor: pointer; padding: 4px; border-radius: 6px; line-height: 0; }
.hub-fav button:hover { color: #c98a00; background: #fdf4dc; }
.hub-fav button.on { color: #e5a400; }
.hub-fav button.on svg { fill: #f5c03b; }
.hub-tile-wrap .hub-count { margin-inline-start: auto; }

/* ---------- lists (D-111): light header, status badges, cards and a filter button on phones ---------- */
@media screen {
  .page-head.page-head--list { background: none; box-shadow: none; color: var(--text); padding: 0 0 2px; border-radius: 0; }
  .page-head--list h1 { color: var(--text); }
  .page-head--list p, .page-head--list .muted { color: var(--muted); }
  .page-head--list .btn { background: var(--surface); border-color: var(--border); color: var(--text); }
  .page-head--list .btn:hover { background: var(--surface-2); }
  .page-head--list .btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
  .page-head--list .btn-primary:hover { background: #066a6c; }
}
.status-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap;
  background: #eef1f4; color: #475467; }
.status-badge.st-good { background: #e3f6e8; color: #116b2f; }
.status-badge.st-info { background: #e3f4f5; color: #06686a; }
.status-badge.st-warn { background: #fdf3d8; color: #8a5a00; }
.status-badge.st-bad { background: #fde8e7; color: #a32018; }
.filter-toggle { display: none; }
@media (max-width: 640px) {
  .filterbar[data-autosubmit] { align-items: stretch; }
  .filterbar[data-autosubmit] > input[type=search] { flex: 1 1 60%; }
  .filter-toggle { display: inline-flex; }
  .filterbar[data-autosubmit]:not(.open) .filter-field,
  .filterbar[data-autosubmit]:not(.open) .combo:has(.filter-field),
  .filterbar[data-autosubmit]:not(.open) button[type=submit] { display: none; }
  .filterbar[data-autosubmit].open .filter-field, .filterbar[data-autosubmit].open .combo { flex: 1 1 100%; }
  /* each row becomes a card: label on one side, value on the other */
  .table-wrap:has(.table-cards) { overflow: visible; background: none; border: 0; box-shadow: none; }
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; }
  .table-cards td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 5px 0; text-align: start; }
  .table-cards td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; flex: none; }
  .table-cards td:first-child { font-size: 1rem; font-weight: 700; border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 4px; }
  .table-cards td:first-child::before { display: none; }
  .table-cards td.empty { display: block; text-align: center; }
  .table-cards td.empty::before { display: none; }
  .table-cards td:empty { display: none; }
}

/* contract form (D-111): optional parts folded, save always in reach */
.more-details > summary { cursor: pointer; font-weight: 600; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.more-details[open] > summary { margin-bottom: 12px; }
.form-actions-sticky { position: sticky; bottom: 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--border);
  padding: 10px 12px; margin-inline: -4px; box-shadow: 0 -6px 16px rgba(16, 24, 40, .06); border-radius: 10px 10px 0 0; }

/* an empty list says what to do first (D-111) */
.empty-state { display: grid; justify-items: center; gap: 8px; padding: 22px 12px; text-align: center; }
.empty-state p { margin: 0; max-width: 60ch; }
.empty-state .actions { justify-content: center; }

/* an empty date field shows the calendar icon only, not the browser's English "dd----yyyy" mask (D-111) */
input[type=date][data-empty]:not(:focus)::-webkit-datetime-edit { color: transparent; }

/* ---------- print templates (D-112): classic is the base above; modern, minimal and compact A5 ---------- */
.doc-style-picker { display: inline-flex; }
.doc-style-picker select { width: auto; min-width: 150px; }
/* label language */
.taxdoc.labels-ar .bi-en, .taxdoc.labels-ar .taxdoc-title .en, .taxdoc.labels-ar .taxdoc-words .en { display: none !important; }
.taxdoc.labels-en .bi-ar, .taxdoc.labels-en .taxdoc-title .ar, .taxdoc.labels-en .taxdoc-words .ar { display: none !important; }
.taxdoc.labels-en .bi-en { font-size: 1em; color: inherit; font-weight: inherit; }
.taxdoc.labels-en .taxdoc-title .en { font-size: 1.35rem; font-weight: 700; color: var(--doc-accent); }
/* modern: a coloured band on top, soft boxes, coloured total */
.taxdoc--modern .taxdoc-head { background: var(--doc-accent); color: #fff; border: 0; border-radius: 12px; padding: 18px 20px; }
.taxdoc--modern .taxdoc-head .small, .taxdoc--modern .taxdoc-head .muted, .taxdoc--modern .taxdoc-head .bi-en,
.taxdoc--modern .taxdoc-info th { color: rgba(255, 255, 255, .78); }
.taxdoc--modern .taxdoc-info th, .taxdoc--modern .taxdoc-info td { border-bottom-color: rgba(255, 255, 255, .18); }
.taxdoc--modern .taxdoc-title { border-color: rgba(255, 255, 255, .55); }
.taxdoc--modern .taxdoc-title .ar, .taxdoc--modern .taxdoc-title .en,
.taxdoc--modern.labels-en .taxdoc-title .en { color: #fff; }
.taxdoc--modern .doc-logo { background: #fff; padding: 4px 6px; border-radius: 8px; }
.taxdoc--modern .taxdoc-party > div, .taxdoc--modern .taxdoc-box { border: 0; background: #f4f6f8; }
.taxdoc--modern .taxdoc-lines th { background: color-mix(in srgb, var(--doc-accent) 12%, #fff); color: #111827;
  border-bottom: 2px solid var(--doc-accent); }
.taxdoc--modern .taxdoc-lines th .bi-en { color: #6b7280; }
.taxdoc--modern .taxdoc-lines tbody tr:nth-child(even) td { background: none; }
.taxdoc--modern .taxdoc-lines td { border-bottom-color: #eef1f4; }
.taxdoc--modern .taxdoc-totals .grand th, .taxdoc--modern .taxdoc-totals .grand td { background: var(--doc-accent); color: #fff; border: 0; }
.taxdoc--modern .taxdoc-words { background: #f4f6f8; border-inline-start-color: var(--doc-accent); }
.taxdoc--modern .taxdoc-totals .grand .bi-en { color: rgba(255, 255, 255, .8); }
.taxdoc--modern .taxdoc-info td { white-space: nowrap; }
/* minimal: black on white, thin rules — cheap to print and easy to photocopy */
.taxdoc--minimal { --doc-accent: #111827; }
.taxdoc--minimal .taxdoc-head { border-bottom-width: 1px; }
.taxdoc--minimal .taxdoc-title { border: 0; border-block: 1px solid #111827; border-radius: 0; }
.taxdoc--minimal .taxdoc-lines th { background: none; color: #111827; border-block: 1px solid #111827; }
.taxdoc--minimal .taxdoc-lines th .bi-en { color: #4b5563; }
.taxdoc--minimal .taxdoc-lines tbody tr:nth-child(even) td { background: none; }
.taxdoc--minimal .taxdoc-party > div, .taxdoc--minimal .taxdoc-box { border: 0; border-top: 1px solid #d1d5db; border-radius: 0; padding-inline: 0; }
.taxdoc--minimal .taxdoc-totals .grand th, .taxdoc--minimal .taxdoc-totals .grand td { background: none; color: #111827;
  border-block: 2px solid #111827; }
.taxdoc--minimal .taxdoc-words { background: none; border-inline-start-color: #111827; }
/* compact: half an A4 page (A5), for vouchers printed every day */
.taxdoc--compact { max-width: 620px; font-size: 12px; padding: 18px 20px; }
.taxdoc--compact .taxdoc-head { grid-template-columns: 1fr 1fr; gap: 10px; padding-bottom: 8px; margin-bottom: 10px; }
.taxdoc--compact .taxdoc-title { grid-column: 1 / -1; order: -1; padding: 4px; border-width: 1px; }
.taxdoc--compact .taxdoc-title .ar { font-size: 1.15rem; }
.taxdoc--compact .taxdoc-title .en { font-size: .8rem; }
.taxdoc--compact .doc-logo { max-height: 36px; }
.taxdoc--compact .taxdoc-party { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.taxdoc--compact .taxdoc-party > div, .taxdoc--compact .taxdoc-box { padding: 6px 8px; }
.taxdoc--compact .taxdoc-lines th, .taxdoc--compact .taxdoc-lines td { padding: 4px 5px; }
.taxdoc--compact .taxdoc-lines td, .taxdoc--compact .taxdoc-info td { white-space: nowrap; }
.taxdoc--compact .taxdoc-lines td:nth-child(2) { white-space: normal; }
.taxdoc--compact .taxdoc-totals table { min-width: 0; width: 100%; }
.taxdoc--compact .taxdoc-box, .taxdoc--compact .taxdoc-words { margin-top: 6px; padding: 6px 8px; }
.taxdoc--compact .taxdoc-sign { margin-top: 14px; gap: 10px; }
.taxdoc--compact .taxdoc-sign .line { margin-top: 22px; }
.taxdoc--compact .taxdoc-stamp { max-height: 56px; }
.taxdoc--compact .taxdoc-foot { display: none; }
@media print {
  .taxdoc--compact { font-size: 9.5px; max-width: none; padding: 0; }
  .taxdoc--modern .taxdoc-head { padding: 12px 14px; }
}

/* trial companies see how many days are left (D-114) */
.trial-banner { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-bottom: 14px; padding: 9px 14px;
  border-radius: 10px; background: #fdf3d8; color: #6b4a00; border: 1px solid #f3dfa6; font-weight: 600; }
.trial-banner .muted { font-weight: 400; color: #7a5a14; }

