/* ==========================================================================
   Saudi ERP — foundation stylesheet (R0a)
   --------------------------------------------------------------------------
   No build step. No Node, no npm, no Vite. Served directly from public/css.
   R0b decision: the tenant shell is server-rendered Blade on this plain
   stylesheet; no front-end toolchain was needed, so none was added.

   TWO RULES, both enforced by a test:
   1. LOGICAL PROPERTIES ONLY. Never margin-left / padding-right /
      text-align: left / border-left / left: / right:. Use the inline-start
      and inline-end forms. R0b's Arabic RTL then needs dir="rtl" and a font,
      not a re-layout.
   2. Every colour, space and size is a custom property on :root, so the
      Tailwind theme inherits these values instead of discarding them.
   ========================================================================== */

/* --- typefaces (R0b.1) ----------------------------------------------------
   IBM Plex Sans Arabic with its Latin companion IBM Plex Sans, SELF-HOSTED
   from public/fonts/ibm-plex (see PROVENANCE.md there: official IBM Plex
   packages, SIL OFL 1.1). No third-party font request at runtime (the CSP
   allows fonts from 'self' only) and no reliance on a font installed on the
   user's machine. The Arabic faces carry an Arabic-only unicode-range, so
   Latin letters and digits always come from IBM Plex Sans in BOTH
   languages -- one consistent Latin -- and an English page downloads the
   Arabic file only when Arabic text is actually on it. Weights: 400, 600,
   700 (bold, headings and table headers). */
@font-face {
    font-family: "IBM Plex Sans Arabic";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/ibm-plex/IBMPlexSansArabic-Regular.woff2") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

@font-face {
    font-family: "IBM Plex Sans Arabic";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/ibm-plex/IBMPlexSansArabic-SemiBold.woff2") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

@font-face {
    font-family: "IBM Plex Sans Arabic";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/ibm-plex/IBMPlexSansArabic-Bold.woff2") format("woff2");
    unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/ibm-plex/IBMPlexSans-Regular.woff2") format("woff2");
}

@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/ibm-plex/IBMPlexSans-SemiBold.woff2") format("woff2");
}

@font-face {
    font-family: "IBM Plex Sans";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/ibm-plex/IBMPlexSans-Bold.woff2") format("woff2");
}

:root {
    --font-sans: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-arabic: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, "Segoe UI", sans-serif;

    /* 2026-10-26 palette: light grey-green page, white surfaces, deep teal
       header, teal actions and selected states, pale mint hover. */
    --color-bg: #eef3f1;
    --color-surface: #ffffff;
    --color-sidebar-bg: #eef3f1;
    --color-border: #d3dfdb;
    --color-border-strong: #a9c0ba;
    --color-native-control-border: #767676;
    --color-text: #172327;
    --color-muted: #536664;
    --color-accent: #0f6d63;
    --color-accent-strong: #0b564f;
    --color-accent-text: #ffffff;
    --color-hover: #e0f0ea;
    --color-header-bg: #0c3a35;
    --color-header-text: #eef7f4;
    --color-header-muted: #a3cbc1;
    --color-header-border: rgb(255 255 255 / 0.24);
    --color-header-hover: rgb(255 255 255 / 0.12);
    --color-header-pill: #d6eee7;
    --color-header-pill-text: #0c3a35;
    --color-header-focus: #8fe0cf;
    --color-scroll-thumb: #9fc2b9;
    --color-scroll-thumb-hover: #5d8c81;
    --shadow-overlay: 0 0.5rem 2rem rgb(9 40 36 / 0.18);
    /* 2026-10-26 refinement: the current sidebar item, the page surface,
       secondary buttons and the styled list options. */
    --color-nav-current-bg: #ffffff;
    --shadow-nav-current: 0 1px 2px rgb(12 58 53 / 0.12), 0 0 0 1px rgb(12 58 53 / 0.05);
    --shadow-surface: 0 1px 2px rgb(12 58 53 / 0.05);
    --color-secondary-bg: #dbe8e4;
    --color-secondary-text: #0b4f48;
    --color-secondary-hover-bg: #0c4a43;
    --color-secondary-hover-text: #ffffff;
    --color-option-hover: #e4f1ed;
    --color-option-selected: #d5eae4;
    --color-option-text: #0b4f48;
    --color-danger: #a4282b;
    --color-warning-bg: #fff6e5;
    --color-warning-border: #e0b15c;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;

    --radius: 6px;
    --radius-nav: 8px;
    --radius-surface: 12px;
    --measure: 34rem;
    /* Comfortable widths inside the full-width page surface. */
    --measure-text: 46rem;
    /* Pass 3: one slightly slower, smooth ease-out for the sidebar width only. */
    --ease-shell: cubic-bezier(0.22, 0.61, 0.36, 1);
    --shell-motion: 300ms;

    /* Control heights (R0b.1): buttons, pills and text inputs share them. */
    --control-height-sm: 2rem;
    --control-height-md: 2.5rem;
    --control-height-lg: 2.875rem;
}

/* Larger touch targets where the pointer is a finger. */
@media (pointer: coarse) {
    :root {
        --control-height-sm: 2.25rem;
        --control-height-md: 2.75rem;
        --control-height-lg: 3rem;
    }
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-bg: #0e1715;
        --color-surface: #15211e;
        --color-sidebar-bg: #0e1715;
        --color-border: #2a3b37;
        --color-border-strong: #4a625c;
        --color-native-control-border: #858585;
        --color-text: #e3eeeb;
        --color-muted: #9cb3ad;
        --color-accent: #4db3a2;
        --color-accent-strong: #6cc6b6;
        --color-accent-text: #08201c;
        --color-hover: #1c302c;
        --color-header-bg: #0a2420;
        --color-header-text: #e3eeeb;
        --color-header-muted: #8fb8ae;
        --color-header-border: rgb(255 255 255 / 0.18);
        --color-header-hover: rgb(255 255 255 / 0.08);
        --color-header-pill: #bfe3d9;
        --color-header-pill-text: #0a2420;
        --color-header-focus: #8fe0cf;
        --color-scroll-thumb: #3f5c56;
        --color-scroll-thumb-hover: #6f978d;
        --shadow-overlay: 0 0.5rem 2rem rgb(0 0 0 / 0.5);
        --color-nav-current-bg: #1b2a27;
        --shadow-nav-current: 0 0 0 1px #2f4540;
        --shadow-surface: 0 0 0 1px #1d2b28;
        --color-secondary-bg: #1f3531;
        --color-secondary-text: #a8e3d6;
        --color-secondary-hover-bg: #4db3a2;
        --color-secondary-hover-text: #08201c;
        --color-option-hover: #1c302c;
        --color-option-selected: #22403a;
        --color-option-text: #b4ece0;
        --color-danger: #e2797b;
        --color-warning-bg: #2a2317;
        --color-warning-border: #6d5628;
    }
}

/* I14 browser walk: a link left at the browser's default colours (blue, and
   purple once visited) is below 2:1 on the dark surfaces, so in the dark
   scheme every plain link takes the accent colour, visited or not. Zero
   specificity: every component rule still wins, and the light scheme keeps
   the browser defaults (above 8:1). */
@media (prefers-color-scheme: dark) {
    :where(:root:not([data-theme="light"]) a:not(.button)) { color: var(--color-accent); }
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 100%; }

body {
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    line-height: 1.55;
    -webkit-text-size-adjust: 100%;
}

/* Arabic pages: same families, Arabic first; a modestly taller line height
   keeps the script clear without making otherwise viewport-sized screens
   overflow only because their interface language changed. */
[lang="ar"] body, body[lang="ar"] { font-family: var(--font-arabic); line-height: 1.6; }

/* Form controls do not inherit the page font by default in every browser. */
button, input, select, textarea { font-family: inherit; }

.page {
    min-block-size: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-inline: var(--space-4);
    padding-block: var(--space-8);
}

.card {
    inline-size: 100%;
    max-inline-size: var(--measure);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--space-8);
    text-align: start;
}

.eyebrow {
    margin: 0 0 var(--space-2);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-muted);
}

h1 { margin: 0 0 var(--space-3); font-size: 1.5rem; line-height: 1.25; }

p { margin: 0 0 var(--space-4); color: var(--color-muted); }
p:last-child { margin-block-end: 0; }

.host-badge {
    display: inline-block;
    padding-inline: var(--space-3);
    padding-block: var(--space-1);
    border-radius: 999px;
    background: var(--color-accent);
    color: var(--color-accent-text);
    font-size: 0.8125rem;
    font-weight: 600;
}

.meta {
    margin-block-start: var(--space-6);
    padding-block-start: var(--space-4);
    border-block-start: 1px solid var(--color-border);
    font-size: 0.875rem;
    color: var(--color-muted);
}

.meta dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: var(--space-2) var(--space-4); }
.meta dt { font-weight: 600; color: var(--color-text); }
.meta dd { margin: 0; }

.notice {
    margin-block-start: var(--space-6);
    padding: var(--space-3) var(--space-4);
    background: var(--color-warning-bg);
    border: 1px solid var(--color-warning-border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--color-text);
}

code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.9em; }

@media (max-width: 30rem) {
    .card { padding: var(--space-6) var(--space-4); }
    .meta dl { grid-template-columns: 1fr; gap: var(--space-1); }
}

/* ==========================================================================
   Authentication screens (increment 2)
   Logical properties only, same rule as the rest of this file: R0b's Arabic
   RTL must be a dir switch, not a re-layout.
   ========================================================================== */

.field { margin-block-end: var(--space-4); }

.field label {
    display: block;
    margin-block-end: var(--space-1);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text);
}

.field input[type="text"],
.field input[type="search"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="password"],
.field input[type="number"],
.field input[type="date"],
.field input[type="month"],
.field textarea,
.table-input {
    inline-size: 100%;
    min-block-size: var(--control-height-md);
    line-height: 1.3;
    padding-block: var(--space-1);
    padding-inline: var(--space-3);
    font: inherit;
    font-size: 1rem;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.field textarea { min-block-size: 5rem; resize: vertical; }
/* Monetary entry (unit prices). The input keeps dir="ltr" for digits, the
   decimal point and the caret; within that direction its end is the right
   edge, so amounts line up on the right in English and Arabic alike. Nothing
   reformats the value while it is typed. */
.money-input, .num-input { text-align: end; font-variant-numeric: tabular-nums; }
/* Quantitative table columns (amounts, quantities, rates, counts): the cell
   and its column heading sit on the RIGHT edge in English and Arabic alike,
   so decimals line up. Values keep their own <bdi dir="ltr">, so digits,
   decimal points and signs stay in left-to-right order. Expressed logically:
   the right edge is the end of an LTR line and the start of an RTL one.
   :dir() follows each cell's own direction, because print documents set
   their own dir (the tenant invoice print is always RTL, the platform print
   always LTR) whatever the page language is.
   Text, dates, identifiers, badges and actions keep the default alignment. */
:is(.list-table, .print-table) :is(th, td).num { text-align: end; }
:is(.list-table, .print-table) :is(th, td).num:dir(rtl) { text-align: start; }
/* Tabular figures on screen only: on an A4 print they widen every amount
   column and push a long line table past the sheet. */
.list-table :is(th, td).num { font-variant-numeric: tabular-nums; }
/* A native date field keeps dir="ltr", so its digits, its segment order and
   its calendar button stay exactly as the browser lays them out. In an Arabic
   page only, the date text sits at the end (right) beside the calendar button
   and under its right-aligned label, instead of floating at the far left. The
   characters are never reversed; picker, keyboard entry and value unchanged. */
html[dir="rtl"] .workspace-shell .field input[type="date"][dir="ltr"] { text-align: end; }
html[dir="rtl"] .workspace-shell .field input[type="date"][dir="ltr"]::-webkit-calendar-picker-indicator { margin-inline-start: var(--space-2); }

.field input:focus-visible,
.field textarea:focus-visible,
.table-input:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 1px;
}

.allocation-amount { inline-size: 100%; }
.allocation-release-cell { min-inline-size: 20rem; }
.allocation-release-form { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.allocation-release-form .table-input { flex: 1 1 12rem; inline-size: auto; min-inline-size: 12rem; }

/* One-time codes read left-to-right even in an RTL page: they are digits, not
   language. `dir="ltr"` on the input is deliberate, not an oversight. */
.field input.code {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    letter-spacing: 0.25em;
    text-align: center;
}

.field .hint {
    margin-block-start: var(--space-1);
    margin-block-end: 0;
    font-size: 0.8125rem;
    color: var(--color-muted);
}

/* --- buttons (R0b.1) --------------------------------------------------------
   ONE height scale for every button, button-styled link and pill control, so
   a header, a page's actions and a form's submit line up whatever element or
   language they use. Default is medium; .button-sm is for dense places (the
   header's Sign out, beside the language pills); .button-lg is available for
   a lone primary action. Heights are MINIMUMS: a long Arabic label on a
   narrow screen wraps and grows instead of overflowing. Touch screens get
   the larger targets automatically. */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    inline-size: 100%;
    min-block-size: var(--control-height-md);
    padding-block: var(--space-1);
    padding-inline: var(--space-4);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.25;
    text-align: center;
    text-decoration: none;
    color: var(--color-accent-text);
    background: var(--color-accent);
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    vertical-align: middle;
}

a.button, a.button:visited { color: var(--color-accent-text); text-decoration: none; }
.button:hover { filter: brightness(0.94); }
.button:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.button:disabled, .button[aria-disabled="true"] { opacity: 0.6; cursor: not-allowed; filter: none; }

.button-sm { min-block-size: var(--control-height-sm); padding-inline: var(--space-3); font-size: 0.875rem; }
.button-lg { min-block-size: var(--control-height-lg); padding-inline: var(--space-6); font-size: 1rem; }

.button.secondary,
a.button.secondary,
a.button.secondary:visited {
    color: var(--color-secondary-text);
    background: var(--color-secondary-bg);
    border-color: transparent;
}
/* Secondary actions (2026-10-26 refinement): pale green-grey with dark teal
   text; dark teal with white text under the pointer. A disabled one keeps
   its resting colours. */
.button.secondary:hover,
a.button.secondary:hover { filter: none; color: var(--color-secondary-hover-text); background: var(--color-secondary-hover-bg); }
.button.secondary:disabled:hover,
.button.secondary[aria-disabled="true"]:hover { color: var(--color-secondary-text); background: var(--color-secondary-bg); }

.button.auto { inline-size: auto; }

.errors {
    margin-block-end: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-danger);
    border-inline-start-width: 4px;
    border-radius: var(--radius);
    color: var(--color-danger);
    font-size: 0.875rem;
}

.errors ul { margin: 0; padding-inline-start: var(--space-4); }

.qr {
    display: flex;
    justify-content: center;
    padding: var(--space-4);
    margin-block-end: var(--space-4);
    background: #ffffff;   /* QR contrast must not follow the theme */
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}

.qr svg { inline-size: 240px; block-size: auto; }
.qr-phase1 { justify-content: flex-start; inline-size: max-content; }
.qr-phase1 svg { inline-size: 180px; }

.secret {
    display: block;
    padding: var(--space-3);
    margin-block-end: var(--space-4);
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 0.9375rem;
    word-break: break-all;
    text-align: center;
    background: var(--color-bg);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
}

.code-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
    margin-block-end: var(--space-4);
    padding: var(--space-4);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 0.9375rem;
    text-align: center;
}

.alt-action {
    margin-block-start: var(--space-4);
    padding-block-start: var(--space-4);
    border-block-start: 1px solid var(--color-border);
    font-size: 0.875rem;
}

.auth-alternatives { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2) var(--space-4); }
.alt-action.auth-alternatives { margin-block-start: var(--space-3); padding-block-start: var(--space-2); }
.auth-alternatives-plain { margin-block-start: var(--space-2); }
.auth-alternatives form { margin: 0; }
.auth-alternatives :is(a, a:visited, button) {
    display: inline-flex;
    align-items: center;
    min-block-size: 2rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--color-accent);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 400;
    text-align: start;
    text-decoration: underline;
    cursor: pointer;
}
@media (max-width: 30rem) {
    .auth-alternatives { align-items: flex-start; flex-direction: column; }
}

.checkbox {
    display: flex;
    gap: var(--space-2);
    align-items: flex-start;
    margin-block-end: var(--space-4);
    font-size: 0.875rem;
}

@media (max-width: 30rem) {
    .code-list { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Tenant onboarding (increment 5)
   Same rule as the rest of this file: logical properties only.
   ========================================================================== */

.page.wide { justify-content: flex-start; }

.card.wide { max-inline-size: 56rem; }

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-block-end: var(--space-6);
}

.toolbar h1 { margin: 0; }

.list-table {
    inline-size: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.list-table th,
.list-table td {
    padding-block: var(--space-3);
    padding-inline: var(--space-2);
    text-align: start;
    border-block-end: 1px solid var(--color-border);
    vertical-align: middle;
}

.list-table th {
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.list-table tbody tr:hover { background: var(--color-bg); }

.empty-state {
    padding: var(--space-6);
    text-align: center;
    color: var(--color-muted);
}

.badge {
    display: inline-block;
    padding-inline: var(--space-2);
    padding-block: 0.125rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    white-space: nowrap;
}

.badge.status-completed,
.badge.status-trial_full,
.badge.status-accepted,
.badge.status-active { background: #e5f3ef; border-color: #bfe0d4; color: #1f6f5c; }
.badge.status-running,
.badge.status-pending { background: #eaf1fb; border-color: #c4d8f2; color: #1f4f9c; }
.badge.status-failed,
.badge.status-suspended,
.badge.status-expired,
.badge.status-cancelled { background: #fbeaea; border-color: #f0c2c3; color: var(--color-danger); }
.badge.status-awaiting_operator,
.badge.status-grace,
.badge.status-read_only,
.badge.status-over-limit,
.badge.status-trial_read_only { background: var(--color-warning-bg); border-color: var(--color-warning-border); color: #7a5a12; }

@media (prefers-color-scheme: dark) {
    .badge.status-completed, .badge.status-trial_full, .badge.status-accepted, .badge.status-active { background: #163127; border-color: #234a3b; color: #7fd2b6; }
    .badge.status-running, .badge.status-pending { background: #16233a; border-color: #24365a; color: #9db8ee; }
    .badge.status-failed, .badge.status-suspended, .badge.status-expired, .badge.status-cancelled { background: #3a1f20; border-color: #5a2e2f; color: #f0a8a9; }
    .badge.status-awaiting_operator, .badge.status-grace, .badge.status-read_only, .badge.status-over-limit, .badge.status-trial_read_only { background: #33291a; border-color: #5a4826; color: #e0b15c; }
}

.field select {
    inline-size: 100%;
    min-block-size: var(--control-height-md);
    line-height: 1.3;
    padding-block: var(--space-1);
    padding-inline: var(--space-3);
    font: inherit;
    font-size: 1rem;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}
/* Before the dropdown script runs, or without it, a select shows the same
   chevron as the styled list instead of the browser's own arrow, in the
   same place: 12px from the end edge, with room for it in the padding. */
:is(.field select, .filters > select, select.table-input):not([multiple], [size]) {
    appearance: none;
    padding-inline-end: 2.5rem;
    background-image: var(--select-chevron-fallback);
    background-repeat: no-repeat;
    background-size: 1rem 1rem;
    background-position: right var(--space-3) center;
}
:is(.field select, .filters > select, select.table-input):not([multiple], [size]):dir(rtl) { background-position: left var(--space-3) center; }

.button.link,
a.button.link:visited {
    display: inline;
    inline-size: auto;
    min-block-size: 0;
    padding: 0;
    font-weight: 600;
    color: var(--color-accent);
    background: transparent;
    border: none;
    text-decoration: none;
}

.steps { list-style: none; margin: 0; padding: 0; }

.steps li {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-block: var(--space-2);
    border-block-end: 1px solid var(--color-border);
    font-size: 0.9375rem;
}

.steps li:last-child { border-block-end: none; }

.steps .mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 1.5rem;
    block-size: 1.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-muted);
}

.steps li.done .mark { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-text); }
.steps li.current .mark { border-color: var(--color-accent); color: var(--color-accent); }
.steps li.current { font-weight: 600; }

.trial-window {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    margin-block-start: var(--space-4);
}

.trial-window .stat {
    padding: var(--space-3);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    text-align: center;
}

.trial-window .stat dt { font-size: 0.75rem; color: var(--color-muted); margin-block-end: var(--space-1); }
.trial-window .stat dd { margin: 0; font-weight: 600; }

@media (max-width: 40rem) {
    .trial-window { grid-template-columns: 1fr; }
    .list-table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ==========================================================================
   R0b — tenant workspace shell, forms, tables and print base.
   Same two rules: logical properties only; values from :root tokens.
   ========================================================================== */

:root {
    --shell-nav-width: 15.875rem;
    --shell-rail-width: 4rem;
    --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.5 9.5 12 15l5.5-5.5'/%3E%3C/svg%3E");
    --icon-chevron-tight: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='5.5 8.5 13 7.5' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.5 9.5 12 15l5.5-5.5'/%3E%3C/svg%3E");
    /* Every dropdown arrow (styled lists, the checkbox filter, and a select
       shown before or without the script) uses this one chevron. */
    --icon-select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6.5 9.5 12 15l5.5-5.5'/%3E%3C/svg%3E");
    --select-chevron-fallback: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23172327' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' stroke-opacity='0.8'%3E%3Cpath d='M6.5 9.5 12 15l5.5-5.5'/%3E%3C/svg%3E");
    --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
    --color-info-bg: #eaf1fb;
    --color-info-border: #c4d8f2;
    --color-success-bg: #e5f3ef;
    --color-success-border: #bfe0d4;
    --color-danger-bg: #fbeaea;
    --color-danger-border: #f0c2c3;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --select-chevron-fallback: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e3eeeb' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' stroke-opacity='0.8'%3E%3Cpath d='M6.5 9.5 12 15l5.5-5.5'/%3E%3C/svg%3E");
        --color-info-bg: #16233a;
        --color-info-border: #2c4670;
        --color-success-bg: #13291f;
        --color-success-border: #24513d;
        --color-danger-bg: #331718;
        --color-danger-border: #6b2c2e;
    }
}

.visually-hidden {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    margin: -1px;
    padding: 0;
    border: 0;
}

.skip-link {
    position: absolute;
    inset-inline-start: var(--space-4);
    inset-block-start: -3rem;
    padding: var(--space-2) var(--space-3);
    background: var(--color-accent);
    color: var(--color-accent-text);
    border-radius: var(--radius);
    z-index: 10;
}
.skip-link:focus { inset-block-start: var(--space-2); }

:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.card-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }

.language-switch { display: inline-flex; gap: var(--space-1); margin: 0; }
.language-option {
    display: inline-flex;
    align-items: center;
    min-block-size: var(--control-height-sm);
    font: inherit;
    font-size: 0.8125rem;
    line-height: 1.2;
    padding: 0 var(--space-3);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
}
.language-option[aria-pressed="true"] { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-text); }

/* --- shell layout (2026-10-26 navigation pass, refined the same day) ---
   One shell for both portals (body class workspace-shell): a deep teal
   header, a sidebar that is pinned (icons and labels) or an icon rail that
   expands over the page on hover or keyboard focus, and independent scroll
   panes for the sidebar and the page. The sidebar and the area around the
   page share the light grey-green background; the page itself sits on one
   white rounded surface (.shell-surface). The pinned/rail choice lives on
   <html data-sidebar>, set before first paint by js/shell-sidebar-state.js
   from the viewer's saved preference. Icons are local SVG masks keyed by
   data-icon, drawn in a fixed 20px slot; they take the text colour in every
   state and theme.

    Sidebar geometry: the pinned navigation track is 254px and the collapsed
    rail is 64px. The expanded rail covers the pinned track plus the 12px
    page gutter, matching the visible pinned sidebar edge. Top-level items
    keep one inline offset in every state so pinning never shifts the icons.
    Pinning animates width; opening a menu animates its height. */
.shell-body {
    min-block-size: 100vh;
    display: flex;
    flex-direction: column;
}

.shell-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-6);
    min-block-size: 3.75rem;
    background: var(--color-header-bg);
    color: var(--color-header-text);
    border-block-end: 1px solid var(--color-header-bg);
}
.shell-header :focus-visible { outline-color: var(--color-header-focus); }
.shell-brand { display: flex; flex-direction: column; min-inline-size: 0; }
.shell-product { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-header-muted); }
.shell-tenant { font-weight: 600; font-size: 1.0625rem; color: var(--color-header-text); }
.shell-tools { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); margin-inline-start: auto; }
.shell-tools form { margin: 0; }
/* Plain links in both workspaces take the teal accent, visited or not (the
   platform rule below predates this; the tenant shell now matches it). */
:where(.tenant-shell-body .shell-main a:not(.button)) { color: var(--color-accent); }
.shell-user, a.shell-user, a.shell-user:visited { font-size: 0.875rem; color: var(--color-header-text); }
.shell-header .language-option { background: transparent; border-color: var(--color-header-border); color: var(--color-header-text); }
.shell-header .language-option:hover { background: var(--color-header-hover); }
.shell-header .language-option[aria-pressed="true"] { background: var(--color-header-pill); border-color: var(--color-header-pill); color: var(--color-header-pill-text); }
.shell-header .button.secondary { background: transparent; border-color: var(--color-header-border); color: var(--color-header-text); }
.shell-header .button.secondary:hover { background: var(--color-header-hover); color: var(--color-header-text); }

/* Square icon controls in the header (pin the sidebar; open the phone menu). */
.shell-icon-control,
[data-shell-menu-toggle] {
    display: none;
    align-items: center;
    justify-content: center;
    flex: none;
    min-inline-size: 2.5rem;
    min-block-size: 2.5rem;
    padding: 0;
    border: 1px solid var(--color-header-border);
    border-radius: var(--radius);
    background: transparent;
    color: var(--color-header-text);
    cursor: pointer;
}
.shell-icon-control:hover,
[data-shell-menu-toggle]:hover { background: var(--color-header-hover); }
.shell-icon,
.shell-nav li[data-icon] > a::before,
.shell-nav li[data-icon] > details > summary::before,
.shell-nav .nav-section > summary::after {
    content: '';
    display: inline-block;
    flex: none;
    inline-size: 1.25rem;
    block-size: 1.25rem;
    background-color: currentColor;
    -webkit-mask: var(--icon) center / contain no-repeat;
    mask: var(--icon) center / contain no-repeat;
}
/* Sidebar icons sit in a fixed 24px slot (glyphs about 18-20px). */
.shell-nav li[data-icon] > a::before,
.shell-nav li[data-icon] > details > summary::before { inline-size: 1.5rem; block-size: 1.5rem; }
/* The sidebar glyph shows the panel on the page's start side. */
.shell-icon[data-icon="sidebar"]:dir(rtl) { transform: scaleX(-1); }
[data-shell-backdrop], [data-shell-nav-heading] { display: none; }

.shell {
    display: grid;
    grid-template-columns: var(--shell-nav-current) minmax(0, 1fr);
    flex: 1;
    min-inline-size: 0;
    min-block-size: 0;
    --shell-nav-current: var(--shell-nav-width);
}

.shell-nav {
    background: var(--color-sidebar-bg);
    padding: var(--space-4) var(--space-3);
}
.shell-nav ul { list-style: none; margin: 0; padding: 0; }
.shell-nav li + li { margin-block-start: var(--space-1); }
.shell-nav a {
    display: block;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-nav);
    color: var(--color-text);
    text-decoration: none;
}
/* Hover: the label and icon turn teal; no fill. */
.shell-nav a:hover { color: var(--color-accent); }
/* The current page: a white (dark theme: lifted) surface, teal text and a
   subtle edge, at every level. */
.shell-nav a[aria-current="page"] { background: var(--color-nav-current-bg); color: var(--color-accent); box-shadow: var(--shadow-nav-current); font-weight: 600; }
.shell-nav :is(a, summary):focus-visible { outline: 2px solid var(--color-accent); outline-offset: -2px; }

/* Top-level entries: icon, label, and for sections a chevron. */
.shell-nav > ul > li > a,
.shell-nav .nav-section > summary {
    display: flex;
    align-items: center;
    gap: 0.8125rem;
    min-block-size: 2.5rem;
    padding-block: var(--space-2);
    padding-inline: 0.5625rem 0;
    font-size: 0.9375rem;
    border-radius: var(--radius-nav);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
}
.shell-nav .nav-section > summary {
    color: var(--color-text);
    cursor: pointer;
    list-style: none;
}
.shell-nav .nav-section > summary::-webkit-details-marker { display: none; }
.shell-nav .nav-section > summary::after {
    --icon: var(--icon-chevron-tight);
    inline-size: 0.5rem;
    block-size: 0.3125rem;
    margin-inline-start: auto;
    opacity: 0.7;
    transition: transform 240ms var(--ease-shell);
}
.shell-nav .nav-section[open]:not(.nav-section-closing) > summary::after { transform: rotate(180deg); }
.shell-nav .nav-section > summary:hover { color: var(--color-accent); }
.shell-nav .nav-section > summary.nav-section-current { color: var(--color-accent); }

/* Section links: indented 12px, so the current link's surface starts under
   the icon and ends exactly at the chevron's edge (the row's end); a small
   bullet just after the icon's centre and the label in line with the
   section label. One line each, so a link never re-wraps while the
   sidebar's width is moving. */
.shell-nav .nav-children { margin-block: 0.125rem var(--space-2); padding: 0; padding-inline-start: var(--space-3); }
.shell-nav .nav-children li + li { margin-block-start: 0.125rem; }
.shell-nav .nav-children a {
    display: flex;
    align-items: center;
    gap: 0.71875rem;
    min-block-size: 2.375rem;
    padding-block: 0.375rem;
    padding-inline: 1.09375rem var(--space-3);
    font-size: 0.9375rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.shell-nav .nav-children a::before {
    content: '';
    flex: none;
    inline-size: 0.3125rem;
    block-size: 0.3125rem;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.45;
}
.shell-nav .nav-children a:hover::before,
.shell-nav .nav-children a[aria-current="page"]::before { opacity: 1; }
/* Count badges sit at the end of their row (before a group's chevron). A
   closed group repeats its children's total; an open one shows the badge
   beside the child itself. */
.shell-nav .nav-badge { margin-inline-start: auto; min-inline-size: 1.25rem; padding-inline: 0.375rem; text-align: center; }
.shell-nav .nav-section > summary:has(.nav-section-badge)::after { margin-inline-start: 0; }
.shell-nav .nav-section[open] > summary .nav-section-badge { display: none; }
.shell-nav .nav-section[open] > summary:has(.nav-section-badge)::after { margin-inline-start: auto; }

/* The navigation script animates each group's height while keeping native
   details semantics. The sidebar's pin/rail transition remains independent. */

/* The page area: the same grey-green as the sidebar around one white
   rounded surface that holds the page. A long menu scrolls inside the
   sidebar and a long page inside the main pane; the header stays in place.
   The main pane fills its whole grid track, so its scrollbar sits at the
   viewport edge (right in English, left in Arabic). */
.workspace-shell { block-size: 100dvh; min-block-size: 0; overflow: hidden; }
.workspace-shell .shell { overflow: hidden; }
.workspace-shell .shell-nav,
.workspace-shell .shell-main { min-block-size: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.workspace-shell .shell-nav { overflow-x: hidden; }
.workspace-shell .shell-main {
    max-inline-size: none;
    padding-block: var(--space-4);
    padding-inline: var(--space-3) var(--space-4);
}
.shell-surface {
    min-block-size: 100%;
    padding: var(--space-6) var(--space-8) var(--space-8);
    background: var(--color-surface);
    border-radius: var(--radius-surface);
    box-shadow: var(--shadow-surface);
}
/* Scrollbars: nothing at rest, a soft secondary thumb while the pane is
   hovered or holds keyboard focus, darker while the pointer is on the
   scrollbar itself (the script sets shell-scrollbar-hover). The gutter is
   reserved, so nothing moves when the thumb appears. The standard properties
   come first: Chromium 121+ repaints them when the pane's state changes but
   never re-styles its ::-webkit-scrollbar parts on pane hover (measured), so
   those parts are only the fallback for engines without scrollbar-color. */
@supports (scrollbar-color: auto) {
    .workspace-shell :is(.shell-nav, .shell-main) { scrollbar-width: thin; scrollbar-color: transparent transparent; }
    .workspace-shell :is(.shell-nav, .shell-main):is(:hover, :focus-within) { scrollbar-color: var(--color-scroll-thumb) transparent; }
    .workspace-shell :is(.shell-nav, .shell-main).shell-scrollbar-hover { scrollbar-color: var(--color-scroll-thumb-hover) transparent; }
}
@supports not (scrollbar-color: auto) {
    .workspace-shell :is(.shell-nav, .shell-main)::-webkit-scrollbar { inline-size: 10px; block-size: 10px; }
    .workspace-shell :is(.shell-nav, .shell-main)::-webkit-scrollbar-track { background: transparent; }
    .workspace-shell :is(.shell-nav, .shell-main)::-webkit-scrollbar-thumb {
        background-color: transparent;
        background-clip: content-box;
        border: 2px solid transparent;
        border-radius: 999px;
    }
    .workspace-shell :is(.shell-nav, .shell-main):is(:hover, :focus-within)::-webkit-scrollbar-thumb { background-color: var(--color-scroll-thumb); }
    .workspace-shell :is(.shell-nav, .shell-main)::-webkit-scrollbar-thumb:hover { background-color: var(--color-scroll-thumb-hover); }
}
/* The company name keeps dir="auto" for its own word order, but a name in
   the other script lines up with the product name on the page's start edge
   instead of sitting against its own start (the Arabic header showed an
   English name short of the Arabic product name's right edge). */
.workspace-shell .shell-brand:dir(rtl) [dir="auto"]:dir(ltr),
.workspace-shell .shell-brand:dir(ltr) [dir="auto"]:dir(rtl) { text-align: end; }

/* Desktop with a fine pointer: the pin control and the icon rail. Touch
   screens keep the pinned sidebar (no hover-only interaction). */
@media (min-width: 48.0625rem) and (hover: hover) and (pointer: fine) {
    .workspace-shell [data-shell-pin] { display: inline-flex; }
    /* The sidebar's own width follows the grid track, so pinning and
       unpinning animate together. Items fill the sidebar's width, so their
       surfaces follow it during a transition with their rounded ends. */
    .workspace-shell .shell-nav { justify-self: start; inline-size: var(--shell-nav-current); }
    /* Position the complete row (icon and focus surface) identically when
       pinned, collapsed, or temporarily expanded. */
    .workspace-shell .shell-nav > ul > li { margin-inline-start: 0.1875rem; }
    .workspace-shell .shell-nav > ul > li > a,
    .workspace-shell .shell-nav .nav-section > summary { inline-size: 100%; }
    html[data-sidebar="rail"] .workspace-shell .shell { --shell-nav-current: var(--shell-rail-width); }
    html[data-sidebar="rail"] .workspace-shell .shell-nav {
        position: relative;
        z-index: 30;
    }
    /* The pinned sidebar visually includes the page's 12px start gutter.
       Cover that gutter on hover too, while adding the same space to the
       overlay's end padding so menu rows retain their pinned width. */
    html[data-sidebar="rail"] .workspace-shell.shell-rail-open .shell-nav {
        inline-size: calc(var(--shell-nav-width) + var(--space-3));
        padding-inline-end: calc(var(--space-3) * 2);
        box-shadow: var(--shadow-overlay);
    }
    /* The collapsed rail reserves no scrollbar gutter. A row (3px start
       margin and a 42px slot) is 3px wider than the rail's content area
       beside a reserved 10px gutter; in Arabic, Chromium then keeps the rail
       scrolled 3px sideways and every icon moves when the sidebar is
       unpinned. The gutter is on the end side, so the start offset of the
       icons is unchanged in both languages; the pinned sidebar and the
       expanded overlay keep their stable gutter. */
    html[data-sidebar="rail"] .workspace-shell:not(.shell-rail-open) .shell-nav { scrollbar-gutter: auto; }
    /* Collapsed rail: icon only, each in a 42px slot.
       Labels stay in the accessibility tree; the slot simply clips them, so
       every icon keeps its name. */
    html[data-sidebar="rail"] .workspace-shell:not(.shell-rail-open) .shell-nav > ul > li > a,
    html[data-sidebar="rail"] .workspace-shell:not(.shell-rail-open) .shell-nav .nav-section > summary {
        position: relative;
        inline-size: 2.625rem;
        gap: 1.5rem;
    }
    html[data-sidebar="rail"] .workspace-shell:not(.shell-rail-open) .shell-nav .nav-section > summary::after { opacity: 0; }
    /* On the rail the current page shows through its teal icon alone; the
       light surface returns when the sidebar expands. */
    html[data-sidebar="rail"] .workspace-shell:not(.shell-rail-open) .shell-nav > ul > li > a[aria-current="page"] { background: transparent; box-shadow: none; }
    html[data-sidebar="rail"] .workspace-shell:not(.shell-rail-open) .shell-nav .nav-badge {
        position: absolute;
        inset-block-start: 0.125rem;
        inset-inline-end: 0.125rem;
        margin: 0;
        padding-inline: 0.3125rem;
        font-size: 0.625rem;
        line-height: 1.4;
    }
    html[data-sidebar="rail"] .workspace-shell:not(.shell-rail-open) .shell-nav .nav-section[open] > summary .nav-section-badge { display: inline-block; }
    /* The open group's links are not shown on the rail. They appear at
       once, at their final place, when the sidebar expands; nothing moves
       up or down while the width changes. */
    html[data-sidebar="rail"] .workspace-shell:not(.shell-rail-open) .shell-nav .nav-children { display: none; }
    /* Only the width moves: pinning, unpinning and the temporary expansion
       over the page. */
    .workspace-shell.shell-rail-motion .shell { transition: grid-template-columns var(--shell-motion) var(--ease-shell); }
    .workspace-shell.shell-rail-motion .shell-nav { transition: inline-size var(--shell-motion) var(--ease-shell), box-shadow var(--shell-motion) var(--ease-shell); }
}
@media (prefers-reduced-motion: reduce) {
    .shell-nav .nav-section > summary::after { transition: none; }
    .workspace-shell.shell-rail-motion .shell,
    .workspace-shell.shell-rail-motion .shell-nav { transition: none; }
}

/* Navigation and header icons (local SVG masks; see the shell block). */
[data-icon="dashboard"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.15' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='translate(12 12) scale(1.1) translate(-12 -12)'%3E%3Cpath d='M3.75 11.25 12 4.5l8.25 6.75'/%3E%3Cpath d='M6 9.75v9.75h4.5v-5h3v5H18V9.75'/%3E%3C/g%3E%3C/svg%3E"); }
[data-icon="organization"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.15' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='translate(12 12) scale(1.1) translate(-12 -12)'%3E%3Cpath d='M4.5 20V5.25L12 3.5V20'/%3E%3Cpath d='M12 9l7.5 2.25V20'/%3E%3Cpath d='M3 20h18'/%3E%3Cpath d='M7.75 8h1.5M7.75 11.5h1.5M7.75 15h1.5M15 14h1.5M15 17h1.5'/%3E%3C/g%3E%3C/svg%3E"); }
[data-icon="sales"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.15' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='translate(12 12) scale(1.1) translate(-12 -12)'%3E%3Cpath d='M5.5 3.5h13v17l-2.6-1.6-2.6 1.6-2.6-1.6-2.6 1.6-2.6-1.6z'/%3E%3Cpath d='M9 8h6M9 11.5h6M9 15h3.5'/%3E%3C/g%3E%3C/svg%3E"); }
[data-icon="finance"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.15' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='translate(12 12) scale(1.1) translate(-12 -12)'%3E%3Cpath d='M4 8h15.5a1 1 0 0 1 1 1v9.5a1 1 0 0 1-1 1h-15A1.5 1.5 0 0 1 3 18V6.5A1.5 1.5 0 0 1 4.5 5H17v3'/%3E%3Ccircle cx='16.5' cy='14' r='1.25'/%3E%3C/g%3E%3C/svg%3E"); }
[data-icon="reports"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.15' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='translate(12 12) scale(1.1) translate(-12 -12)'%3E%3Cpath d='M3.5 20h17'/%3E%3Cpath d='M7 16.5V12'/%3E%3Cpath d='M12 16.5V6'/%3E%3Cpath d='M17 16.5V9'/%3E%3C/g%3E%3C/svg%3E"); }
[data-icon="administration"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.15' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='translate(12 12) scale(1.1) translate(-12 -12)'%3E%3Cpath d='M4 7h9.5M18.5 7H20M4 17h2M10.5 17H20'/%3E%3Ccircle cx='16' cy='7' r='2.25'/%3E%3Ccircle cx='8.25' cy='17' r='2.25'/%3E%3C/g%3E%3C/svg%3E"); }
[data-icon="billing"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.15' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='translate(12 12) scale(1.1) translate(-12 -12)'%3E%3Cpath d='M5.5 3.5h9l4 4v13h-13z'/%3E%3Cpath d='M14.5 3.5v4h4'/%3E%3Cpath d='M9 12h6M9 15.5h6'/%3E%3C/g%3E%3C/svg%3E"); }
[data-icon="operations"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.15' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='translate(12 12) scale(1.1) translate(-12 -12)'%3E%3Crect x='4' y='4.5' width='16' height='6' rx='1.5'/%3E%3Crect x='4' y='13.5' width='16' height='6' rx='1.5'/%3E%3Cpath d='M7.5 7.5h.01M7.5 16.5h.01M11 7.5h5.5M11 16.5h5.5'/%3E%3C/g%3E%3C/svg%3E"); }
[data-icon="menu"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.15' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='translate(12 12) scale(1.1) translate(-12 -12)'%3E%3Cpath d='M4 7h16M4 12h16M4 17h16'/%3E%3C/g%3E%3C/svg%3E"); }
[data-icon="sidebar"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.15' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='translate(12 12) scale(1.1) translate(-12 -12)'%3E%3Crect x='3.5' y='5' width='17' height='14' rx='1.5'/%3E%3Cpath d='M9.5 5v14'/%3E%3C/g%3E%3C/svg%3E"); }
[data-icon="close"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.15' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg transform='translate(12 12) scale(1.1) translate(-12 -12)'%3E%3Cpath d='M6.5 6.5l11 11M17.5 6.5l-11 11'/%3E%3C/g%3E%3C/svg%3E"); }
/* R0c.2 I11: the Attention item's count badge (the number is also spoken through aria-label). */
.nav-badge {
    display: inline-block;
    margin-inline-start: var(--space-2);
    padding-inline: var(--space-2);
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
    background: #fbeaea;
    color: var(--color-danger);
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .nav-badge { background: var(--color-danger-bg); }
}
/* R0c.2 I11: the FP-B12 scheduler warning on the dashboard and Attention page. */
.scheduler-warning { border-inline-start: 4px solid var(--color-danger); }

.shell-main { padding: var(--space-6); max-inline-size: 72rem; inline-size: 100%; min-inline-size: 0; }
.shell-main:focus { outline: none; }

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-block-end: var(--space-4);
}
.page-head h1 { margin: 0; }
.page-title { min-inline-size: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.page-actions form { margin: 0; }
/* Workspace page title (2026-10-26 refinement): a quieter heading with the
   breadcrumbs from the navigation context below it. */
.workspace-shell .page-head { align-items: flex-start; margin-block-end: var(--space-6); }
.workspace-shell .page-head h1 { font-size: 1.125rem; line-height: 1.35; }
/* Screen form text in the workspaces (pass 4, measured against the
   reference): 15px controls under the 14px labels. Print is unchanged. */
@media screen {
    .workspace-shell :is(.field input, .field select, .field textarea, .table-input, .select-menu-trigger, .multi-select-trigger) { font-size: 0.9375rem; }
}
.breadcrumbs { margin-block-start: var(--space-1); font-size: 0.8125rem; line-height: 1.4; color: var(--color-muted); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); margin: 0; padding: 0; list-style: none; }
.breadcrumbs li { display: inline-flex; align-items: center; gap: var(--space-2); min-inline-size: 0; overflow-wrap: anywhere; }
.breadcrumbs li + li::before { content: '/'; color: var(--color-border-strong); }
.breadcrumbs a { color: var(--color-accent); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
/* Inside the full-width surface, tables, reports, dashboards, panels and
   screen forms use the whole width: grids fill it in responsive columns
   (.form-grid), and a field that stands on its own takes one column of a
   two-column row, so it lines up with the grids around it instead of
   stretching across a wide screen. Running text and hints keep a
   comfortable line length. Print styles are separate and unchanged. */
@media screen and (min-width: 48.0625rem) {
    .shell-surface :is(.form, .panel, .fieldset) > .field { max-inline-size: calc(50% - var(--space-2)); }
}
.shell-surface :is(.panel, .shell-surface) > p:not(.banner),
.shell-surface > p:not(.banner):not(.shell-zone),
.shell-surface .hint,
.shell-surface .empty-state p { max-inline-size: var(--measure-text); }

.panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: var(--space-6);
    margin-block-end: var(--space-4);
}
.panel h2 { margin: 0 0 var(--space-3); font-size: 1.0625rem; }
.panel h3 { margin: var(--space-3) 0 var(--space-2); font-size: 0.9375rem; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: var(--space-4); }
.grid-2 > .panel { margin-block-end: 0; }
.grid-2 + .panel { margin-block-start: var(--space-4); }

.facts { margin: 0; display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: var(--space-2) var(--space-4); }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; }
.profile-fact-note { display: block; margin-block-start: var(--space-1); }
.facts + .hint { margin-block-start: var(--space-3); }
/* A value's reading direction must not move it away from its label. */
.facts dd[dir] { justify-self: start; max-inline-size: 100%; min-inline-size: 0; overflow-wrap: anywhere; }
/* Wrapped lines of a value follow the PAGE's direction, not the value's own
   `dir`, so an English address on an Arabic page (or Arabic text on an
   English page) stays against its label: a value whose direction differs
   from the page aligns to its own end. Explicit `dir` values first (no
   :dir() needed), then `dir="auto"` by its resolved direction. */
html[dir="rtl"] .facts dd[dir="ltr"], html[dir="ltr"] .facts dd[dir="rtl"] { text-align: end; }
.facts:dir(rtl) dd[dir="auto"]:dir(ltr), .facts:dir(ltr) dd[dir="auto"]:dir(rtl) { text-align: end; }
.facts-followup { margin-block-start: var(--space-4); }

.chip {
    display: inline-block;
    padding: 0 var(--space-2);
    margin-inline-end: var(--space-1);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 0.8125rem;
    background: var(--color-bg);
}

.muted { color: var(--color-muted); }
.small { font-size: 0.8125rem; }

.stat-row { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-4); }
.stat-row a { display: inline-flex; align-items: center; min-block-size: var(--control-height-md); padding: 0 var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius); text-decoration: none; color: var(--color-text); }
.stat-row strong { font-size: 1.25rem; line-height: 1; margin-inline-end: var(--space-2); }

/* --- banners ------------------------------------------------------------ */
.banner {
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    margin: 0 0 var(--space-4);
}
.banner.facts-followup { margin-block-start: var(--space-4); }
.banner-success { background: var(--color-success-bg); border-color: var(--color-success-border); }
.banner-warning { background: var(--color-warning-bg); border-color: var(--color-warning-border); }
.banner-danger { background: var(--color-danger-bg); border-color: var(--color-danger-border); }
.banner-info { background: var(--color-info-bg); border-color: var(--color-info-border); }

/* --- forms -------------------------------------------------------------- */
.form .field input[type="text"],
.form .field input[type="search"],
.form .field input[type="email"],
.form .field input[type="tel"],
.form .field input[type="date"],
.form .field input[type="month"],
.filters .field input[type="date"],
.filters .field select { inline-size: 100%; }
/* Filter bar: the fields and the submit button on one wrapping row. A bare
   label/select/button row (lists) stays compact; a bar of .field blocks
   (reports) sits in a light panel with the button aligned to the inputs. */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-3); margin-block-end: var(--space-4); }
.filters > label { font-size: 0.875rem; font-weight: 600; }
.filters > select,
.filters > input { min-block-size: var(--control-height-sm); padding-inline: var(--space-3); font: inherit; font-size: 0.9375rem; color: var(--color-text); background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius); }
.filters:has(> .field) { align-items: flex-end; gap: var(--space-3) var(--space-4); padding: var(--space-4) var(--space-6); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.filters .field { flex: 0 1 13rem; min-inline-size: 10rem; margin-block-end: 0; }
.filters .field.wide { flex-basis: 22rem; }
.filters > .button { flex: none; inline-size: auto; }
.filters + .hint { margin-block-start: 0; }
/* Billing and other multi-field searches put a grid and actions inside the
   filter panel. They need the panel's full width, not two flex items beside
   each other. The grid then wraps naturally as the viewport narrows. */
.filters:has(> .form-grid) { display: block; }
.filters > .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    gap: var(--space-3) var(--space-4);
}
.filters > .form-grid > .choice { align-self: end; }
@media (max-width: 40rem) {
    .filters:has(> .field) { padding: var(--space-4); }
    .filters .field, .filters .field.wide { flex: 1 1 100%; }
}
/* Report tables: dates, numbers and amounts never break inside a cell. */
.report-table td { white-space: nowrap; }
.report-table td.wrap { white-space: normal; min-inline-size: 10rem; }
.report-table td.wrap .badge { white-space: normal; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0 var(--space-4); }
.request-card .form-grid { margin-block-start: var(--space-4); row-gap: var(--space-4); }
.choice-field {
    min-inline-size: 0;
    margin-inline: 0;
    padding: 0;
    border: 0;
}
.choice-field legend {
    margin-block-end: var(--space-1);
    padding: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text);
}
.change-plan-selection { grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }
.cancellation-details { grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }
.fieldset { border: 1px solid var(--color-border); border-radius: var(--radius); padding: var(--space-4); margin: 0 0 var(--space-4); }
.fieldset legend { font-weight: 600; padding-inline: var(--space-2); }
/* A fieldset's default min-inline-size is min-content, so a wide table
   inside it (the invoice Lines grid) stretched the fieldset past the form
   panel and the page instead of letting its .table-wrap scroll. In the
   tenant workspace the fieldset fits its container; only the table area
   scrolls horizontally. */
.workspace-shell .fieldset { min-inline-size: 0; }
.choice { display: flex; align-items: baseline; gap: var(--space-2); padding-block: var(--space-1); }
.mail-configuration-choice { padding-block: var(--space-2); }
.mail-configuration-choice > input { flex: 0 0 auto; }
.mail-configuration-choice > span { min-inline-size: 0; }
.mail-configuration-choice .choice-description { margin-inline-start: var(--space-1); }
/* PB-2: the billing profile's buyer type (two choices and their explanation); VAT timing facts on
   the platform issue form and the tenant issue confirmation (2026-11-05). */
.buyer-type-field .hint, .timing-field .hint, .timing-statements > .hint { margin-block: var(--space-2) var(--space-2); font-size: 0.8125rem; color: var(--color-muted); }
.timing-field > .field { margin-block-start: var(--space-3); }
.field-label { display: block; margin-block-end: var(--space-1); font-size: 0.875rem; font-weight: 600; color: var(--color-text); }
.multi-select { position: relative; }
.multi-select-trigger {
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    inline-size: 100%;
    min-block-size: var(--control-height-md);
    padding-block: var(--space-1);
    padding-inline: var(--space-3);
    font: inherit;
    font-size: 1rem;
    line-height: 1.3;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    list-style: none;
}
.multi-select-trigger:hover { border-color: var(--color-border-strong); }
.multi-select-trigger:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.multi-select-trigger[aria-expanded="true"] { border-color: var(--color-accent); }
.multi-select-value { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-select-menu {
    position: absolute;
    z-index: 50;
    inset-block-start: calc(100% + var(--space-1));
    inset-inline: 0;
    max-block-size: 18rem;
    overflow-y: auto;
    padding: var(--space-2) var(--space-3);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-nav);
    box-shadow: var(--shadow-overlay);
}
.multi-select-actions {
    display: flex;
    gap: var(--space-3);
    margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-3)) var(--space-1);
    padding: var(--space-2) var(--space-3);
    border-block-end: 1px solid var(--color-border);
}
.multi-select-action {
    appearance: none;
    padding: 0;
    color: var(--color-accent);
    background: transparent;
    border: 0;
    font: inherit;
    font-size: 0.8125rem;
    line-height: 1.5;
    text-decoration: underline;
    cursor: pointer;
}
.multi-select-action:hover { text-decoration-thickness: 2px; }
.multi-select-action:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.multi-select-menu .choice { display: flex; align-items: baseline; margin: 0; font-weight: 400; }
/* Styled single-choice lists (2026-10-26 refinement; js/select-menu.js on
   <select data-select-menu>). The native select stays in the form under the
   button: it is what is submitted and validated, and a browser's validation
   message points at it. Options: pale teal under the pointer or keyboard,
   pale teal with dark teal text and a check mark when chosen. Without the
   script the native select is shown unchanged. */
.select-menu { position: relative; min-inline-size: 0; }
.select-menu-native {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    opacity: 0;
    pointer-events: none;
}
.select-menu-trigger {
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    inline-size: 100%;
    min-block-size: var(--control-height-md);
    padding-block: var(--space-1);
    padding-inline: var(--space-3);
    font: inherit;
    font-size: 1rem;
    line-height: 1.3;
    text-align: start;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
}
/* One arrow for every dropdown: a 16px chevron (2px stroke at 24px, so
   about 1.3px drawn) in the text colour at 80%, its box 12px from the
   field's end edge (the trigger's own padding), mirrored by the logical
   padding in Arabic. The checkbox filter (.multi-select) draws the same one. */
:is(.select-menu-trigger, .multi-select-trigger)::after {
    content: '';
    flex: none;
    inline-size: 1rem;
    block-size: 1rem;
    background-color: currentColor;
    -webkit-mask: var(--icon-select-chevron) center / contain no-repeat;
    mask: var(--icon-select-chevron) center / contain no-repeat;
    opacity: 0.8;
    transition: transform 160ms ease;
}
:is(.select-menu-open .select-menu-trigger, .multi-select-trigger[aria-expanded="true"])::after { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
    :is(.select-menu-trigger, .multi-select-trigger)::after { transition: none; }
}
.select-menu-trigger:hover { border-color: var(--color-border-strong); }
.select-menu-trigger:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 1px; }
.select-menu-open .select-menu-trigger { border-color: var(--color-accent); }
.select-menu-trigger:disabled { opacity: 0.6; cursor: not-allowed; border-color: var(--color-border); }
.select-menu-invalid .select-menu-trigger { border-color: var(--color-danger); }
.select-menu-value { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A compact filter row keeps the native control's width and height. */
.filters > .select-menu { min-inline-size: var(--select-native-width, 10rem); }
.filters > .select-menu .select-menu-trigger { min-block-size: var(--control-height-sm); font-size: 0.9375rem; }
.select-menu-popup {
    position: absolute;
    z-index: 50;
    inset-block-start: calc(100% + var(--space-1));
    inset-inline-start: 0;
    min-inline-size: 100%;
    inline-size: max-content;
    max-inline-size: min(28rem, calc(100vw - 2rem), var(--select-menu-room, 100vw));
    padding: var(--space-2);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-nav);
    box-shadow: var(--shadow-overlay);
}
.select-menu-up .select-menu-popup { inset-block-start: auto; inset-block-end: calc(100% + var(--space-1)); }
/* Inside a scrolling table (an invoice's line table) an attached list would
   be clipped by the table's own scroll box, so the script places it against
   the viewport instead and closes it when the page or table scrolls. */
.select-menu-floating .select-menu-popup,
.select-menu-floating.select-menu-up .select-menu-popup { position: fixed; inset: auto; min-inline-size: 0; }
.select-menu-search { padding: var(--space-1) var(--space-1) var(--space-2); }
.select-menu-search input {
    inline-size: 100%;
    min-block-size: var(--control-height-md);
    padding-inline: var(--space-3);
    font: inherit;
    font-size: 0.9375rem;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
}
.select-menu-search input:focus { outline: 2px solid var(--color-accent); outline-offset: -1px; border-color: var(--color-accent); }
.select-menu-list, .select-menu-list ul { list-style: none; margin: 0; padding: 0; }
.select-menu-list { max-block-size: 17rem; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--color-scroll-thumb) transparent; }
.select-menu-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    min-block-size: 2.5rem;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    color: var(--color-text);
    overflow-wrap: anywhere;
    cursor: pointer;
}
/* The search box hides options that do not match with the hidden attribute;
   the display: flex above would otherwise keep them on screen. */
.select-menu-option[hidden] { display: none; }
.select-menu-option.is-active { background: var(--color-option-hover); color: var(--color-option-text); }
.select-menu-option[aria-selected="true"] { background: var(--color-option-selected); color: var(--color-option-text); font-weight: 600; }
.select-menu-option[aria-selected="true"]::after {
    content: '';
    flex: none;
    inline-size: 1rem;
    block-size: 1rem;
    background-color: currentColor;
    -webkit-mask: var(--icon-check) center / contain no-repeat;
    mask: var(--icon-check) center / contain no-repeat;
}
.select-menu-option[aria-disabled="true"] { color: var(--color-muted); background: transparent; cursor: not-allowed; }
.select-menu-group { padding: var(--space-2) var(--space-3) var(--space-1); font-size: 0.75rem; font-weight: 600; color: var(--color-muted); }
.select-menu-empty { margin: 0; padding: var(--space-2) var(--space-3); font-size: 0.875rem; color: var(--color-muted); }
@media (forced-colors: active) {
    .select-menu-option.is-active { outline: 2px solid Highlight; outline-offset: -2px; }
    .select-menu-option[aria-selected="true"] { outline: 1px solid CanvasText; outline-offset: -1px; }
    :is(.select-menu-trigger, .multi-select-trigger)::after, .select-menu-option[aria-selected="true"]::after { background-color: CanvasText; }
}
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-4); margin-block-start: var(--space-4); }
.transfer-decline { margin-block-start: var(--space-3); }
.button.danger { background: var(--color-danger); border-color: var(--color-danger); color: #ffffff; }
/* I14 browser walk: in the dark scheme the danger colour is light, so its label is dark (white was 2.9:1). */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .button.danger { color: #0d1317; }
}
.permission-group + .permission-group { margin-block-start: var(--space-3); }
.permission-list { list-style: none; margin: 0; padding: 0; }
.permission-list li { padding-block: var(--space-1); }
.permission-list li.not-held { color: var(--color-muted); }

/* --- tables ------------------------------------------------------------- */
.table-wrap { position: relative; overflow-x: auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); margin-block-end: var(--space-4); }
.table-wrap .list-table { margin: 0; }
.row-actions { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.pager { display: flex; gap: var(--space-4); align-items: center; justify-content: center; margin-block: var(--space-4); }

.integrity-ok { border-inline-start: 4px solid var(--color-accent); }
.integrity-check { margin-block-start: var(--space-3); }
.integrity-check .hint { margin-block-end: var(--space-2); font-size: 0.8125rem; max-inline-size: var(--measure); }
.integrity-bad { border-inline-start: 4px solid var(--color-danger); background: var(--color-danger-bg); }

/* --- platform workspace (R0c.1) ------------------------------------------ */
/* Plain links in the platform workspace keep one colour whether visited or
   not (zero specificity: any component rule below still wins). */
:where(.platform-shell .shell-main a:not(.button)) { color: var(--color-accent); }
.section-nav { margin-block-end: var(--space-3); }
.section-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-1); }
.section-nav a { display: inline-flex; align-items: center; min-block-size: var(--control-height-sm); padding: 0 var(--space-3); border: 1px solid var(--color-border); border-radius: 999px; font-size: 0.875rem; color: var(--color-text); text-decoration: none; background: var(--color-surface); }
.section-nav a:hover { background: var(--color-bg); }
.section-nav a[aria-current="page"] { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-text); font-weight: 600; }
.tenant-summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-block: 0 var(--space-4); }
.inline-action summary { cursor: pointer; color: var(--color-accent); font-weight: 600; }
.inline-action[open] { padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius); margin-block-start: var(--space-2); background: var(--color-surface); }
.inline-action .form { margin: var(--space-2) 0 0; }
.shell-zone { margin-block-start: var(--space-6); }
/* Long identifiers (action names, references, addresses) wrap instead of widening a narrow screen. */
.platform-shell .facts dd, .platform-shell .page-head h1 { overflow-wrap: anywhere; }
.list-table td .row-actions { flex-wrap: nowrap; }

/* --- responsive --------------------------------------------------------- */
@media (max-width: 48rem) {
    .workspace-shell { block-size: auto; min-block-size: 100vh; overflow: visible; }
    .workspace-shell .shell,
    .workspace-shell .shell-nav,
    .workspace-shell .shell-main { overflow: visible; }
    .shell { grid-template-columns: minmax(0, 1fr); align-content: start; }
    .shell-nav { border-inline-end: none; border-block-end: 1px solid var(--color-border); padding: var(--space-2) var(--space-4); }
    .shell-nav ul { display: flex; flex-wrap: wrap; gap: var(--space-1); }
    .shell-nav li + li { margin-block-start: 0; }
    .shell-nav a { display: inline-flex; align-items: center; min-block-size: var(--control-height-sm); padding: 0 var(--space-3); border: 1px solid var(--color-border); border-radius: 999px; font-size: 0.875rem; }
    .workspace-shell .shell-nav > ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
    .workspace-shell .shell-nav .nav-children { display: block; }
    .workspace-shell .shell-nav a { block-size: auto; border: 0; border-radius: var(--radius-nav); font-size: 0.9375rem; }
    .workspace-shell .shell-nav > ul > li > a { display: flex; padding-block: var(--space-2); padding-inline: 0.5625rem 0; }
    .workspace-shell .shell-nav .nav-children a { display: flex; padding-block: 0.375rem; padding-inline: 1.09375rem var(--space-3); font-size: 0.9375rem; }
    .shell-main { padding: var(--space-4); }
    .workspace-shell .shell-main { padding: var(--space-2); }
    .shell-surface { padding: var(--space-4) var(--space-3) var(--space-6); border-radius: var(--radius-nav); }
    .shell-header { padding: var(--space-3) var(--space-4); }
    .workspace-shell .shell-brand { min-inline-size: 0; flex: 1 1 0; overflow-wrap: anywhere; }
    .workspace-shell .shell-tools { flex-basis: 100%; justify-content: flex-end; }
    .workspace-shell [data-shell-menu-toggle] { display: inline-flex; margin-inline-start: auto; min-inline-size: 2.75rem; min-block-size: 2.75rem; }
    .workspace-shell .shell-nav {
        position: fixed;
        inset-block: 0;
        inset-inline-start: 0;
        z-index: 101;
        inline-size: min(var(--shell-nav-width), calc(100vw - 3.5rem));
        max-inline-size: 100vw;
        min-block-size: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        border-block-end: 0;
        border-inline-end: 1px solid var(--color-border);
        padding: var(--space-4) var(--space-3);
        box-shadow: 0 0 2rem rgb(0 0 0 / 0.16);
        visibility: hidden;
        transform: translateX(var(--shell-drawer-offscreen));
    }
    /* The closed drawer waits off the page's start edge: left in English,
       right in Arabic. Only the variable changes with direction, so the open
       state and the no-script fallback never compete with an RTL selector. */
    .workspace-shell { --shell-drawer-offscreen: -100%; }
    html[dir="rtl"] .workspace-shell { --shell-drawer-offscreen: 100%; }
    .workspace-shell.shell-menu-open .shell-nav { visibility: visible; transform: none; }
    /* Motion only around a deliberate open or close (the script sets
       shell-menu-motion). A load, refresh, rotation or resize across the
       breakpoint places the drawer instantly, so the sidebar never sweeps
       across the page. */
    .workspace-shell.shell-menu-motion .shell-nav { transition: transform 180ms ease, visibility 0s linear 180ms; }
    .workspace-shell.shell-menu-motion.shell-menu-open .shell-nav { transition: transform 180ms ease; }
    .workspace-shell .shell-nav > ul { display: block; }
    .workspace-shell .shell-nav > ul > li + li { margin-block-start: var(--space-1); }
    .workspace-shell [data-shell-nav-heading] {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-2);
        margin-block-end: var(--space-3);
        padding-inline: var(--space-3);
        font-weight: 600;
    }
    .workspace-shell [data-shell-menu-close] {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: none;
        min-inline-size: 2.75rem;
        min-block-size: 2.75rem;
        border: 1px solid var(--color-border);
        border-radius: var(--radius);
        color: var(--color-text);
        background: var(--color-surface);
        cursor: pointer;
    }
    .workspace-shell [data-shell-menu-close]:hover { background: var(--color-hover); }
    .workspace-shell [data-shell-backdrop]:not([hidden]) {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 100;
        inline-size: 100%;
        block-size: 100%;
        border: 0;
        background: rgb(0 0 0 / 0.45);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        cursor: pointer;
    }
    .workspace-shell.shell-menu-open [data-shell-backdrop]:not([hidden]) {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    .workspace-shell.shell-menu-motion [data-shell-backdrop]:not([hidden]) { transition: opacity 180ms ease, visibility 0s linear 180ms; }
    .workspace-shell.shell-menu-motion.shell-menu-open [data-shell-backdrop]:not([hidden]) { transition: opacity 180ms ease; }
    html.shell-menu-open, .workspace-shell.shell-menu-open { overflow: hidden; }
    .workspace-shell .grid-2 { grid-template-columns: minmax(0, 1fr); }
    .facts { grid-template-columns: 1fr; gap: var(--space-1); }
    .facts dd { margin-block-end: var(--space-2); }
    .panel { padding: var(--space-4); }
}

@media (max-width: 48rem) and (prefers-reduced-motion: reduce) {
    .workspace-shell.shell-menu-motion .shell-nav,
    .workspace-shell.shell-menu-motion [data-shell-backdrop]:not([hidden]) { transition: none; }
}

/* --- print base (F-19) -------------------------------------------------- */
.print-body { background: var(--color-bg); }
.print-toolbar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); padding: var(--space-3) var(--space-6); }
.print-sheet {
    max-inline-size: 52rem;
    margin: 0 auto var(--space-8);
    padding: var(--space-8);
    background: #ffffff;
    color: #111111;
    border: 1px solid var(--color-border);
}
.print-head { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); border-block-end: 2px solid #111111; padding-block-end: var(--space-4); margin-block-end: var(--space-4); }
.print-col h1 { font-size: 1.375rem; margin: 0; }
.print-col[dir="rtl"] { font-family: var(--font-arabic); text-align: start; }
.print-kicker { margin: 0 0 var(--space-1); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: #555555; }
.print-table { inline-size: 100%; border-collapse: collapse; margin-block-end: var(--space-6); font-size: 0.9375rem; }
.print-table th, .print-table td { border: 1px solid #cccccc; padding: var(--space-2) var(--space-3); text-align: start; vertical-align: top; }
.print-table [dir="rtl"] { font-family: var(--font-arabic); }
/* The bilingual line table of an invoice or credit note (tenant and platform
   prints) carries nine or ten columns of five- and six-digit amounts. At the
   page's 15px type it ran 135-177px past the printable A4 width (180mm), so
   it uses document-sized type: amounts stay on one line, headings wrap at
   word boundaries, and the description column takes what is left. Screen
   list tables are untouched; the on-screen sheet matches the paper. */
.print-lines { font-size: 0.6875rem; line-height: 1.35; }
.print-lines th { font-size: 0.625rem; vertical-align: bottom; }
.print-lines th, .print-lines td { padding: var(--space-1) 0.3125rem; }
.print-lines td.num { white-space: nowrap; }
/* I9 rehearsal: inside its bordered wrapper the table's own bottom margin showed as an empty strip. */
.table-wrap > .print-table { margin-block-end: 0; }
.print-section { display: flex; justify-content: space-between; font-size: 1rem; margin: 0 0 var(--space-2); }
.print-foot { border-block-start: 1px solid #cccccc; padding-block-start: var(--space-3); font-size: 0.8125rem; color: #444444; }
.print-foot p { color: #444444; margin: 0 0 var(--space-1); }
.print-audit { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin-block-start: var(--space-2); font-size: 0.6875rem; }
.print-audit p { color: #666666; margin: 0; }
/* I14 browser walk: on a phone-width screen the A4 sheet reflows instead of
   scrolling the page sideways; printing (below) is unchanged. */
@media screen and (max-width: 40rem) {
    .print-toolbar { flex-wrap: wrap; padding-inline: var(--space-3); }
    .print-sheet { margin-inline: var(--space-2); padding: var(--space-4); overflow-wrap: anywhere; }
    .print-head, .print-parties { grid-template-columns: 1fr; }
    .print-section { flex-wrap: wrap; gap: var(--space-1) var(--space-3); }
    .print-audit { grid-template-columns: 1fr; gap: var(--space-1); }
    .print-table { display: block; max-inline-size: 100%; overflow-x: auto; }
    /* I9 rehearsal: the sheet's overflow-wrap: anywhere let every column shrink to one
       character on a phone; table cells keep whole words and the table scrolls instead. */
    .print-table th, .print-table td { overflow-wrap: normal; word-break: normal; min-inline-size: 4.5rem; }
    .print-document { overflow: hidden; }
}

@media print {
    .no-print { display: none !important; }
    /* Any workspace page printed from the browser: content only, no
       navigation, tools or action buttons. */
    .skip-link, .shell-tools, .shell-nav, .tenant-menu-toggle, .tenant-nav-backdrop, [data-shell-pin], [data-shell-menu-toggle], [data-shell-backdrop], .page-actions, .form-actions, .button { display: none !important; }
    .section-nav, .filters, .inline-action, .integrity-check, .row-actions form { display: none !important; }
    .shell { display: block; }
    .shell-main { padding: 0; max-inline-size: none; }
    /* The tenant shell's fixed-height scroll areas would clip a printout to
       its first page; print flows the whole page instead. */
    .workspace-shell,
    .workspace-shell .shell,
    .workspace-shell .shell-main { block-size: auto; min-block-size: 0; overflow: visible; }
    .workspace-shell .shell-main { padding: 0; }
    .shell-surface { min-block-size: 0; padding: 0; background: none; box-shadow: none; border-radius: 0; }
    .breadcrumbs, .select-menu-popup { display: none !important; }
    .shell-header { border: none; padding: 0 0 var(--space-3); background: none; color: #111111; }
    .shell-product, .shell-tenant { color: #111111; }
    .print-body { background: #ffffff; }
    .print-sheet { border: none; margin: 0; padding: 0; max-inline-size: none; }
    .print-document .table-wrap { overflow: visible; border: 0; border-radius: 0; }
    .print-document .print-table { display: table; overflow: visible; max-inline-size: none; border: 1px solid #999999; }
    .print-document .print-table thead { display: table-header-group; }
    /* A long line table continues on the next page with its heading row
       repeated; a single line is never split between two pages. */
    .print-document .print-lines tr { break-inside: avoid; }
    .print-document .print-table th,
    .print-document .print-table td { border-color: #999999; }
    @page { size: A4; margin: 15mm; }
}

/* --- Platform document branding (2026-11-04) -----------------------------
   The ABTSOL ERP platform company's own subscription invoice and credit note
   (resources/views/platform/billing/print.blade.php). Colours come from the
   document's frozen snapshot through --pdoc-brand and --pdoc-accent; tenant
   prints (.print-branded) never use these rules. Logical properties only. */
.pdoc { --pdoc-brand: #0e5e6f; --pdoc-accent: #c98b2b; --pdoc-ink: #14232a; --pdoc-muted: #4f5d63; --pdoc-tint: color-mix(in srgb, var(--pdoc-brand) 7%, #ffffff); color: var(--pdoc-ink); }
.pdoc-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-6); padding-block-end: var(--space-3); }
.pdoc-brand { display: flex; flex: 1 1 auto; align-items: center; gap: var(--space-4); min-inline-size: 0; }
.pdoc-logo { display: block; max-block-size: 18mm; max-inline-size: 55mm; inline-size: auto; block-size: auto; object-fit: contain; }
.pdoc-names { display: grid; gap: 0.5mm; min-inline-size: 0; }
.pdoc-display { margin: 0; font-weight: 700; font-size: 1.125rem; line-height: 1.2; color: var(--pdoc-brand); }
.pdoc-display[dir="rtl"] { font-family: var(--font-arabic); font-weight: 600; font-size: 1rem; }
.pdoc-title { flex: 0 0 auto; text-align: end; }
.pdoc-title h1 { margin: 0; font-size: 1.5rem; letter-spacing: 0.02em; color: var(--pdoc-ink); }
.pdoc-title h1 [dir="rtl"] { font-family: var(--font-arabic); }
.pdoc-title-sep { color: var(--pdoc-accent); font-weight: 400; padding-inline: 0.15em; }
.pdoc-display { overflow-wrap: anywhere; }
.pdoc-title h1 > [lang] { white-space: nowrap; }
.pdoc-title.is-stacked h1 { display: grid; justify-items: end; gap: 0.5mm; font-size: 1.25rem; }
.pdoc-title.is-stacked .pdoc-title-sep { display: none; }
.pdoc-number { margin: var(--space-1) 0 0; font-size: 0.9375rem; font-weight: 600; color: var(--pdoc-brand); }
.pdoc-rule { block-size: 1.6mm; margin-block-end: var(--space-4); background: linear-gradient(to right, var(--pdoc-brand) 0 78%, var(--pdoc-accent) 78% 100%); print-color-adjust: exact; -webkit-print-color-adjust: exact; }
html[dir="rtl"] .pdoc-rule { background: linear-gradient(to left, var(--pdoc-brand) 0 78%, var(--pdoc-accent) 78% 100%); }
.pdoc-meta { font-size: 0.8125rem; }
.pdoc-meta th { inline-size: 30%; background: var(--pdoc-tint); color: var(--pdoc-muted); font-weight: 600; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.pdoc-parties { gap: var(--space-4); }
.pdoc-party { border: 1px solid #d5dde0; border-block-start: 1mm solid var(--pdoc-brand); padding: var(--space-3); print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.pdoc-party p { font-size: 0.8125rem; }
.pdoc-party .pdoc-legal { font-weight: 700; font-size: 0.9375rem; color: var(--pdoc-ink); }
.pdoc-party .pdoc-legal[dir="rtl"] { font-family: var(--font-arabic); }
.pdoc .print-section { color: var(--pdoc-brand); }
.pdoc .print-lines thead th { background: var(--pdoc-brand); color: #ffffff; border-color: var(--pdoc-brand); print-color-adjust: exact; -webkit-print-color-adjust: exact; }
/* PB-2: the description column keeps over a quarter of the width, so a line wraps
   less and a long invoice takes fewer pages; amounts never wrap. */
.pdoc .print-lines :is(th, td):nth-child(2) { inline-size: 28%; }
.pdoc .print-lines td.num { white-space: nowrap; }
.pdoc .print-lines tbody tr:nth-child(even) td { background: var(--pdoc-tint); print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.pdoc-totals-wrap, .pdoc .print-totals { break-inside: avoid; }
.pdoc-totals-wrap { display: flex; justify-content: flex-end; }
.pdoc-totals-wrap > .table-wrap { min-inline-size: 60%; }
/* PB-2: a real platform document carries the Phase 1 QR beside its totals, in its own column. */
.pdoc-totals-wrap.pdoc-has-qr { justify-content: space-between; align-items: flex-start; gap: 4mm; }
.pdoc-qr { flex: 0 0 32mm; }
.pdoc-totals .pdoc-grand th, .pdoc-totals .pdoc-grand td { background: var(--pdoc-brand); color: #ffffff; font-weight: 700; border-color: var(--pdoc-brand); print-color-adjust: exact; -webkit-print-color-adjust: exact; }
.pdoc-foot { border-block-start: 0.8mm solid var(--pdoc-accent); }
.pdoc-contacts { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-1) var(--space-4); font-weight: 600; color: var(--pdoc-brand) !important; }
/* PB-2: on paper, a one-line tax invoice (meta rows for the issue time and
   supply period, both party cards, the totals and the QR) fits one A4 page;
   rows and cards are tightened for print only. */
@media print {
    .pdoc .print-table:not(.print-lines) { font-size: 0.8125rem; }
    .pdoc .print-table:not(.print-lines) :is(th, td) { padding: 1mm 2mm; }
    .pdoc .table-wrap { margin-block-end: 2.5mm; }
    .pdoc-logo { max-block-size: 16mm; }
    .pdoc-foot .print-audit { margin-block-start: 1mm; }
    .pdoc-head { padding-block-end: 2mm; }
    .pdoc-rule { margin-block-end: 3mm; }
    .pdoc-parties { gap: 4mm; margin-block-end: 3mm; }
    .pdoc-party { padding: 2mm 3mm; }
    .pdoc-party p { margin-block-end: 0.4mm; font-size: 0.75rem; line-height: 1.35; }
    .pdoc-party .pdoc-legal { font-size: 0.8125rem; }
    .pdoc .print-section { margin-block-end: 1mm; font-size: 0.875rem; }
    .pdoc-closing > p, .pdoc-closing > h2 + p { font-size: 0.75rem; margin-block: 0 1mm; }
    .pdoc-foot { padding-block-start: 2mm; font-size: 0.6875rem; }
    .pdoc-foot p { margin-block-end: 0.5mm; }
}
@media screen and (max-width: 40rem) {
    .pdoc-head { flex-direction: column; align-items: flex-start; }
    .pdoc-title { text-align: start; }
    .pdoc-totals-wrap > .table-wrap { min-inline-size: 100%; }
    .pdoc-totals-wrap.pdoc-has-qr { flex-direction: column; align-items: center; }
}

/* Phase 1 and PB-2: activation check lists and short bullet lists on the
   tenant E-invoicing and platform Tax invoicing pages, with even spacing. */
.checklist { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: grid; gap: var(--space-2); }
.checklist li { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-2); }
.plain-list { margin: 0; padding-inline-start: 1.25rem; display: grid; gap: var(--space-2); }
.facts .inline-form { margin-block-start: var(--space-2); }

/* --- R0c.2 I7: billing documents ---------------------------------------- */
.badge.status-issued, .badge.status-paid, .badge.status-credited { background: #e5f3ef; border-color: #bfe0d4; color: #1f6f5c; }
.badge.status-draft, .badge.status-open { background: #eaf1fb; border-color: #c4d8f2; color: #1f4f9c; }
.badge.status-void, .badge.status-overdue { background: #fbeaea; border-color: #f0c2c3; color: var(--color-danger); }
.badge.status-partly_paid, .badge.status-partly_credited { background: var(--color-warning-bg); border-color: var(--color-warning-border); color: #7a5a12; }
.status-badges { display: inline-flex; align-items: center; flex-wrap: wrap; gap: var(--space-1); }
@media (prefers-color-scheme: dark) {
    .badge.status-issued, .badge.status-paid, .badge.status-credited { background: #163127; border-color: #234a3b; color: #7fd2b6; }
    .badge.status-draft, .badge.status-open { background: #16233a; border-color: #24365a; color: #9db8ee; }
    .badge.status-void, .badge.status-overdue { background: #3a1f20; border-color: #5a2e2f; color: #f0a8a9; }
    .badge.status-partly_paid, .badge.status-partly_credited { background: #33291a; border-color: #5a4826; color: #e0b15c; }
}
.print-document { position: relative; }
.print-parties { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); margin-block-end: var(--space-4); }
.print-parties p { margin: 0 0 var(--space-1); }
.print-totals { inline-size: 100%; margin-inline-start: 0; }
.print-watermark {
    position: absolute; inset: 35% 0 auto 0; margin: 0; display: flex; flex-direction: column; align-items: center;
    font-size: 3rem; font-weight: 700; color: rgba(164, 40, 43, 0.14); transform: rotate(-20deg); pointer-events: none; z-index: 1;
}
@media print {
    /* Repeated on every page and sized for the 180mm printable width: at 3rem
       the Arabic test watermark ran off the page edge. Each phrase stays on
       one line. */
    .print-watermark { position: fixed; inset: 38% 0 auto 0; font-size: 2rem; }
    .print-watermark span { white-space: nowrap; }
    /* The page number box inherits the page direction; in an Arabic print
       "1 / 5" showed as "5 / 1". The numbers read left to right. */
    @page { @bottom-center { content: counter(page) " / " counter(pages); direction: ltr; } }
}

/* --- R0c.2 I8: payments -------------------------------------------------- */
.badge.status-payment-confirmed, .badge.status-fully_allocated { background: #e5f3ef; border-color: #bfe0d4; color: #1f6f5c; }
.badge.status-payment-recorded, .badge.status-unallocated { background: #eaf1fb; border-color: #c4d8f2; color: #1f4f9c; }
.badge.status-payment-reversed, .badge.status-payment-cancelled { background: #fbeaea; border-color: #f0c2c3; color: var(--color-danger); }
.badge.status-partly_allocated, .badge.status-self-confirmed { background: var(--color-warning-bg); border-color: var(--color-warning-border); color: #7a5a12; }
@media (prefers-color-scheme: dark) {
    .badge.status-payment-confirmed, .badge.status-fully_allocated { background: #163127; border-color: #234a3b; color: #7fd2b6; }
    .badge.status-payment-recorded, .badge.status-unallocated { background: #16233a; border-color: #24365a; color: #9db8ee; }
    .badge.status-payment-reversed, .badge.status-payment-cancelled { background: #3a1f20; border-color: #5a2e2f; color: #f0a8a9; }
    .badge.status-partly_allocated, .badge.status-self-confirmed { background: #33291a; border-color: #5a4826; color: #e0b15c; }
}

/* Platform SMTP control: the owner's activation checklist, one step per row,
   each step's form kept apart from its neighbours (logical properties only). */
.mail-checklist { list-style: decimal; margin: 0; padding-inline-start: var(--space-6); }
.mail-checklist > li { padding-block: var(--space-4); border-block-end: 1px solid var(--color-border); }
.mail-checklist > li:last-child { border-block-end: none; }
.mail-checklist h3 { margin-block: 0 var(--space-2); font-size: 1rem; }
.mail-checklist form { margin-block-start: var(--space-3); }
.mail-checklist .inline-form { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.mail-test-form .field { inline-size: min(100%, 20rem); margin-block-end: 0; }
.mail-test-form .form-actions { margin-block-start: var(--space-3); }
.separated-action { margin-block-start: var(--space-6); padding-block-start: var(--space-4); border-block-start: 1px solid var(--color-border); }

/* --- Invoice branding (2026-10-27) ---------------------------------------
   Owner-approved templates for tenant invoice and credit note prints:
   A restrained header, B light letterhead (the default), C full header and
   footer; each with the branding area showing the logo, the company name
   or both. Everything here is scoped to .print-branded, which only an issue
   that recorded its branding carries, so older issues and every other print
   keep their layout. Required document content stays black or dark grey on
   white; the brand colours draw rules, bands and the letterhead names only.
   The brand colours are a fixed product palette for now. */
.print-branded { --print-brand: #0b4f9c; --print-accent: #f08a24; --print-ink: #111111; --print-muted: #4a5560; }
.print-branded .print-logo { display: block; inline-size: auto; block-size: auto; object-fit: contain; }
.print-brand-name { margin: 0; font-weight: 700; line-height: 1.25; color: var(--print-brand); }
.print-brand-name[lang="ar"] { font-family: var(--font-arabic); }
.print-brand-reg { margin: 0.6mm 0 0; font-size: 0.75rem; color: var(--print-muted); }
.print-brand-reg b { color: var(--print-brand); font-weight: 600; }

/* A tighter document scale, so a short invoice keeps to one page with a
   header above it. Values only: no element is hidden or reordered. */
.print-branded .print-head { padding-block-end: 3mm; margin-block-end: 3mm; gap: 6mm; }
.print-branded .print-col h1 { font-size: 1.125rem; }
.print-branded .banner { font-size: 0.75rem; padding: 1.5mm 3mm; margin-block-end: 3mm; }
.print-branded .print-table:not(.print-lines) { font-size: 0.75rem; }
.print-branded .print-table:not(.print-lines) th, .print-branded .print-table:not(.print-lines) td { padding: 1mm 2.2mm; }
.print-branded .print-table { margin-block-end: 3.5mm; }
.print-branded .print-parties { font-size: 0.75rem; line-height: 1.4; gap: 6mm; margin-block-end: 3mm; }
.print-branded .print-section { font-size: 0.8125rem; margin-block-end: 1mm; }
.print-branded .print-foot { font-size: 0.6875rem; }
.print-branded .print-document .table-wrap { margin-block-end: 3.5mm; }
/* The totals are never split across two pages. */
.print-branded .table-wrap:has(> .print-totals) { break-inside: avoid; }

/* A: the logo between the Arabic and English titles; first page only. */
.print-template-a .print-head { grid-template-columns: 1fr auto 1fr; align-items: center; border-block-end: 2px solid var(--print-brand); }
.print-template-a.print-display-text .print-head { grid-template-columns: 1fr 1fr; }
.print-template-a .print-brand-center { display: flex; justify-content: center; align-items: center; }
.print-template-a .print-logo { max-block-size: 16mm; max-inline-size: 52mm; }
.print-template-a.print-logo-compact .print-logo { max-block-size: 18mm; }
.print-template-a .print-kicker { text-transform: none; letter-spacing: 0; font-size: 0.875rem; font-weight: 700; color: var(--print-ink); }
.print-template-a.print-custom-color .print-kicker { color: var(--print-brand); }
.print-template-a.print-display-text .print-kicker { font-size: 1.0625rem; }
.print-template-a.print-display-logo .print-kicker { display: none; }

/* B: the letterhead band on page 1. */
.print-letterhead { display: flex; align-items: center; justify-content: space-between; gap: 8mm; padding-block-end: 3mm; margin-block-end: 4mm; position: relative; }
/* The two-colour rule under B's letterhead and C's header is a background:
   print it even when the browser's "Background graphics" option is off. */
.print-letterhead,
.print-fullhead { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.print-letterhead::after,
.print-fullhead::after { content: ''; position: absolute; inset-inline: 0; inset-block-end: 0; block-size: 1.2mm; background: linear-gradient(to right, var(--print-accent) 0 18%, #ffffff 18% 18.6%, var(--print-brand) 18.6% 100%); }
.print-letterhead .print-logo { max-block-size: 17mm; max-inline-size: 60mm; }
.print-logo-compact .print-letterhead .print-logo,
.print-logo-compact .print-fullhead .print-logo { max-block-size: 19mm; }
.print-letterhead-id { display: grid; gap: 0.8mm; justify-items: end; }
.print-letterhead .print-brand-name[lang="ar"] { font-size: 1.125rem; }
.print-letterhead .print-brand-name[lang="en"] { font-size: 1rem; }
/* With the names in the letterhead or header band, the title row shows the
   titles alone; with the logo alone, B keeps the name above the titles. */
.print-template-b .print-kicker,
.print-template-c .print-kicker { display: none; }
.print-template-b.print-display-logo .print-kicker { display: block; }
.print-template-b .print-head,
.print-template-c .print-head { border-block-end: 1px solid #bbbbbb; }
.print-contactline { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5mm 6mm; font-size: 0.6875rem; color: var(--print-muted); border-block-start: 0.4mm solid var(--print-brand); padding-block-start: 2mm; margin-block-start: 6mm; }
.print-contactline span { max-inline-size: 100%; overflow-wrap: anywhere; }
.print-contactline b { color: var(--print-brand); font-weight: 600; }

/* C: the header and footer bands, repeated on every printed page. */
.print-letterhead, .print-fullhead { overflow-wrap: anywhere; }
.print-fullhead { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6mm; padding-block: 3mm; position: relative; background: #ffffff; }
.print-fullhead .print-logo { max-block-size: 16mm; max-inline-size: 56mm; }
.print-fullhead .print-brand-names { display: grid; justify-items: center; text-align: center; }
.print-fullhead .print-brand-name[lang="ar"] { font-size: 1.0625rem; }
.print-fullhead .print-brand-name[lang="en"] { font-size: 0.9375rem; }
.print-fullhead .print-brand-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.print-display-text .print-fullhead { grid-template-columns: 1fr auto; }
.print-display-text .print-fullhead .print-brand-names { justify-items: start; text-align: start; }
.print-display-logo .print-fullhead { grid-template-columns: auto 1fr; }
.print-docref { justify-self: end; text-align: end; font-size: 0.75rem; line-height: 1.5; color: var(--print-muted); }
.print-docref p { margin: 0; }
.print-docref-number { color: var(--print-ink); font-size: 0.8125rem; font-weight: 700; }
.print-fullfoot,
.print-contactline { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
/* Footer 2 follows the approved letterhead footer: contacts with round
   icons over pale diagonal bands in the bottom-right corner, then the
   two-colour bar -- a main band, a 45-degree gap, the accent slant, a gap
   and a taller end slant reaching the right edge. All slants are 45
   degrees; sizes are in millimetres so the geometry is the same on every
   page and screen. The colours are the tenant's main and accent colours.
   The band is dir="ltr" in both languages, so inline-end is its right
   edge; the clip-path polygons are drawn left to right. */
.print-fullfoot {
    --ff-bar: 3mm; --ff-tall: 6.6mm; --ff-gap: 1.5mm; --ff-accent: 3.8mm; --ff-end: 14.7mm;
    position: relative; overflow: hidden; padding-block-start: 2.5mm; background: #ffffff;
}
.print-fullfoot-contacts { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5mm 5mm; font-size: 0.6875rem; line-height: 1.35; color: #222222; padding-block-end: 2.5mm; }
.print-fullfoot-contacts > span { display: inline-flex; align-items: center; gap: 1.5mm; min-inline-size: 0; max-inline-size: 100%; }
.print-fullfoot-contacts bdi { min-inline-size: 0; overflow-wrap: anywhere; }
.print-contact-icon { flex: none; inline-size: 4.6mm; block-size: 4.6mm; padding: 0.9mm; box-sizing: border-box; border-radius: 50%; background: var(--print-brand); fill: none; stroke: #ffffff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.print-fullfoot-corner { position: absolute; z-index: 0; inset-inline-end: 0; inset-block-end: var(--ff-tall); inline-size: 44mm; block-size: 9mm; pointer-events: none; }
.print-fullfoot-pale { position: absolute; inset: 0; }
.print-fullfoot-pale-upper { background: color-mix(in srgb, var(--print-brand) 6%, #ffffff); clip-path: polygon(11.9mm 5.5mm, 21.9mm 5.5mm, 27.4mm 0, 17.4mm 0); }
.print-fullfoot-pale-lower { background: color-mix(in srgb, var(--print-brand) 9%, #ffffff); clip-path: polygon(20mm 100%, 29mm 0, 100% 0, 100% 100%); }
.print-fullfoot-bar { position: relative; block-size: var(--ff-tall); }
.print-fullfoot-bar > span { position: absolute; inset-block-end: 0; }
.print-fullfoot-bar-main { inset-inline-start: 0; inset-inline-end: calc(var(--ff-end) + 2 * var(--ff-gap) + var(--ff-accent) - var(--ff-bar)); block-size: var(--ff-bar); background: var(--print-brand); clip-path: polygon(0 0, 100% 0, calc(100% - var(--ff-bar)) 100%, 0 100%); }
.print-fullfoot-bar-accent { inset-inline-end: calc(var(--ff-end) + var(--ff-gap) - var(--ff-tall)); inline-size: calc(var(--ff-accent) + var(--ff-tall)); block-size: var(--ff-tall); background: var(--print-accent); clip-path: polygon(0 100%, var(--ff-accent) 100%, 100% 0, var(--ff-tall) 0); }
.print-fullfoot-bar-end { inset-inline-end: 0; inline-size: var(--ff-end); block-size: var(--ff-tall); background: var(--print-brand); clip-path: polygon(0 100%, var(--ff-tall) 0, 100% 0, 100% 100%); }

/* On screen the bands show once, at the top and bottom of the sheet. */
@media screen {
    .print-frame, .print-frame > *, .print-frame > * > tr, .print-frame > * > tr > td { display: block; inline-size: 100%; }
    .print-frame thead, .print-frame tfoot { display: none; }
    .print-template-c .print-fullhead { margin-block-end: 5mm; }
    .print-footer-two .print-fullfoot { margin-block-start: 8mm; }
}
@media screen and (max-width: 40rem) {
    .print-letterhead { flex-wrap: wrap; }
    .print-letterhead-id { justify-items: start; }
    .print-fullhead, .print-display-text .print-fullhead, .print-display-logo .print-fullhead { grid-template-columns: 1fr; justify-items: start; }
    .print-fullhead .print-brand-names, .print-docref { justify-items: start; justify-self: start; text-align: start; }
    .print-template-a .print-head, .print-template-a.print-display-text .print-head { grid-template-columns: 1fr; }
}

@media print {
    /* Repeated bands: the visible bands are fixed boxes, which repeat on
       every page. The frame table's header and footer rows, which the
       browser also repeats on every page, hold an invisible copy of the
       same band at the same width, so the space they keep free is the
       band's real height however long the names or contacts are: rows and
       totals never run underneath a band. The copy reserves the logo's
       largest box rather than repeating the image. */
    .print-frame { inline-size: 100%; border-collapse: collapse; }
    .print-frame > * > tr > td { padding: 0; border: 0; }
    .print-band-ghost { visibility: hidden; }
    .print-fullhead .print-logo-ghost { display: block; block-size: 16mm; inline-size: 56mm; }
    .print-logo-compact .print-fullhead .print-logo-ghost { block-size: 19mm; }
    .print-template-c .print-frame-head { padding-block-end: 4mm; }
    .print-footer-one .print-frame-foot { padding-block-start: 5mm; }
    .print-footer-two .print-frame-foot { padding-block-start: 4mm; }
    .print-footer-one .print-contactline { margin: 0; background: #ffffff; }
    .print-footer-one .print-contactline:not(.print-band-ghost) { position: fixed; inset-inline: 0; inset-block-end: 0; }
    .print-template-c .print-fullhead:not(.print-band-ghost) { position: fixed; inset-inline: 0; inset-block-start: 0; }
    .print-footer-two .print-fullfoot:not(.print-band-ghost) { position: fixed; inset-inline: 0; inset-block-end: 0; }
    /* A and B continuation pages: the company name and invoice number sit
       in the top margin from page 2 (the text is written per document by
       the print view; page 1 has none). 8 pt in near-black at A4 size. */
    @page {
        @top-left { font-family: "IBM Plex Sans", "IBM Plex Sans Arabic", sans-serif; font-size: 8pt; color: #333333; vertical-align: bottom; padding-block-end: 3mm; white-space: nowrap; }
        @top-right { font-family: "IBM Plex Sans Arabic", "IBM Plex Sans", sans-serif; font-size: 8pt; color: #333333; vertical-align: bottom; padding-block-end: 3mm; direction: rtl; white-space: nowrap; }
    }
}

/* R1d B6: the closing block of a sales document -- totals, QR, the invoice
   discount and its reason, the VAT statement, the note reason, the printed
   notes and the closing test notice -- is never split across pages. If it
   does not fit under the last lines it moves to the next page as one unit,
   so no page carries only trailing text; the line table above it still
   breaks between rows as before. Spacing is not reduced for this. */
.print-closing { break-inside: avoid; }

/* R1d B6: the Phase 1 QR beside the totals, in its own grid column, so it
   never covers the totals, the lines or a branding band. 30 mm square
   (about 0.5 mm per module with the four-module quiet zone for a typical
   string, and at least 0.33 mm for the longest one the policy allows), vector-drawn on
   white, so it scans with background graphics off. The block is never split
   across pages. Only issues with a stored QR carry these classes. */
.print-qr-totals { display: grid; grid-template-columns: minmax(0, 1fr) 32mm; gap: 3mm; align-items: start; break-inside: avoid; margin-block-end: 3.5mm; }
.print-qr-totals > .table-wrap { margin-block-end: 0 !important; }
.print-qr { margin: 0; display: grid; justify-items: center; gap: 0.6mm; }
.print-qr svg { display: block; inline-size: 30mm; block-size: 30mm; }
.print-qr figcaption { display: grid; gap: 0; font-size: 6pt; line-height: 1.25; text-align: center; color: #333333; }
.print-qr figcaption [dir="rtl"] { font-family: var(--font-arabic); }
@media screen and (max-width: 40rem) {
    .print-qr-totals { grid-template-columns: 1fr; justify-items: center; }
}

/* Receipt branding (2026-10-28): a posted receipt prints in its company's
   invoice template. The names always show above the titles (with a logo-only
   branding area too, since a receipt has no seller block), template A adds
   the registration line, and the notice says it is not a tax invoice. */
.print-receipt.print-display-logo .print-kicker { display: block; }
.print-receipt-reg .print-brand-reg { text-align: center; margin-block-end: 3mm; }
.print-branded .print-receipt-notice { font-weight: 600; }

/* Archive and records downloads (tenant Sales - Archive, platform Billing - Tax document archive,
   and the parts page): space after the download button, then a closed "What is in the download". */
.archive-export .form-actions { margin-block-end: var(--space-6); }
.archive-about { margin-block-start: 0; padding-block-start: var(--space-4); border-block-start: 1px solid var(--color-border); }
.archive-about > summary { cursor: pointer; inline-size: fit-content; color: var(--color-accent); font-weight: 600; }
.archive-about > summary:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: var(--radius); }
.archive-about > ul { margin: var(--space-3) 0 0; padding-inline-start: var(--space-6); color: var(--color-muted); font-size: 0.9375rem; display: grid; gap: var(--space-2); }
.archive-parts-keep { margin-block: var(--space-4) 0; }

/* The branding form and the company page's branding panel. */
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); margin-block-end: var(--space-3); }
.panel-head h2 { margin: 0; }
.branding-choice > span { display: grid; gap: var(--space-1); }
.branding-choice strong { font-weight: 600; }
.branding-logo-current { margin-block-end: var(--space-3); }
.branding-logo-current :is(.muted, .hint) { margin-block-end: 0; }
.branding-logo-thumb { display: block; inline-size: auto; block-size: auto; max-inline-size: min(100%, 16rem); max-block-size: 5rem; object-fit: contain; padding: var(--space-2); background: #ffffff; border: 1px solid var(--color-border); border-radius: var(--radius); }
.branding-logo-field { margin-block-end: var(--space-3); }
.branding-logo-field input[type="file"] { display: block; max-inline-size: 100%; font: inherit; font-size: 0.9375rem; color: var(--color-text); cursor: pointer; }
.branding-logo-field input[type="file"]::file-selector-button {
    min-block-size: var(--control-height-md);
    margin-inline-end: var(--space-3);
    padding-block: var(--space-1);
    padding-inline: var(--space-4);
    font: inherit;
    font-weight: 600;
    color: var(--color-secondary-text);
    background: var(--color-secondary-bg);
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
}
.branding-logo-field input[type="file"]:not(:disabled):hover::file-selector-button { color: var(--color-secondary-hover-text); background: var(--color-secondary-hover-bg); }
.branding-logo-field input[type="file"]:disabled { cursor: not-allowed; }
.branding-logo-field input[type="file"]:disabled::file-selector-button { opacity: 0.6; cursor: not-allowed; }
.branding-logo-field input[type="file"]:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.branding-logo-field .hint { margin-block-start: var(--space-2); }
.branding-logo-note { margin-block: var(--space-3) 0; }
.branding-color-control { display: flex; align-items: center; gap: var(--space-2); max-inline-size: 16rem; }
.branding-color-control input[type="color"] { inline-size: var(--control-height-md); block-size: var(--control-height-md); flex: none; padding: 0.2rem; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-bg); cursor: pointer; }
.branding-color-control input[type="color"]:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.branding-color-control input[type="text"] { min-inline-size: 0; }
.branding-color-field { margin-block-end: 0; }
