/* Albyan design system — tokens, Bootstrap 5.1 mapping, components and app shell.
   Source of truth: the "Albyan Design System" artifact (tokens.json). */

:root {
    --page: #f3f5f5;
    --surface: #ffffff;
    --surface-sunk: #e9eeed;
    --surface-hover: #f0f5f4;
    --line: #d5dddb;
    --line-strong: #7d8b88;
    --ink: #17201e;
    --ink-muted: #4c5a57;
    --brand: #0d5c57;
    --brand-hover: #094744;
    --on-brand: #ffffff;
    --brand-soft: #e2f1ef;
    --focus: #0d5c57;
    --success: #08703f;
    --success-soft: #e5f6ec;
    --warning: #8a4a00;
    --warning-soft: #fff3dc;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --on-danger: #ffffff;
    --info: #1f5fae;
    --info-soft: #e8f0fb;
    --mark-gold: #e8b13a;
    --shadow-pop: 0 8px 24px rgba(23, 32, 30, 0.14);

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-6: 24px;
    --space-8: 32px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;
    --control-height: 36px;
    --row-height: 36px;
    --sidebar-width: 248px;
    --sidebar-rail: 64px;
    --font-sans: "Cairo", "Segoe UI", Tahoma, Arial, sans-serif;

    --bs-font-sans-serif: var(--font-sans);
    --bs-body-font-family: var(--font-sans);
    --bs-body-font-size: 14px;
    --bs-body-line-height: 1.6;
    --bs-body-color: var(--ink);
    --bs-body-bg: var(--page);
}

/* ---------- Base ---------- */
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 22px;
    color: var(--ink);
    background: var(--page);
    font-variant-numeric: tabular-nums;
}
a { color: var(--brand); }
a:hover { color: var(--brand-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, h4, h5 { font-family: var(--font-sans); color: var(--ink); }

/* ---------- Bootstrap pieces still in use (modal, tabs JS, utilities) ---------- */
.modal-content { border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); }
.dropdown-menu { border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-pop); font-size: 14px; }
.dropdown-item:hover { background: var(--surface-hover); }

/* ---------- Shared states ---------- */
#btnCancel.disabled, .ab-btn.disabled { opacity: .5; pointer-events: none; }

/* ---------- Components ---------- */
.ab-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.ab-stack { display: flex; flex-direction: column; gap: var(--space-3); }
.ab-muted { color: var(--ink-muted); }
.ab-num { text-align: right; direction: ltr; unicode-bidi: isolate; font-weight: 600; white-space: nowrap; }

.ab-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1);
    min-height: var(--control-height); padding: 0 var(--space-4);
    border-radius: var(--radius-md); border: 1px solid var(--line-strong);
    background: var(--surface); color: var(--ink);
    font: 600 14px/22px var(--font-sans); cursor: pointer; white-space: nowrap; text-decoration: none;
}
.ab-btn:hover { background: var(--surface-hover); color: var(--ink); }
.ab-btn--primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.ab-btn--primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--on-brand); }
.ab-btn--ghost { background: transparent; border-color: transparent; color: var(--brand); }
.ab-btn--ghost:hover { background: var(--brand-soft); color: var(--brand); }
.ab-btn--ghost-danger { background: transparent; border-color: transparent; color: var(--danger); }
.ab-btn--ghost-danger:hover { background: var(--danger-soft); color: var(--danger); }
.ab-btn--danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.ab-btn--danger:hover { background: #8f1c13; border-color: #8f1c13; color: var(--on-danger); }
.ab-btn--sm { min-height: 28px; padding: 0 var(--space-2); font-size: 13px; }
.ab-btn[disabled] { opacity: .5; cursor: not-allowed; }
.ab-btn .bi { font-size: 16px; line-height: 1; }
.ab-kbd { font: 600 11px/16px var(--font-sans); padding: 0 var(--space-1); border: 1px solid currentColor; border-radius: var(--radius-sm); opacity: .8; direction: ltr; }

.ab-field { display: flex; flex-direction: column; gap: var(--space-1); min-width: 0; }
.ab-field--wide { grid-column: span 2; }
.ab-label { font: 600 13px/20px var(--font-sans); color: var(--ink-muted); margin: 0; }
.ab-label .req { color: var(--danger); margin-inline-start: 2px; }
.ab-input, .ab-select {
    height: var(--control-height); width: 100%; padding: 0 var(--space-3);
    border: 1px solid var(--line-strong); border-radius: var(--radius-md);
    background: var(--surface); color: var(--ink); font: 400 14px/22px var(--font-sans);
}
.ab-input::placeholder { color: var(--ink-muted); }
.ab-input:focus, .ab-select:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.ab-input[readonly] { background: var(--surface-sunk); border-color: var(--line); }
.ab-input--num { text-align: right; direction: ltr; font-weight: 600; }
/* A plain file box: the browser's button gets room and the look of a button, instead of sitting flush inside the box. */
.ab-input[type="file"] { padding: 0 var(--space-2); line-height: calc(var(--control-height) - 2px); color: var(--ink-muted); cursor: pointer; }
.ab-input[type="file"]::file-selector-button {
    margin-inline-end: var(--space-3); height: calc(var(--control-height) - 14px); padding: 0 var(--space-3); vertical-align: middle;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-sunk); color: var(--ink);
    font: 600 13px var(--font-sans); cursor: pointer;
}
.ab-filepick [hidden] { display: none !important; }
.ab-filepick { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); min-height: var(--control-height); }
.ab-filepick__names { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 13px/22px var(--font-sans); }
.ab-filepick:focus-within label.ab-btn { outline: 2px solid var(--focus); outline-offset: 1px; }
.ab-input--invalid, .ab-input.input-validation-error, .ab-select.input-validation-error { border-color: var(--danger); background: var(--danger-soft); }
.ab-help { font: 400 12px/18px var(--font-sans); color: var(--ink-muted); }
.ab-error { font: 600 12px/18px var(--font-sans); color: var(--danger); }
.ab-error:empty, .ab-error.validation-summary-valid { display: none; }
.ab-error ul { margin: 0; padding-inline-start: var(--space-4); }
.ab-grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-3) var(--space-4); }

.ab-badge { display: inline-flex; align-items: center; gap: var(--space-1); padding: 0 var(--space-2); border-radius: var(--radius-sm); font: 600 12px/22px var(--font-sans); white-space: nowrap; }
.ab-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ab-badge--success { color: var(--success); background: var(--success-soft); }
.ab-badge--warning { color: var(--warning); background: var(--warning-soft); }
.ab-badge--danger { color: var(--danger); background: var(--danger-soft); }
.ab-badge--info { color: var(--info); background: var(--info-soft); }
.ab-badge--neutral { color: var(--ink-muted); background: var(--surface-sunk); }

.ab-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.ab-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); }
.ab-card__body { padding: var(--space-4); }
.ab-card__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) var(--space-4); font: 400 12px/18px var(--font-sans); color: var(--ink-muted); border-top: 1px solid var(--line); }
.ab-section-title { font: 600 17px/26px var(--font-sans); margin: 0; }

.ab-pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.ab-crumbs { font: 400 12px/18px var(--font-sans); color: var(--ink-muted); }
.ab-crumbs a { color: var(--ink-muted); text-decoration: none; }
.ab-crumbs a:hover { color: var(--brand); }
.ab-crumbs > * + *::before { content: "/"; margin-inline: var(--space-1); color: var(--ink-muted); }
.ab-title { font: 700 22px/32px var(--font-sans); margin: 0; }
.ab-pagehead__sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--ink-muted); font-size: 13px; line-height: 22px; }
.ab-pagehead__sub .ab-print-only { display: none; }
@media print { .ab-pagehead__sub .ab-print-only { display: inline; } }

.ab-table-wrap { overflow-x: auto; }
.ab-table { width: 100%; border-collapse: collapse; font: 400 14px/22px var(--font-sans); }
.ab-table th { position: sticky; top: 0; background: var(--surface-sunk); color: var(--ink-muted); font: 600 13px/20px var(--font-sans); text-align: start; padding: var(--space-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.ab-table th.num, .ab-table td.num, .ab-voucher__table .num { text-align: right; }
.ab-table td { height: var(--row-height); padding: 0 var(--space-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.ab-table tbody tr:last-child td { border-bottom: 0; }
.ab-table tbody tr:hover { background: var(--surface-hover); }
.ab-table tr.selected { background: var(--brand-soft); }
.ab-table .code { color: var(--ink-muted); font-weight: 600; }
.ab-table td.wrap { white-space: normal; min-width: 160px; }
.ab-table td.actions { text-align: end; width: 1%; }
.ab-empty { padding: var(--space-8) var(--space-4); text-align: center; color: var(--ink-muted); }

.ab-alert { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); font: 400 14px/22px var(--font-sans); margin-bottom: var(--space-4); }
.ab-alert strong { font-weight: 700; }
.ab-alert__text { flex: 1; }
/* Licence file preview (System → Licence): label / value pairs. */
.ab-licprev { display: grid; grid-template-columns: max-content 1fr; gap: 2px var(--space-4); margin: var(--space-2) 0; color: var(--ink); }
.ab-licprev dt { font-weight: 600; color: var(--ink-muted); }
.ab-licprev dd { margin: 0; overflow-wrap: anywhere; }
.ab-alert__close { background: none; border: 0; color: inherit; padding: 0; line-height: 1; cursor: pointer; }
.ab-alert--success { background: var(--success-soft); color: var(--success); }
.ab-alert--warning { background: var(--warning-soft); color: var(--warning); }
.ab-alert--danger { background: var(--danger-soft); color: var(--danger); }
.ab-alert--info { background: var(--info-soft); color: var(--info); }
.ab-alert .bi { font-size: 18px; line-height: 22px; }
/* Unusual cost lines in the shipment allocation (D-086): the line and its reasons under it. */
.ab-table tr.ab-flagged > td { background: var(--warning-soft); }
.ab-table tr.ab-flag-notes > td { background: var(--warning-soft); color: var(--warning); font-size: 13px; padding-top: 0; }
.ab-flag-notes ul { margin: 0; padding-inline-start: var(--space-4); }
/* A total row that must print once, at the end of the report, not at the foot of every printed page. */
@media print { table.ab-tfoot-once tfoot { display: table-row-group; } }

/* ---------- App shell ---------- */
.ab-app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.ab-side {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    background: var(--surface); border-inline-end: 1px solid var(--line);
    padding: var(--space-3); display: flex; flex-direction: column; gap: 2px;
}
.ab-side__brand { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2); margin-bottom: var(--space-2); color: var(--ink); text-decoration: none; font: 700 17px/26px var(--font-sans); }
.ab-side__brand img { width: 30px; height: 30px; }
.ab-side__brand:hover { color: var(--ink); }
.ab-side__section { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--line); }
.ab-side__group {
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); width: 100%;
    margin-top: 0; padding: 6px var(--space-2); border: 0; border-radius: var(--radius-sm);
    background: none; font: 700 14px/22px var(--font-sans); color: var(--ink); text-align: start; cursor: pointer;
}
.ab-side__section.has-active > .ab-side__group { color: var(--brand); }
.ab-side__group:hover { color: var(--ink); background: var(--surface-hover); }
.ab-side__chev { font-size: 11px; transition: transform .15s ease; }
.ab-side__section.is-folded .ab-side__chev { transform: rotate(90deg); }
[dir="rtl"] .ab-side__section.is-folded .ab-side__chev { transform: rotate(-90deg); }
.ab-side__section.is-folded .ab-side__list { display: none; }
.ab-side__list { display: flex; flex-direction: column; gap: 2px; margin-inline-start: var(--space-3); padding-inline-start: var(--space-2); border-inline-start: 2px solid var(--line); }
.ab-side__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-side__item { display: flex; align-items: center; gap: var(--space-2); padding: 6px var(--space-2); border-radius: var(--radius-md); color: var(--ink-muted); font-size: 14px; text-decoration: none; }
.ab-side__item .bi { font-size: 16px; color: var(--ink-muted); }
.ab-side__item:hover { background: var(--surface-hover); color: var(--ink); }
.ab-side__item.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.ab-side__item.active .bi { color: var(--brand); }
.ab-body { display: flex; flex-direction: column; min-width: 0; }
.ab-top {
    position: sticky; top: 0; z-index: 1020;
    display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
    min-height: 52px; padding: var(--space-2) var(--space-6);
    background: var(--surface); border-bottom: 1px solid var(--line);
}
.ab-top__start, .ab-top__end { display: flex; align-items: center; gap: var(--space-2); }
.ab-menu-toggle .bi { font-size: 18px; }
.ab-user__avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; }
.ab-user__avatar--lg { width: 44px; height: 44px; font-size: 18px; background: var(--brand); color: #fff; }

/* User menu (top corner): avatar + name, folds open to account actions. */
.ab-usermenu__btn {
    display: inline-flex; align-items: center; gap: var(--space-2); max-width: 260px;
    padding: 3px var(--space-2) 3px 3px; border: 1px solid var(--line); border-radius: 999px;
    background: var(--surface); color: var(--ink); font: 600 14px/22px var(--font-sans); cursor: pointer;
}
[dir="rtl"] .ab-usermenu__btn { padding: 3px 3px 3px var(--space-2); }
.ab-usermenu__btn:hover, .ab-usermenu__btn[aria-expanded="true"] { background: var(--surface-hover); border-color: var(--brand); }
.ab-usermenu__btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ab-usermenu__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-usermenu__chev { font-size: 11px; color: var(--ink-muted); transition: transform .15s ease; }
.ab-usermenu__btn[aria-expanded="true"] .ab-usermenu__chev { transform: rotate(180deg); }
.ab-usermenu__panel { min-width: 260px; padding: var(--space-2) 0; }
.ab-usermenu__head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-4); }
.ab-usermenu__who { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.ab-usermenu__full { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.ab-usermenu__login { font-size: 13px; color: var(--ink-muted); }
.ab-usermenu__panel .dropdown-item { display: flex; align-items: center; gap: var(--space-2); padding: 8px var(--space-4); }
.ab-usermenu__panel .dropdown-item .bi { color: var(--ink-muted); }
.ab-usermenu__out, .ab-usermenu__out .bi { color: var(--danger) !important; }
.ab-usermenu__out:hover { background: var(--danger-soft); }

/* Context bar (0.9c): working company / branch and today's fiscal period, next to the menu button. */
.ab-top__start { min-width: 0; }
.ab-ctx { min-width: 0; }
.ab-ctx__btn {
    display: inline-flex; align-items: center; gap: var(--space-2); max-width: 520px; min-width: 0;
    padding: 4px var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-md);
    background: var(--surface); color: var(--ink); font: 600 14px/22px var(--font-sans); cursor: pointer;
}
.ab-ctx__btn:hover, .ab-ctx__btn[aria-expanded="true"] { background: var(--surface-hover); border-color: var(--brand); }
.ab-ctx__btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ab-ctx__btn > .bi-building { color: var(--brand); }
.ab-ctx__btn[aria-expanded="true"] .ab-usermenu__chev { transform: rotate(180deg); }
.ab-ctx__names { display: inline-flex; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; }
.ab-ctx__company, .ab-ctx__branch { overflow: hidden; text-overflow: ellipsis; }
.ab-ctx__branch { color: var(--ink-muted); font-weight: 400; }
.ab-ctx__sep { color: var(--ink-muted); }
.ab-ctx__period { flex: none; display: inline-flex; align-items: center; gap: 4px; }
.ab-ctx__panel { width: 320px; max-width: calc(100vw - 32px); padding: var(--space-4); }
.ab-ctx__form { display: flex; flex-direction: column; gap: var(--space-3); }
.ab-ctx__note { margin: 0; }
.ab-ctx__today { display: block; font-size: 13px; opacity: .85; }
@media (max-width: 600px) {
    .ab-ctx__names, .ab-ctx__btn .ab-usermenu__chev { display: none; }
}

/* Folded side menu (desktop): icon rail; names show as tooltips. */
@media (min-width: 901px) {
    .ab-app { transition: grid-template-columns .18s ease; }
    .ab-app.side-collapsed { grid-template-columns: var(--sidebar-rail) minmax(0, 1fr); }
    .side-collapsed .ab-side { padding-inline: var(--space-2); overflow-x: hidden; }
    .side-collapsed .ab-side__label, .side-collapsed .ab-side__chev { display: none; }
    .side-collapsed .ab-side__brand, .side-collapsed .ab-side__item { justify-content: center; padding-inline: 0; }
    .side-collapsed .ab-side__item { padding-block: 8px; }
    .side-collapsed .ab-side__item .bi { font-size: 18px; }
    .side-collapsed .ab-side__group { display: none; }
    .side-collapsed .ab-side__list { margin: 0; padding: 0; border: 0; }
    .side-collapsed .ab-side__section.is-folded .ab-side__list { display: flex; }
}
@media (min-width: 901px) and (prefers-reduced-motion: reduce) { .ab-app { transition: none; } }
@media (max-width: 600px) {
    .ab-usermenu__name, .ab-usermenu__chev, .ab-top__lang-text { display: none; }
    .ab-usermenu__btn, [dir="rtl"] .ab-usermenu__btn { padding: 3px; }
}
.ab-main { padding: var(--space-6); min-width: 0; flex: 1; }

.ab-auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--space-6) var(--space-4); gap: var(--space-4); }
.ab-auth__logo { height: 64px; }
.ab-auth__lang { position: absolute; top: var(--space-4); inset-inline-end: var(--space-4); }
.ab-auth__card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-8) var(--space-6); }

@media (max-width: 900px) {
    .ab-app { grid-template-columns: minmax(0, 1fr); }
    .ab-side {
        position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 1040;
        width: var(--sidebar-width); transform: translateX(100%); transition: transform .2s ease;
        box-shadow: var(--shadow-pop);
    }
    [dir="ltr"] .ab-side { transform: translateX(-100%); }
    .ab-app.menu-open .ab-side { transform: none; }
    .ab-menu-toggle { display: inline-flex; }
    .ab-top { padding: var(--space-2) var(--space-4); }
    .ab-main { padding: var(--space-4); }
    .ab-field--wide { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) { .ab-side { transition: none; } }
@media print {
    .ab-side, .ab-top, .ab-noprint { display: none !important; }
    .ab-app { display: block; }
    .ab-main { padding: 0; }
    body { background: #fff; }
}

/* ---------- Password field with show/hide ---------- */
.ab-pass { position: relative; }
.ab-pass .ab-input { padding-inline-end: 40px; }
.ab-pass__toggle {
    position: absolute; inset-block: 0; inset-inline-end: 0; width: 40px;
    display: grid; place-items: center; background: none; border: 0; color: var(--ink-muted); cursor: pointer;
}
.ab-pass__toggle:hover { color: var(--brand); }

/* ---------- Date field (dd/MM/yyyy text + calendar button) ---------- */
.ab-date { position: relative; }
.ab-date .ab-input { padding-inline-end: 40px; }
.ab-date__native { position: absolute; inset-block: 0; inset-inline-end: 0; width: 40px; height: 100%; opacity: 0; pointer-events: none; border: 0; padding: 0; }
.ab-date__btn {
    position: absolute; inset-block: 0; inset-inline-end: 0; width: 40px;
    display: grid; place-items: center; background: none; border: 0; color: var(--ink-muted); cursor: pointer;
}
.ab-date__btn:hover { color: var(--brand); }
.ab-date__btn:disabled { cursor: not-allowed; opacity: .5; }

/* ---------- Sortable table header ---------- */
.ab-sort { display: inline-flex; align-items: center; gap: 4px; color: inherit; text-decoration: none; white-space: nowrap; }
.ab-sort:hover { color: var(--brand); }
.ab-sort .bi { font-size: 12px; opacity: .35; }
.ab-sort:hover .bi { opacity: .8; }
.ab-sort.is-sorted { color: var(--brand); }
.ab-sort.is-sorted .bi { opacity: 1; }

/* ---------- Pager ---------- */
.ab-pager { display: flex; flex-wrap: wrap; gap: 2px; margin: 0; padding: 0; list-style: none; }
.ab-pager a, .ab-pager span {
    display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 var(--space-2);
    border-radius: var(--radius-md); color: var(--ink); text-decoration: none; font-weight: 600;
}
.ab-pager a:hover { background: var(--surface-hover); }
.ab-pager .is-current { background: var(--brand); color: var(--on-brand); }
.ab-pager .is-disabled { color: var(--ink-muted); opacity: .4; }
.ab-pager .is-gap { min-width: 16px; padding: 0; color: var(--ink-muted); }
.ab-pager .bi { font-size: 14px; }
[dir="ltr"] .ab-flip-ltr { display: inline-block; transform: scaleX(-1); }

/* List footer: count, rows per page, pager. */
.ab-listfoot { font-size: 13px; }
.ab-listfoot__end { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); }
.ab-listfoot__size { display: inline-flex; align-items: center; gap: var(--space-2); margin: 0; }
.ab-select--sm { height: 30px; width: auto; min-width: 68px; padding-block: 0; font-size: 13px; }

/* ---------- Tabs (Bootstrap tab JS, design-system look) ---------- */
.ab-tabs { display: flex; flex-wrap: wrap; gap: var(--space-1); padding: 0 var(--space-4); border-bottom: 1px solid var(--line); }
.ab-tabs__tab {
    background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
    padding: var(--space-2) var(--space-3); font: 600 14px/22px var(--font-sans); color: var(--ink-muted); cursor: pointer;
    display: inline-flex; align-items: center; gap: var(--space-2);
}
.ab-tabs__tab:hover { color: var(--ink); }
.ab-tabs__tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.ab-count { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--surface-sunk); color: var(--ink-muted); font: 600 12px/20px var(--font-sans); text-align: center; }
.ab-tabs__tab.active .ab-count { background: var(--brand-soft); color: var(--brand); }

/* ---------- Checkbox list and switch ---------- */
.ab-check { display: flex; align-items: center; gap: var(--space-2); min-height: 32px; padding: 2px var(--space-2); padding-inline-start: calc(var(--space-2) + var(--level, 0) * 24px); border-radius: var(--radius-md); margin: 0; cursor: pointer; }
.ab-check:hover { background: var(--surface-hover); }
.ab-check input { width: 16px; height: 16px; accent-color: var(--brand); flex: none; margin: 0; }
.ab-check--parent { font-weight: 700; }
.ab-check__code { color: var(--ink-muted); font-size: 12px; direction: ltr; unicode-bidi: isolate; }
.ab-check:has(input:disabled) { cursor: not-allowed; opacity: .55; }
.ab-scope { padding-block: var(--space-2); border-bottom: 1px solid var(--line); }
.ab-scope:last-child { border-bottom: 0; }
.ab-switch { display: flex; align-items: flex-start; gap: var(--space-3); margin: 0; cursor: pointer; }
.ab-switch input { appearance: none; flex: none; width: 36px; height: 20px; margin-top: 2px; border-radius: 10px; background: var(--line-strong); position: relative; cursor: pointer; transition: background .15s; }
.ab-switch input::after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; }
.ab-switch input:checked { background: var(--brand); }
.ab-switch input:checked::after { inset-inline-start: 18px; }
.ab-switch input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- Home tiles ---------- */
.ab-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--space-3); }
.ab-tile {
    display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4);
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
    color: var(--ink); text-decoration: none; font-weight: 600;
}
.ab-tile:hover { border-color: var(--brand); color: var(--brand); }
.ab-tile .bi { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--radius-md); background: var(--brand-soft); color: var(--brand); font-size: 18px; flex: none; }
.ab-group-title { font: 600 13px/20px var(--font-sans); color: var(--ink-muted); margin: var(--space-6) 0 var(--space-2); }
.ab-group-title:first-of-type { margin-top: 0; }

/* ---------- Tree table (departments) ---------- */
.ab-tt__name { display: flex; align-items: center; gap: var(--space-1); padding-inline-start: calc(var(--level, 0) * 22px); min-width: 220px; }
.ab-tt__toggle, .ab-tt__leaf { flex: none; width: 24px; height: 24px; }
.ab-tt__toggle {
    display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: var(--radius-sm);
    background: none; color: var(--ink-muted); cursor: pointer;
}
.ab-tt__toggle:hover { background: var(--brand-soft); color: var(--brand); }
.ab-tt__toggle .bi { font-size: 13px; transition: transform .15s ease; }
.ab-tt__toggle[aria-expanded="false"] .bi { transform: rotate(90deg); }
[dir="ltr"] .ab-tt__toggle[aria-expanded="false"] .bi { transform: rotate(-90deg); }
.ab-tt__leaf { position: relative; }
.ab-tt__leaf::before { content: ""; position: absolute; top: 50%; inset-inline-start: 50%; width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; background: var(--line-strong); }
.ab-tt__label { color: var(--ink); text-decoration: none; font-weight: 600; }
.ab-tt__label:hover { color: var(--brand); text-decoration: underline; }
.ab-tt tr[data-parent] .ab-tt__label { font-weight: 400; }
.ab-tt__group th { background: var(--surface); color: var(--ink); font: 700 14px/22px var(--font-sans); padding-top: var(--space-3); position: static; }
.ab-tt__group .bi { color: var(--ink-muted); margin-inline-end: var(--space-1); }
.ab-tt__group .ab-count { margin-inline-start: var(--space-1); }
.ab-tt tr.is-match td { background: var(--brand-soft); }
.ab-tt tr.is-inactive .ab-tt__label, .ab-tt tr.is-inactive td:not(.actions) { color: var(--ink-muted); }
.ab-tt tr.is-inactive .ab-tt__label { font-weight: 400; }
.ab-deptlist .ab-tt__label { font-weight: 400; }
.ab-deptlist tr.is-inactive .ab-tt__label, .ab-deptlist tr.is-inactive td:not(.actions) { color: var(--ink-muted); }

/* Chart of accounts tree: group accounts bold, posting accounts normal (D-022). */
.ab-coa tr.is-group .ab-tt__label { font-weight: 600; }
.ab-coa tr.is-posting .ab-tt__label { font-weight: 400; }
.ab-coa tr.is-inactive .ab-tt__label { font-weight: 400; }
.ab-coa .ab-tt__toggle:disabled { opacity: .5; cursor: progress; }

/* A value shown in a form field's place when it cannot be changed. */
.ab-input--static { display: flex; align-items: center; gap: var(--space-1); background: var(--surface-sunk); color: var(--ink); }

/* Segmented switch (e.g. Departments: tree / list). */
.ab-seg { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-sunk); }
.ab-seg__btn {
    display: inline-flex; align-items: center; gap: var(--space-1); height: 28px; padding: 0 var(--space-3);
    border-radius: calc(var(--radius-md) - 2px); color: var(--ink-muted); font: 600 13px/20px var(--font-sans); text-decoration: none;
}
.ab-seg__btn:hover { color: var(--ink); }
.ab-seg__btn.is-active { background: var(--surface); color: var(--brand); box-shadow: 0 1px 2px rgba(23, 32, 30, .12); }
@media (prefers-reduced-motion: reduce) { .ab-tt__toggle .bi { transition: none; } }

/* ---------- Audit log ---------- */
.ab-audit td { vertical-align: top; padding-top: var(--space-2); padding-bottom: var(--space-2); height: auto; }
.ab-audit__changes { list-style: none; margin: 0; padding: 0; font-size: 13px; line-height: 20px; }
.ab-audit__field { color: var(--ink-muted); font-weight: 600; margin-inline-end: var(--space-1); }
.ab-audit__field::after { content: ":"; }
.ab-audit__old { color: var(--danger); text-decoration: line-through; text-decoration-thickness: 1px; }
.ab-audit__new { color: var(--success); }
.ab-audit details summary { cursor: pointer; color: var(--brand); font-size: 13px; }

/* ---------- Login (signed-out layout): brand panel + form panel ---------- */
.ab-login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); background: var(--page); }
/* The form comes first where the reader starts (right in Arabic); the brand panel sits beside it.
   In the markup the brand panel stays first so it is on top on small screens. */
.ab-login__brand { order: 2; }
.ab-login__main { order: 1; }

.ab-login__brand {
    position: relative; overflow: hidden; display: grid; place-items: center;
    padding: var(--space-8); color: #fff;
    background:
        radial-gradient(900px 520px at 80% 12%, rgba(232, 177, 58, .16), transparent 60%),
        radial-gradient(700px 500px at 10% 95%, rgba(255, 255, 255, .07), transparent 60%),
        linear-gradient(155deg, #11736c 0%, #0d5c57 42%, #063532 100%);
}
/* Quiet geometric pattern (eight-point stars), like a tiled wall. */
.ab-login__brand::before {
    content: ""; position: absolute; inset: 0; opacity: .08;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='1'%3E%3Crect x='22' y='22' width='28' height='28'/%3E%3Crect x='22' y='22' width='28' height='28' transform='rotate(45 36 36)'/%3E%3Ccircle cx='0' cy='0' r='3'/%3E%3Ccircle cx='72' cy='0' r='3'/%3E%3Ccircle cx='0' cy='72' r='3'/%3E%3Ccircle cx='72' cy='72' r='3'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 72px 72px;
}
/* Thin gold line along the inner edge. */
.ab-login__brand::after {
    content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px;
    background: linear-gradient(180deg, transparent, var(--mark-gold), transparent);
    opacity: .7;
}
.ab-login__brand-inner { position: relative; max-width: 380px; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); text-align: center; }
.ab-login__mark {
    width: 112px; height: 112px; border-radius: 28px; margin-bottom: var(--space-4);
    display: grid; place-items: center; background: rgba(255, 255, 255, .97);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .28), 0 0 0 8px rgba(255, 255, 255, .08);
}
.ab-login__mark img { width: 76px; height: 76px; }
.ab-login__name { font: 800 42px/56px var(--font-sans); }
.ab-login__tagline { font: 400 16px/26px var(--font-sans); color: rgba(255, 255, 255, .82); }
.ab-login__points { list-style: none; padding: 0; margin: var(--space-6) 0 0; width: 100%; display: flex; flex-direction: column; gap: var(--space-2); text-align: start; }
.ab-login__points li {
    display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md); background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12);
    font-size: 14px; color: rgba(255, 255, 255, .92);
}
.ab-login__points .bi { color: var(--mark-gold); font-size: 17px; }

.ab-login__main { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--space-8) var(--space-6); }
.ab-login__lang { position: absolute; top: var(--space-4); inset-inline-end: var(--space-4); }
.ab-login__panel { width: 100%; max-width: 400px; }
.ab-login__head { margin-bottom: var(--space-6); }
.ab-login__title { font: 800 30px/42px var(--font-sans); color: var(--brand); margin: 0; }
.ab-login__sub { margin: var(--space-1) 0 0; color: var(--ink-muted); font-size: 15px; }
.ab-login__caps { font: 600 12px/18px var(--font-sans); color: var(--warning); }
.ab-login__foot { position: absolute; bottom: var(--space-4); font-size: 12px; color: var(--ink-muted); }

/* Larger controls and fields with a leading icon (used on the login screen). */
.ab-input--lg { height: 48px; font-size: 15px; border-radius: var(--radius-lg); }
.ab-input--lg:focus { box-shadow: 0 0 0 3px var(--brand-soft); }
.ab-btn--lg { min-height: 48px; font-size: 15px; font-weight: 700; border-radius: var(--radius-lg); }
.ab-iconfield { position: relative; }
/* Same padding on both sides: the input may be dir="ltr" inside an RTL page. */
.ab-iconfield .ab-input { padding-left: 44px; padding-right: 44px; }
.ab-iconfield__icon {
    position: absolute; inset-block: 0; inset-inline-start: 0; width: 44px;
    display: grid; place-items: center; color: var(--ink-muted); font-size: 17px; pointer-events: none;
}
.ab-iconfield:focus-within .ab-iconfield__icon { color: var(--brand); }
.ab-iconfield .ab-pass__toggle { width: 44px; }

@media (max-width: 900px) {
    .ab-login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .ab-login__brand { order: 0; }
    .ab-login__brand { padding: var(--space-6) var(--space-4); }
    .ab-login__brand::after { inset-block: auto 0; inset-inline: 0; width: auto; height: 3px; background: linear-gradient(90deg, transparent, var(--mark-gold), transparent); }
    .ab-login__mark { width: 64px; height: 64px; border-radius: 16px; margin-bottom: 0; }
    .ab-login__mark img { width: 44px; height: 44px; }
    .ab-login__name { font-size: 28px; line-height: 38px; }
    .ab-login__points { display: none; }
    .ab-login__main { justify-content: flex-start; padding: var(--space-8) var(--space-4); }
    .ab-login__foot { position: static; margin-top: var(--space-8); }
}

/* Journal entry lines grid (D-025). */
.ab-jl td { padding: 4px 6px; vertical-align: middle; }
.ab-jl .ab-input, .ab-jl .ab-select { height: 32px; padding: 4px 8px; min-width: 0; width: 100%; }
.ab-jl__no { width: 36px; color: var(--ink-muted); text-align: center; }
.ab-jl__account { min-width: 240px; }
.ab-jl__amount { width: 130px; }
.ab-jl__amount .ab-input { text-align: right; }
.ab-jl__cur { width: 90px; }
.ab-jl__rate { width: 110px; }
.ab-jl__party { min-width: 190px; }
.ab-jl__cc { min-width: 160px; }
.ab-jl tfoot td { border-top: 2px solid var(--line-strong); padding-top: var(--space-2); }
.ab-jl .is-required:not(:disabled) { border-color: var(--warning); }
.ab-jl .is-invalid { border-color: var(--danger); }
.ab-jl .ab-input:disabled, .ab-jl .ab-select:disabled { background: var(--surface-sunk); }

/* Search-as-you-type list under an input. */
.ab-ac { position: relative; }
.ab-ac__list {
    position: absolute; z-index: 30; inset-inline-start: 0; top: calc(100% + 2px); min-width: 100%; max-width: 420px; max-height: 280px;
    overflow-y: auto; margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius-md); box-shadow: 0 6px 18px rgba(23, 32, 30, .14);
}
.ab-ac__list li { padding: 6px 8px; border-radius: calc(var(--radius-md) - 2px); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab-ac__list li.is-active, .ab-ac__list li:hover { background: var(--brand-soft); }
.ab-ac__code { color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.ab-ac__list .ab-ac__empty { color: var(--ink-muted); cursor: default; background: none; }
/* Inside a scrolling table the list floats over the page (placed by script) so the table does not cut it off. */
.ab-ac__list.ab-ac__list--float { position: fixed; z-index: 1060; inset-inline-start: auto; }

/* Journal workflow panel (D-026). */
.ab-jw__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-2) var(--space-4); margin: 0 0 var(--space-3); }
.ab-jw__facts dt { font: 600 12px/18px var(--font-sans); color: var(--ink-muted); }
.ab-jw__facts dd { margin: 0; }

/* Posting readiness (D-028). */
.ab-jw__ready { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); list-style: none; margin: 0 0 var(--space-3); padding: 0; }
.ab-jw__ready li { display: inline-flex; align-items: center; gap: 6px; }
.ab-jw__ready .is-ok .bi { color: var(--success); }
.ab-jw__ready .is-missing .bi { color: var(--danger); }
.ab-jw__ready .is-skip { color: var(--ink-muted); }

/* Reports (D-029). */
.ab-report td, .ab-report th { white-space: nowrap; }
.ab-report td:nth-child(3) { white-space: normal; }
.ab-report__opening td { background: var(--surface-sunk); font-weight: 600; }
.ab-report tfoot td { border-top: 2px solid var(--line-strong); }
.ab-tb tr.is-group td { font-weight: 600; }
.ab-tb td a { color: inherit; text-decoration: none; }
.ab-tb td a:hover { color: var(--primary); text-decoration: underline; }
@media print { .ab-tb td a { text-decoration: none; } }
.ab-print-only { display: none; }

@media print {
    .ab-side, .ab-top, .ab-noprint, .ab-banner, .ab-alert, .ab-crumbs, #abDeleteDialog, #abConfirmDialog { display: none !important; }
    .ab-app, .ab-main { display: block !important; margin: 0 !important; padding: 0 !important; }
    .ab-print-only { display: block; }
    .ab-card { box-shadow: none !important; border: 0 !important; }
    .ab-table-wrap { overflow: visible !important; }
    .ab-report { font-size: 11px; }
    .ab-report a { color: inherit; text-decoration: none; }
    body { background: #fff !important; }
}

/* ---------- Printed voucher (1.8) ---------- */
.ab-voucher { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 24px; max-width: 1000px; margin-inline: auto; }
.ab-voucher__head { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: start; border-bottom: 2px solid var(--ink); padding-bottom: 12px; }
.ab-voucher__company { font-size: 1.15rem; font-weight: 700; }
.ab-voucher__title { text-align: center; }
.ab-voucher__title h1 { font-size: 1.3rem; margin: 0; }
.ab-voucher__draft { color: var(--danger); font-weight: 700; margin-top: 4px; }
.ab-voucher__meta { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; justify-self: end; }
.ab-voucher__meta dt { color: var(--ink-muted); font-weight: 400; }
.ab-voucher__meta dd { margin: 0; font-weight: 600; }
.ab-voucher__desc { margin: 14px 0; }
.ab-voucher__table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.ab-voucher__table th, .ab-voucher__table td { border: 1px solid var(--line-strong, #999); padding: 6px 8px; vertical-align: top; }
.ab-voucher__table thead th { background: var(--surface-sunk); font-weight: 600; }
.ab-voucher__table tfoot th, .ab-voucher__table tfoot td { font-weight: 700; background: var(--surface-sunk); }
.ab-voucher__words { margin: 12px 0 28px; font-weight: 600; border: 1px dashed var(--line-strong, #999); padding: 8px 10px; }
.ab-voucher__signs { display: grid; grid-template-columns: repeat(var(--ab-signs, 5), 1fr); gap: 12px; }
.ab-voucher__signs > div { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--ink); padding-top: 6px; min-height: 80px; }
.ab-voucher__signs span { color: var(--ink-muted); font-size: .85rem; }
.ab-voucher__signs small { color: var(--ink-muted); }
.ab-voucher__foot { margin-top: 20px; font-size: .8rem; }
@media (max-width: 700px) {
    .ab-voucher__head { grid-template-columns: 1fr; }
    .ab-voucher__meta { justify-self: start; }
    .ab-voucher__signs { grid-template-columns: repeat(2, 1fr); }
}
@media print {
    @page { margin: 12mm; }
    .ab-voucher { border: 0; padding: 0; max-width: none; }
    .ab-voucher__table thead th, .ab-voucher__table tfoot th, .ab-voucher__table tfoot td { background: #f2f2f2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Licensee on printed pages (D-042) ---------- */
@media print { .ab-print-licensee { margin-top: 16px; font-size: 11px; color: #555; text-align: center; } }
/* ---------- Bank reconciliation (D-043) ---------- */
.ab-recsum { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 24px; margin: 16px 0 0; }
.ab-recsum > div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dotted var(--line); padding: 4px 0; }
.ab-recsum dt { font-weight: 500; color: var(--ink-muted); }
.ab-recsum dd { margin: 0; font-variant-numeric: tabular-nums; }
.ab-recsum .is-total dt, .ab-recsum .is-total dd { font-weight: 700; color: var(--ink); }
.ab-recsum .is-muted { opacity: .8; }
.ab-rec__tick { width: 36px; text-align: center; }
.ab-rec tr.is-ticked td { background: var(--brand-soft); }
/* ---------- Budgets (D-041) ---------- */
.ab-text-danger { color: var(--danger); font-weight: 600; }
/* ---------- User manual (D-040) ---------- */
.ab-doc { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.ab-doc__nav { position: sticky; top: 72px; }
.ab-doc__nav ul { list-style: none; margin: 8px 0 0; padding: 0; }
.ab-doc__nav li a { display: block; padding: 6px 10px; border-radius: var(--radius-md); color: var(--ink); text-decoration: none; }
.ab-doc__nav li a:hover { background: var(--surface-sunk); }
.ab-doc__nav li a.is-active { background: var(--brand-soft); font-weight: 600; }
.ab-doc__home { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; text-decoration: none; }
.ab-doc__page { line-height: 1.85; max-width: 900px; }
.ab-doc__title { font: 700 24px/1.4 var(--font-sans); margin: 0 0 12px; }
.ab-doc__page h2 { font-size: 19px; margin: 22px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.ab-doc__page h3 { font-size: 16px; margin: 16px 0 6px; }
.ab-doc__page h4 { font-size: 15px; margin: 12px 0 4px; }
.ab-doc__page ul, .ab-doc__page ol { padding-inline-start: 22px; }
.ab-doc__page li { margin: 3px 0; }
.ab-doc__page code { background: var(--surface-sunk); padding: 1px 5px; border-radius: 4px; direction: ltr; unicode-bidi: isolate; }
.ab-doc__note { border-inline-start: 4px solid var(--info); background: var(--info-soft); padding: 8px 12px; border-radius: var(--radius-md); margin: 10px 0; }
.ab-doc__shot { border: 2px dashed var(--line-strong); color: var(--ink-muted); padding: 18px; border-radius: var(--radius-md); text-align: center; margin: 10px 0; }
.ab-doc__table td, .ab-doc__table th { white-space: normal; vertical-align: top; }
.ab-doc__groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); align-items: start; }
.ab-doc__list { list-style: none; margin: 0; padding: 8px 16px 14px; }
.ab-doc__list li { padding: 4px 0; }
@media (max-width: 900px) { .ab-doc { grid-template-columns: 1fr; } .ab-doc__nav { position: static; } }
@media print { .ab-doc { display: block; } .ab-doc__shot { display: none; } }
/* ---------- Voucher print (D-038) ---------- */
.ab-voucher__amount { display: flex; justify-content: flex-end; align-items: baseline; gap: 10px; margin: 8px 0 12px; }
.ab-voucher__amount strong { font-size: 1.25rem; border: 2px solid var(--ink); padding: 4px 14px; border-radius: 6px; }
.ab-voucher__fields { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0 0 16px; }
.ab-voucher__fields dt { color: var(--ink-muted); font-weight: 600; }
.ab-voucher__fields dd { margin: 0; border-bottom: 1px dotted var(--line); padding-bottom: 4px; }
/* ---------- Statement lines (D-037) ---------- */
.ab-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-sunk); font-size: 12.5px; line-height: 20px; max-width: 100%; }
.ab-chip__remove { border: 0; background: none; padding: 0 0 0 2px; color: var(--ink-muted); cursor: pointer; line-height: 1; }
.ab-chip__remove:hover { color: var(--danger, #b42318); }
.ab-layout__accounts { display: flex; flex-wrap: wrap; gap: 4px; }
.ab-layout tr.is-section td { font-weight: 700; background: var(--surface-sunk); }
.ab-layout tr.is-group td:first-child { font-weight: 600; }
/* ---------- Column chooser on lists (albyan.js: initColumnPickers) ---------- */
.ab-col-off { display: none !important; }
.ab-colbar { display: flex; justify-content: flex-end; padding: var(--space-2) var(--space-3) 0; }
.ab-colbar__menu { min-width: 220px; max-height: 60vh; overflow-y: auto; padding: var(--space-2) var(--space-3); }
.ab-colbar__menu .ab-check { display: flex; align-items: center; gap: 8px; padding: 4px 0; white-space: nowrap; }
.ab-colbar__all { width: 100%; margin-top: var(--space-2); }.ab-colsize { position: absolute; top: 0; bottom: 0; inset-inline-end: 0; width: 7px; cursor: col-resize; z-index: 3; touch-action: none; }
.ab-colsize::after { content: ""; position: absolute; top: 20%; bottom: 20%; inset-inline-end: 0; width: 2px; border-radius: 1px; background: transparent; }
.ab-table th:hover > .ab-colsize::after { background: var(--line); }
.ab-colsize:hover::after, .ab-colsize.is-active::after { background: var(--brand); }
.ab-table.is-resized th, .ab-table.is-resized td { overflow: hidden; text-overflow: ellipsis; }
body.ab-col-resizing { cursor: col-resize; user-select: none; }
/* ---------- Lists: fixed header inside a scroll area, centered heading labels ---------- */
.ab-table-wrap--sticky { max-height: calc(100vh - 220px); overflow: auto; overscroll-behavior: contain; }
.ab-table-wrap--sticky thead th { z-index: 2; }
.ab-table[data-ab-columns] thead th { text-align: center !important; }
@media print {
    .ab-table-wrap--sticky { max-height: none !important; overflow: visible !important; }
}
/* ---------- Lists wait for their column setup (albyan.js) behind a spinner; shown anyway after 6 s ---------- */
table[data-ab-columns]:not(.ab-cols-ready) { visibility: hidden; animation: ab-cols-failsafe 0s linear 6s forwards; }
@keyframes ab-cols-failsafe { to { visibility: visible; } }
.ab-table-wrap:has(> table[data-ab-columns]:not(.ab-cols-ready)) { position: relative; min-height: 96px; }
.ab-table-wrap:has(> table[data-ab-columns]:not(.ab-cols-ready))::after {
    content: ""; position: absolute; top: 32px; left: 50%; width: 32px; height: 32px; margin-left: -16px;
    border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: ab-spin .8s linear infinite;
}
@keyframes ab-spin { to { transform: rotate(360deg); } }
.ab-btn.is-busy { cursor: progress; opacity: .85; pointer-events: none; }
/* ---------- Search box (ab-lookup.js): clear button and the chosen item ---------- */
[data-ab-lookup] > input[type="text"] { padding-inline-end: 32px; }
.ab-ac__clear { position: absolute; inset-inline-end: 6px; bottom: 6px; width: 24px; height: 24px; display: grid; place-items: center;
    border: 0; border-radius: 50%; background: none; color: var(--ink-muted); cursor: pointer; font-size: 12px; }
.ab-ac__clear:hover { background: var(--surface-sunk); color: var(--danger); }
.ab-ac__clear[hidden] { display: none; }
.ab-ac__list li.is-chosen { font-weight: 600; }
/* ---------- Financial statements (D-036) ---------- */
.ab-statement .ab-statement__section td { background: var(--surface-sunk); font-weight: 700; padding-top: var(--space-3); }
.ab-statement .ab-statement__total td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.ab-statement tr.is-group td { font-weight: 600; }
.ab-statement tfoot td { font-weight: 700; border-top: 2px solid var(--ink); }
/* Stock documents (D-057): issues and transfers are costed when posted, so their drafts have no price column. */
.sl-unpriced .sl-price,
.sl-unpriced td:has(> [data-field="Price"]) { display: none; }

/* D-076: cost and purchase price cells on screens built by scripts (tables use ab-cost / ab-pprice headings, see albyan.js). */
.ab-no-cost .ab-cost-cell,
.ab-no-pprice .ab-pprice-cell { display: none !important; }

/* D-077: home screen: what needs attention, quick actions. */
.ab-attn__list { list-style: none; margin: 0; padding: 0 16px 8px; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); column-gap: 24px; }
.ab-attn__item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.ab-attn__item:hover .ab-attn__text { text-decoration: underline; }
.ab-attn__icon { color: var(--ink-muted); }
.ab-attn__text { flex: 1; min-width: 0; }
.ab-quick { flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }

/* D-078: notes on documents. */
.ab-notes__list { list-style: none; margin: 0 0 12px; padding: 0; }
.ab-notes__item { padding: 8px 0; border-top: 1px solid var(--line); }
.ab-notes__item:first-child { border-top: 0; }
.ab-notes__head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ab-notes__tools { margin-inline-start: auto; display: flex; gap: 4px; }
.ab-notes__text { white-space: pre-wrap; margin-top: 2px; }
.ab-notes__mention { color: var(--brand); font-weight: 600; }
.ab-notes__new { position: relative; }
.ab-notes__people { position: absolute; inset-inline-start: 0; z-index: 20; min-width: 240px; max-height: 220px; overflow: auto; margin: 2px 0 0; padding: 4px 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.ab-notes__people li { padding: 6px 12px; cursor: pointer; }
.ab-notes__people li:hover, .ab-notes__people li.is-active { background: var(--surface-hover); }

/* D-078: inbox bell and list. */
.ab-bell { position: relative; }
.ab-bell__count { position: absolute; top: -2px; inset-inline-end: -2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.ab-inbox { list-style: none; margin: 0; padding: 0; }
.ab-inbox__item { border-top: 1px solid var(--line); }
.ab-inbox__item:first-child { border-top: 0; }
.ab-inbox__open { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 12px 16px; background: none; border: 0; text-align: start; color: var(--ink); font: inherit; cursor: pointer; }
.ab-inbox__open:hover { background: var(--surface-hover); }
.ab-inbox__item.is-unread .ab-inbox__open { background: var(--brand-soft); }
.ab-inbox__icon { color: var(--ink-muted); margin-top: 3px; }
.ab-inbox__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ab-inbox__text { white-space: pre-wrap; overflow-wrap: anywhere; }
.ab-inbox__when { white-space: nowrap; font-size: 12px; }

/* Owner dashboard (D-084) */
.ab-owner-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
.ab-owner-card { display: flex; flex-direction: column; gap: 2px; padding: var(--space-3) var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--ink); text-decoration: none; }
.ab-owner-card:hover { background: var(--surface-hover); color: var(--ink); }
.ab-owner-card strong { font-size: 22px; font-weight: 600; line-height: 1.3; font-variant-numeric: tabular-nums; }
.ab-owner-card small { font-size: 14px; font-weight: 400; }
.ab-owner-card > span:last-child { font-size: 12px; }
.ab-owner-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: var(--space-4); }
.ab-owner-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline: 8px 4px; vertical-align: -1px; }
@media (max-width: 900px) { .ab-owner-grid { grid-template-columns: minmax(0, 1fr); } }
@media print { .ab-owner-grid { grid-template-columns: minmax(0, 1fr); } .ab-owner-card { break-inside: avoid; } }
.ab-owner-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--space-4); margin-top: var(--space-4); }
.ab-owner-meter { height: 6px; background: var(--surface-sunk); border-radius: 3px; overflow: hidden; margin: 4px 0; }
.ab-owner-meter > span { display: block; height: 100%; background: var(--brand); border-radius: 3px; }
.ab-owner-meter > span.is-over { background: var(--danger); }

/* D-101: organization logo. In the context bar it takes the place of the building icon, inside the bar's own height. */
.ab-ctx__logo { height: 22px; width: auto; max-width: 72px; object-fit: contain; border-radius: 3px; flex: none; }
.ab-login__org { display: block; max-height: 72px; max-width: 220px; object-fit: contain; margin: 0 auto var(--space-4); }
.ab-logo-preview { max-height: 80px; max-width: 240px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; padding: 6px; background: #fff; }
.ab-voucher__logo { display: block; max-height: 56px; max-width: 180px; object-fit: contain; margin-bottom: 6px; }
.ab-print-logo { max-height: 56px; max-width: 180px; object-fit: contain; margin-bottom: 8px; }
