/* حاسبة تكاليف الاستيراد — tokens + components. RTL-first, logical properties only.
   Load after fonts.css (self-hosted Cairo). No external resources. */

/* ───────── 1. Tokens ───────── */
:root {
  /* neutrals (warm) */
  --c-bg: #F6F4EF;
  --c-surface: #FFFEFB;
  --c-surface-2: #FBFAF6;      /* expanded rows, quiet panels */
  --c-surface-3: #F1EEE6;      /* table header, neutral chips */
  --c-field: #FFFFFF;
  --c-border: #E4DFD4;
  --c-border-soft: #EFEBE2;    /* row dividers */
  --c-border-strong: #C9C3B6;  /* inputs, secondary buttons */
  --c-text: #1F2421;
  --c-text-2: #3A413C;
  --c-text-muted: #5F665F;     /* 5.6:1 on --c-bg */
  --c-on-solid: #FFFFFF;
  --c-overlay: rgba(31, 36, 33, .5);

  /* brand / primary action */
  --c-accent: #1F5E4B;
  --c-accent-hover: #174A3B;
  --c-accent-soft: #E9F1ED;
  --c-accent-disabled: #8FA89F;

  --c-paid-fg: #1F6B45;      --c-paid-bg: #E6F2EA;

  /* due states: متأخر / قريباً / نشط */
  --c-overdue-fg: #8F2A1B; --c-overdue-bg: #FBEDE9; --c-overdue-border: #EBCFC8;
  --c-soon-fg: #7A4F00;    --c-soon-solid: #8A5A00;

  --c-danger: #A3301F; --c-danger-hover: #87261A; --c-danger-border: #D9A79E;
  --c-warning-fg: #7A4F00; --c-warning-bg: #FBF1D9; --c-warning-border: #D9BC6A;
  --c-toast-bg: #1F2421; --c-toast-success: #5FBF8F; --c-toast-error: #E0705F;

  /* type */
  --font: 'Cairo', system-ui, sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;
  --fs-xs: .8125rem;   /* 13 — column captions only */
  --fs-sm: .875rem;    /* 14 — secondary text, labels */
  --fs-md: .9375rem;   /* 15 — body */
  --fs-lg: 1rem;       /* 16 — row titles, inputs on touch */
  --fs-xl: 1.0625rem;  /* 17 — amounts, section titles */
  --fs-2xl: 1.25rem;   /* 20 — dialog title */
  --fs-3xl: 1.625rem;  /* 26 — page title */
  --lh: 1.6; --lh-tight: 1.3;
  --fw-regular: 400; --fw-medium: 600; --fw-bold: 700; --fw-heavy: 800;

  /* spacing (4px base) */
  --sp-1: .25rem; --sp-2: .5rem; --sp-3: .75rem; --sp-4: 1rem; --sp-5: 1.25rem; --sp-6: 1.5rem; --sp-8: 2rem; --sp-10: 2.5rem;

  /* shape */
  --r-sm: 4px; --r-md: 8px; --r-lg: 12px; --r-pill: 999px;
  --shadow-1: 0 2px 12px rgba(0, 0, 0, .08);
  --shadow-2: 0 12px 40px rgba(0, 0, 0, .25);
  --control-h: 44px;       /* minimum tap target */
  --control-h-sm: 36px;    /* desktop-only dense actions; grows to 44 on touch */
  --sidebar-w: 256px;
}


/* ───────── 2. Base ───────── */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; }
body { margin: 0; font-family: var(--font); font-size: var(--fs-md); line-height: var(--lh); color: var(--c-text); background: var(--c-bg); font-variant-numeric: tabular-nums; }
a { color: var(--c-accent); }
a:hover { color: var(--c-accent-hover); }
:focus-visible { outline: 3px solid var(--c-accent); outline-offset: 2px; }
.hidden { display: none !important; }
.muted { color: var(--c-text-muted); }
.ltr { direction: ltr; unicode-bidi: isolate; text-align: end; } /* IDs, phones, invoice numbers, e-mail */
.num { white-space: nowrap; }
.icon { inline-size: 1.25em; block-size: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ───────── 3. Shell ───────── */
.app { display: flex; min-block-size: 100vh; }
.sidebar { inline-size: var(--sidebar-w); flex: none; display: flex; flex-direction: column; gap: var(--sp-5); padding: var(--sp-5) .875rem; background: var(--c-surface); border-inline-end: 1px solid var(--c-border); position: sticky; inset-block-start: 0; block-size: 100vh; }
.main { flex: 1; min-inline-size: 0; max-inline-size: 1240px; padding: 1.75rem 2.25rem 3.5rem; display: flex; flex-direction: column; gap: var(--sp-6); }
.topbar { display: none; align-items: center; gap: var(--sp-3); }
.topbar__title { flex: 1; min-inline-size: 0; font-weight: var(--fw-heavy); font-size: var(--fs-xl); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-backdrop { display: none; position: fixed; inset: 0; background: var(--c-overlay); z-index: 35; }

.wordmark { display: flex; align-items: center; gap: .625rem; padding: var(--sp-1) var(--sp-2); }
.wordmark__mark { inline-size: 36px; block-size: 36px; border-radius: var(--r-md); background: var(--c-accent); display: flex; align-items: center; justify-content: center; gap: 3px; }
.wordmark__mark i { inline-size: 4px; background: var(--c-on-solid); border-radius: 1px; }
.wordmark__mark i:nth-child(1) { block-size: 10px; } .wordmark__mark i:nth-child(2) { block-size: 16px; } .wordmark__mark i:nth-child(3) { block-size: 13px; }
.wordmark__pre { font-size: .75rem; color: var(--c-text-muted); line-height: 1.2; }
.wordmark__name { font-weight: var(--fw-heavy); font-size: var(--fs-xl); line-height: var(--lh-tight); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__item { display: flex; align-items: center; gap: var(--sp-3); min-block-size: var(--control-h); padding-inline: var(--sp-3); border-radius: var(--r-md); color: var(--c-text-2); font-weight: var(--fw-medium); text-decoration: none; }
.nav__item:hover { background: var(--c-surface-2); color: var(--c-text); }
.nav__item[aria-current="page"] { background: var(--c-accent-soft); color: var(--c-accent); font-weight: var(--fw-bold); }
.nav__label { flex: 1; }
.user-box { margin-block-start: auto; border-block-start: 1px solid var(--c-border); padding: .875rem var(--sp-2) 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.user-box__links { display: flex; gap: var(--sp-4); font-size: var(--fs-sm); }
.user-box__links a { color: var(--c-text-2); }
.user-box__links a.is-danger { color: var(--c-danger); font-weight: var(--fw-medium); }

.page-title { font-size: var(--fs-3xl); font-weight: var(--fw-heavy); line-height: var(--lh-tight); margin: 0; }
.page-sub { color: var(--c-text-muted); margin: 0; }
.toolbar { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.toolbar__title { margin-inline-end: auto; }

/* ───────── 4. Buttons ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-block-size: var(--control-h); padding-inline: 1.125rem; border: 1px solid transparent; border-radius: var(--r-md); font: inherit; font-weight: var(--fw-bold); line-height: 1.2; cursor: pointer; text-decoration: none; white-space: nowrap; background: var(--c-accent); color: var(--c-on-solid); }
.btn:hover { background: var(--c-accent-hover); color: var(--c-on-solid); }
.btn--secondary { background: var(--c-surface); color: var(--c-text); border-color: var(--c-border-strong); }
.btn--secondary:hover { background: var(--c-surface-3); color: var(--c-text); }
.btn--danger { background: var(--c-danger); }                    /* confirm button of a destructive dialog */
.btn--danger:hover { background: var(--c-danger-hover); }
.btn--danger-outline { background: var(--c-surface); color: var(--c-danger); border-color: var(--c-danger-border); } /* حذف in lists */
.btn--danger-outline:hover { background: var(--c-overdue-bg); color: var(--c-danger); }
.btn--link { background: none; border: 0; padding-inline: var(--sp-2); color: var(--c-text-2); text-decoration: underline; font-weight: var(--fw-medium); }
.btn--link:hover { background: none; color: var(--c-text); }
.btn--link.is-danger { color: var(--c-danger); }
.btn--sm { min-block-size: var(--control-h-sm); padding-inline: var(--sp-3); font-size: var(--fs-sm); border-radius: 6px; }
.btn--block { inline-size: 100%; }
.btn--icon { inline-size: var(--control-h); padding: 0; }        /* icon-only: always give aria-label */
.btn:disabled, .btn[aria-disabled="true"] { background: var(--c-accent-disabled); border-color: transparent; color: var(--c-on-solid); cursor: not-allowed; }
.btn--secondary:disabled { background: var(--c-surface-3); color: var(--c-text-muted); border-color: var(--c-border); }
.btn.is-loading::before { content: ""; inline-size: 16px; block-size: 16px; border: 2px solid rgba(255, 255, 255, .5); border-block-start-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@media (pointer: coarse) { .btn--sm { min-block-size: var(--control-h); } }
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { inline-size: 40px; block-size: 40px; border: 3px solid var(--c-border); border-block-start-color: var(--c-accent); border-radius: 50%; animation: spin .8s linear infinite; }

/* ───────── 5. Form controls (native, styled) ───────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { display: flex; align-items: center; gap: var(--sp-2); min-block-size: 22px; font-size: var(--fs-sm); font-weight: var(--fw-medium); }
.input, .select { inline-size: 100%; min-block-size: var(--control-h); padding-inline: var(--sp-3); border: 1px solid var(--c-border-strong); border-radius: var(--r-md); background: var(--c-field); color: var(--c-text); font: inherit; }
.input::placeholder { color: var(--c-text-muted); }
.input:focus, .select:focus { outline: 3px solid var(--c-accent-soft); border-color: var(--c-accent); }
.field__hint { font-size: var(--fs-sm); color: var(--c-text-muted); }
.field__error { display: none; font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--c-danger); }
.field--error .input, .field--error .select { border: 2px solid var(--c-danger); }
.field--error .field__error { display: block; }
.form-section { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: var(--sp-5); padding-block: .875rem; border-block-end: 1px solid var(--c-border-soft); }
.form-section__title { margin: 0; padding-block-start: 26px; font-size: var(--fs-lg); font-weight: var(--fw-heavy); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .875rem; align-items: start; }
.form-grid .is-full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .625rem; flex-wrap: wrap; padding-block-start: 1.125rem; }

/* ───────── 6. Badges ───────── */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px .625rem; border: 1px solid; border-radius: var(--r-sm); font-size: var(--fs-sm); font-weight: var(--fw-bold); white-space: nowrap; }
.badge .icon { inline-size: 15px; block-size: 15px; stroke-width: 2; }
.role-badge { display: inline-block; padding-inline: var(--sp-2); border: 1px solid var(--c-text); border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: var(--fw-bold); }

/* ───────── 7. Cards ───────── */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); }
.card--pad { padding: 1.125rem var(--sp-5); }
.card__title { margin: 0 0 var(--sp-3); font-size: var(--fs-xl); font-weight: var(--fw-heavy); }

/* ───────── 8. Table ───────── */
.table-wrap { overflow-x: auto; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); }
.table { inline-size: 100%; border-collapse: collapse; }
.table th { padding: .625rem var(--sp-4); background: var(--c-surface-3); color: var(--c-text-2); font-size: var(--fs-sm); font-weight: var(--fw-bold); text-align: start; white-space: nowrap; }
.table td { padding: var(--sp-3) var(--sp-4); border-block-start: 1px solid var(--c-border-soft); vertical-align: middle; }
.table th:first-child, .table td:first-child { padding-inline-start: var(--sp-5); }
.table th:last-child, .table td:last-child { padding-inline-end: var(--sp-5); }
.table .is-end { text-align: end; }
.table .cell-title { font-size: var(--fs-lg); font-weight: var(--fw-bold); }
.table .cell-sub { font-size: var(--fs-sm); color: var(--c-text-muted); }
.table .cell-amount { font-size: var(--fs-xl); font-weight: var(--fw-heavy); text-align: end; white-space: nowrap; }
.table .cell-actions { white-space: nowrap; text-align: end; }
.table .cell-actions > * + * { margin-inline-start: 6px; }
.table tr.is-clickable { cursor: pointer; }
.table tr.is-clickable:hover td { background: var(--c-surface-2); }
.table tfoot td { border-block-start: 2px solid var(--c-text); background: var(--c-surface-2); font-weight: var(--fw-heavy); vertical-align: top; }
.chevron { transition: transform .15s; } [aria-expanded="true"] .chevron { transform: rotate(180deg); }
.list-row { display: flex; align-items: center; gap: var(--sp-3); min-block-size: 48px; border-block-end: 1px solid var(--c-border-soft); }
.list-row__grow { margin-inline-end: auto; }

/* ───────── 9. Dialog, toast, notices, empty ───────── */
.dialog-backdrop { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: var(--sp-4); background: var(--c-overlay); }
.dialog-backdrop.open { display: flex; }
.dialog { inline-size: 100%; max-inline-size: 480px; max-block-size: 90vh; overflow: auto; display: flex; flex-direction: column; gap: .875rem; padding: 1.375rem var(--sp-6); background: var(--c-surface); border-radius: var(--r-lg); box-shadow: var(--shadow-2); }
.dialog--wide { max-inline-size: 920px; }
.dialog__title { margin: 0; display: flex; align-items: center; gap: .625rem; font-size: var(--fs-2xl); font-weight: var(--fw-heavy); }
.dialog__sub { margin: 0; color: var(--c-text-muted); }
.dialog__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .625rem; margin-block-start: var(--sp-1); }
/* confirmations: coloured top bar + icon in the title; the confirm button takes the same colour */
.dialog--danger { max-inline-size: 420px; border-block-start: 6px solid var(--c-danger); }
.dialog--danger .dialog__title { color: var(--c-danger); }
.dialog--caution { max-inline-size: 420px; border-block-start: 6px solid var(--c-soon-solid); }
.dialog--caution .dialog__title { color: var(--c-soon-fg); }
.secret { direction: ltr; padding: .875rem; border: 2px solid var(--c-text); border-radius: var(--r-md); background: var(--c-field); font-family: var(--font-mono); font-size: 1.5rem; font-weight: var(--fw-bold); letter-spacing: 2px; text-align: center; user-select: all; }

.toast { position: fixed; inset-block-end: var(--sp-6); inset-inline-start: 50%; transform: translateX(50%); z-index: 60; max-inline-size: 90vw; padding: var(--sp-3) 1.125rem; border-radius: var(--r-md); border-inline-start: 6px solid var(--c-toast-success); background: var(--c-toast-bg); color: var(--c-bg); font-weight: var(--fw-bold); box-shadow: var(--shadow-2); opacity: 0; pointer-events: none; transition: opacity .3s; }
[dir="ltr"] .toast { transform: translateX(-50%); }
.toast.show { opacity: 1; }
.toast.e { border-inline-start-color: var(--c-toast-error); }

.notice { display: flex; gap: var(--sp-3); padding: .875rem 1.125rem; border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface); }
.notice > .icon { margin-block-start: 2px; inline-size: 22px; block-size: 22px; }
.notice__body { display: flex; flex-direction: column; gap: var(--sp-1); }
.notice__body > :first-child { font-weight: var(--fw-bold); }
.notice--warning { background: var(--c-warning-bg); border-color: var(--c-warning-border); } .notice--warning > .icon { color: var(--c-warning-fg); }
.notice--danger { background: var(--c-overdue-bg); border-color: var(--c-overdue-border); color: var(--c-overdue-fg); }
.empty { padding: 3rem var(--sp-5); text-align: center; background: var(--c-surface); border: 1px dashed var(--c-border-strong); border-radius: var(--r-md); font-size: var(--fs-xl); font-weight: var(--fw-bold); }
.loading-screen { min-block-size: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-4); }
.auth-card { inline-size: 100%; max-inline-size: 400px; display: flex; flex-direction: column; gap: var(--sp-4); padding: 2rem 1.75rem; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); }

/* ───────── 10. Responsive ───────── */
@media (max-width: 1099px) {
  .sidebar { display: none; position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 40; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .app.drawer-open .sidebar { display: flex; }
  .app.drawer-open .drawer-backdrop { display: block; }
  .topbar { display: flex; }
  .main { padding: var(--sp-4) var(--sp-4) 3rem; }
}
@media (max-width: 899px) {
  .form-section { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .form-section__title { padding-block-start: 0; }
}
@media (max-width: 699px) {
  .input, .select { font-size: var(--fs-lg); } /* 16px: no zoom on focus in iOS */
  /* .table--stack: each row becomes a block; give cells data-label where the header is needed */
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tfoot, .table--stack tr, .table--stack td { display: block; inline-size: 100%; }
  .table--stack tr { padding: var(--sp-3) var(--sp-4); border-block-start: 1px solid var(--c-border-soft); }
  .table--stack td { padding: 1px 0; border: 0; text-align: start; }
  .table--stack td:first-child, .table--stack td:last-child { padding-inline: 0; }
  .table--stack td[data-label]::before { content: attr(data-label) ": "; color: var(--c-text-muted); font-size: var(--fs-sm); }
  .table--stack .cell-amount { text-align: start; }
  .table--stack .cell-actions { padding-block-start: var(--sp-2); text-align: start; white-space: normal; }
  .table--stack .cell-actions .btn { min-block-size: var(--control-h); }
}

/* ───────── 12. App additions ───────── */
.page { display: none; }
.page.active { display: flex; flex-direction: column; gap: var(--sp-5); }
.btn--caution { background: var(--c-soon-solid); }
.btn--caution:hover { background: var(--c-soon-fg); }
.auth-screen { min-block-size: 100vh; display: flex; align-items: center; justify-content: center; padding: var(--sp-4); }
.auth-error { display: none; align-items: center; gap: var(--sp-2); color: var(--c-danger); font-weight: var(--fw-medium); font-size: var(--fs-sm); }
.auth-error:not(:empty) { display: flex; }
.page-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-3); }
.page-head .page-title { margin-inline-end: auto; }
.role-legend { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-6); color: var(--c-text-2); }
.form-grid .form-grid__action { align-self: end; }
.auth-form { display: flex; flex-direction: column; gap: var(--sp-4); }

.sr-only { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.users-table__perm { color: var(--c-text-2); }
input.secret { inline-size: 100%; color: var(--c-text); }

/* ───────── Import-costs additions ───────── */
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .875rem; align-items: start; }
.grid-form .is-full { grid-column: 1 / -1; }
.table--dense { border-collapse: separate; border-spacing: 0; }
.table--dense th { position: sticky; inset-block-start: 0; z-index: 1; text-align: center; }
.table--dense td { padding: 0; text-align: center; font-variant-numeric: tabular-nums; }
.table--dense td .input, .table--dense td .select { border: 0; border-radius: 0; background: transparent; text-align: center; font-variant-numeric: tabular-nums; min-block-size: 38px; padding-inline: var(--sp-2); }
.table--dense td .input:focus, .table--dense td .select:focus { background: var(--c-field); outline-offset: -3px; }
.cell-calc { background: var(--c-surface-2); color: var(--c-text-2); padding: 0 var(--sp-2); }
.cell-key { background: var(--c-accent-soft); color: var(--c-accent); font-weight: var(--fw-bold); }
.cell-sell { background: var(--c-paid-bg); color: var(--c-paid-fg); font-weight: var(--fw-bold); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-4); }
.kpi { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: .875rem 1.125rem; display: flex; flex-direction: column; gap: var(--sp-1); }
.kpi__label { font-size: var(--fs-sm); font-weight: var(--fw-bold); color: var(--c-text-muted); }
.kpi__value { font-size: var(--fs-2xl); font-weight: var(--fw-heavy); line-height: 1.3; }
.kpi--main { background: var(--c-accent); border-color: var(--c-accent); color: var(--c-on-solid); }
.kpi--main .kpi__label { color: var(--c-on-solid); }
.row-cancelled td { text-decoration: line-through; color: var(--c-text-muted); }
.row-cancelled td.nostrike { text-decoration: none; }
.badge--cancelled { color: var(--c-danger); background: var(--c-overdue-bg); border-color: var(--c-overdue-border); }
.banner-warn { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-3); padding: .875rem 1.125rem; border: 1px solid var(--c-warning-border); border-radius: var(--r-md); background: var(--c-warning-bg); color: var(--c-warning-fg); font-weight: var(--fw-medium); }
.banner-warn__text { flex: 1; }
.banner-warn--danger { background: var(--c-overdue-bg); border-color: var(--c-danger-border); color: var(--c-danger); }
/* Dimming only: the view must also set the native `inert` attribute on a locked container to block keyboard editing. */
[data-locked] { opacity: .7; }
[data-locked] [data-edit] { display: none; }

/* shipments list + shipment form */
.list-search { inline-size: auto; flex: 1; max-inline-size: 300px; }
.sf-body { display: flex; flex-direction: column; gap: var(--sp-5); }
.sf-h2 { margin: 0; font: inherit; }
.sf-hint { margin: var(--sp-2) 0 0; font-size: var(--fs-sm); }
.sf-exp { max-inline-size: 860px; }
.table--dense tfoot td, .table--dense td.cell-calc, .table--dense td.cell-sell { padding: var(--sp-2); white-space: nowrap; }
.table--dense .w-name { min-inline-size: 170px; }
.table--dense .w-code { min-inline-size: 90px; }
.table--dense .w-num { inline-size: 80px; min-inline-size: 60px; }
.table--dense .w-amount { min-inline-size: 110px; }
.table--dense .w-cat { min-inline-size: 150px; }
.table--dense .w-note { min-inline-size: 140px; }
textarea.input { padding-block: var(--sp-2); resize: vertical; }

/* ───────── Print (A4 landscape; only #print) ───────── */
#print { display: none; }
@page { size: A4 landscape; margin: 8mm; }
@media print {
  body { background: #fff; color: #000; font-size: 10pt; }
  body > * { display: none !important; }
  body > #print { display: block !important; }
  #print .table th, #print .table td { padding: 3pt 5pt; border: 1px solid #777; color: #000; background: none; }
  #print .table tr { break-inside: avoid; }
  #print.wide { font-size: 8pt; }
  #print h3 { margin: 0 0 4pt; font-size: 13pt; }
  #print h3.print-gap { margin-block-start: 10pt; }
  #print .meta { display: flex; flex-wrap: wrap; gap: 4pt 18pt; margin-block-end: 6pt; }
  #print .meta.print-sign { margin-block-start: 30pt; }
  #print .table.print-auto { inline-size: auto; }
  #print.wide .table th, #print.wide .table td { padding: 2pt 3pt; }
}

/* register, VAT, library, legacy import */
.reg-year { inline-size: auto; }
.check { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--c-text-muted); font-size: var(--fs-sm); cursor: pointer; }
.reg-table th { white-space: normal; min-inline-size: 80px; }
.reg-table td { padding: var(--sp-2) var(--sp-3); white-space: nowrap; }
.vat-head { max-inline-size: 560px; }
.vat-table th { white-space: normal; }
.vat-table td.cell-calc { padding: var(--sp-2); white-space: nowrap; }
.vat-table .w-amount { min-inline-size: 100px; }
.vat-table .input::placeholder { color: #8E948C; } /* "الخانات الباهتة = قيمة محسوبة" */
.lib-hs { max-inline-size: 760px; }
.table--dense .w-desc { min-inline-size: 220px; }
.table--dense td.lib-empty, .reg-table td.muted { padding: var(--sp-4); }
.lib-note { margin: 0 0 var(--sp-3); }
.li-counts { margin: 0; padding-inline-start: var(--sp-5); font-weight: var(--fw-medium); }
.li-rej-title { margin: var(--sp-3) 0 var(--sp-2); color: var(--c-danger); font-weight: var(--fw-bold); }
@media print { #print .row-cancelled td { color: #888; text-decoration: line-through; } }
