/* DEJAVU Transport & Financial Management System — interface styles.
   Dark charcoal navigation, light working surfaces, restrained status accents.
   Uses CSS logical properties so RTL (Kurdish, Arabic) and LTR (English) share one stylesheet. */

/* Colour, spacing and type tokens are defined in themes.css. */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: calc(14.5px * var(--fs-scale))/1.55 var(--font); font-feature-settings: "tnum" 1, "lnum" 1;
}
[dir="rtl"] body { font-family: var(--font-rtl); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
.ic { width: 20px; height: 20px; flex: none; }
.muted { color: var(--text-3); }
.small { font-size: calc(12.5px * var(--fs-scale)); }
.nowrap { white-space: nowrap; }
.num, .money { font-variant-numeric: tabular-nums; white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] td.money, [dir="rtl"] th.money { text-align: left; }
td.money, th.money { text-align: end; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.zero { color: var(--text-3); }
.src { font-family: inherit; unicode-bidi: plaintext; }

/* ---------------------------------------------------------------- layout */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--nav-scroll) transparent;
  background: linear-gradient(180deg, var(--nav-bg) 0%, var(--nav-bg-2) 100%);
  border-inline-end: 1px solid var(--nav-line); color: var(--nav-text); padding: 18px 14px 28px; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 18px; border-bottom: 1px solid var(--nav-line); margin-bottom: 14px; color: var(--nav-strong); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; font-size: calc(17px * var(--fs-scale)); color: var(--brand-fg);
  background: linear-gradient(140deg, var(--brand-1) 0%, var(--brand-2) 100%); box-shadow: inset 0 -2px 0 rgba(0,0,0,.12), 0 6px 16px -6px color-mix(in srgb, var(--accent) 55%, transparent);
  font-family: "Inter", system-ui, sans-serif; letter-spacing: -.04em;
}
.brand-name { font-family: "Inter", system-ui, sans-serif; font-weight: 800; letter-spacing: .26em; font-size: calc(16px * var(--fs-scale)); direction: ltr; }
.brand-sub { font-size: calc(11px * var(--fs-scale)); color: var(--nav-muted); letter-spacing: .02em; line-height: 1.3; display: block; }
.nav-group { margin: 16px 4px 6px; font-size: calc(10.5px * var(--fs-scale)); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--nav-muted); }
[dir="rtl"] .nav-group { letter-spacing: 0; font-size: calc(11.5px * var(--fs-scale)); }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: var(--nav-item-pad); margin: 3px 0; border-radius: var(--radius-sm); color: var(--nav-text);
  font-weight: 500; position: relative; transition: background .15s, color .15s;
}
.nav a:hover { background: var(--nav-hover); color: var(--nav-strong); text-decoration: none; }
.nav a .tile {
  width: var(--nav-tile); height: var(--nav-tile); border-radius: var(--radius-sm); display: grid; place-items: center; flex: none;
  background: var(--nav-tile-bg); border: 1px solid var(--nav-tile-line); color: var(--nav-tile-fg); transition: all .15s;
}
.nav a .tile .ic { width: 18px; height: 18px; }
.nav a:hover .tile { border-color: var(--nav-tile-hover); color: var(--nav-strong); }
.nav a.active { background: var(--nav-active-bg); color: var(--nav-strong); box-shadow: inset 0 0 0 1px var(--nav-active-ring); }
.nav a.active .tile { background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 72%, #000)); border-color: transparent; color: var(--accent-ink); box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--accent) 80%, transparent); }
.nav a.active::before { content: ""; position: absolute; inset-inline-start: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--accent); }
.nav .count { margin-inline-start: auto; font-size: calc(11px * var(--fs-scale)); background: var(--nav-count-bg); color: var(--nav-count-fg); padding: 1px 8px; border-radius: 20px; }
.nav .count.warn { background: var(--nav-warn-bg); color: var(--nav-warn-fg); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 12px 28px;
  background: var(--topbar-bg); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: calc(19px * var(--fs-scale)); font-weight: 700; }
.topbar .crumb { font-size: calc(12px * var(--fs-scale)); color: var(--text-3); }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; background: var(--ink); color: var(--ink-fg); border: 0; border-radius: 10px; width: 40px; height: 40px; cursor: pointer; }
.lang-switch { display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; }
.lang-switch a { padding: 4px 10px; border-radius: var(--radius-xs); color: var(--text-2); font-size: calc(12.5px * var(--fs-scale)); font-weight: 600; }
.lang-switch a.on { background: var(--ink); color: var(--ink-fg); }
.lang-switch a:hover { text-decoration: none; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
[dir="rtl"] .user-chip { padding: 4px 12px 4px 6px; }
.user-chip .who { line-height: 1.15; }
.user-chip .who b { font-size: calc(13px * var(--fs-scale)); display: block; }
.user-chip .who span { font-size: calc(11px * var(--fs-scale)); color: var(--text-3); }
.avatar { width: 32px; height: 32px; border-radius: var(--radius-xs); background: var(--ink); color: var(--ink-fg); display: grid; place-items: center; font-weight: 700; font-size: calc(13px * var(--fs-scale)); }
.content { padding: var(--pad-content); flex: 1; }
.footer { padding: 18px 28px; border-top: 1px solid var(--line); color: var(--text-3); font-size: calc(12.5px * var(--fs-scale)); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer a { color: var(--text); font-weight: 600; }

/* ---------------------------------------------------------------- page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { font-size: calc(24px * var(--fs-scale)); font-weight: 800; }
.page-head .sub { color: var(--text-3); margin-top: 2px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- cards & grid */
.grid { display: grid; gap: var(--gap); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: var(--pad-head); border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: calc(15px * var(--fs-scale)); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-head .ic { color: var(--text-3); }
.card-body { padding: var(--pad-card); }
.card-body.flush { padding: 0; }
.section-title { font-size: calc(13px * var(--fs-scale)); font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; margin: 26px 0 10px; display: flex; align-items: center; gap: 10px; }
[dir="rtl"] .section-title { letter-spacing: 0; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.section-title .badge { white-space: normal; }

/* KPI tiles */
.kpi { position: relative; padding: var(--pad-card); display: block; color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s; overflow: hidden; }
a.kpi:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.kpi .label { font-size: calc(12.5px * var(--fs-scale)); color: var(--text-3); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kpi .label .ic { width: 16px; height: 16px; }
.kpi .value { font-size: calc(28px * var(--fs-scale)); font-weight: 800; letter-spacing: -.02em; margin-top: 6px; line-height: 1.15; }
.kpi .meta { font-size: calc(12px * var(--fs-scale)); color: var(--text-3); margin-top: 4px; }
.kpi::after { content: ""; position: absolute; inset-inline-end: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--text) 6%, transparent), transparent 70%); }
.kpi.dark { background: linear-gradient(150deg, var(--hero-1), var(--hero-2)); color: var(--hero-fg); border-color: var(--hero-line); }
.kpi.dark .label, .kpi.dark .meta { color: var(--hero-muted); }

/* currency pair tiles */
.cur-tile { padding: var(--pad-card); display: block; color: inherit; }
a.cur-tile:hover { text-decoration: none; background: var(--surface-2); }
.cur-tile .label { font-size: calc(12.5px * var(--fs-scale)); font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cur-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 3px 0; }
.cur-row .amt { font-size: calc(19px * var(--fs-scale)); font-weight: 800; letter-spacing: -.01em; }
.cur-row + .cur-row { border-top: 1px dashed var(--line); }
.cur { display: inline-block; font-size: calc(10.5px * var(--fs-scale)); font-weight: 800; letter-spacing: .06em; padding: 2px 7px; border-radius: 6px; direction: ltr; }
.cur-iqd { background: var(--cur-iqd-bg); color: var(--cur-iqd-fg); border: 1px solid var(--cur-iqd-line); }
.cur-usd { background: var(--cur-usd-bg); color: var(--cur-usd-fg); border: 1px solid var(--cur-usd-line); }
.tone-green { box-shadow: inset 3px 0 0 var(--green); }
.tone-amber { box-shadow: inset 3px 0 0 var(--amber); }
.tone-red { box-shadow: inset 3px 0 0 var(--red); }
[dir="rtl"] .tone-green { box-shadow: inset -3px 0 0 var(--green); }
[dir="rtl"] .tone-amber { box-shadow: inset -3px 0 0 var(--amber); }
[dir="rtl"] .tone-red { box-shadow: inset -3px 0 0 var(--red); }

/* account quick tiles */
.acct-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.acct-tile { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: inherit; transition: all .15s; }
.acct-tile:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow-2); }
.acct-tile .nm { font-weight: 700; display: flex; justify-content: space-between; gap: 6px; }
.acct-tile .orig { font-size: calc(12px * var(--fs-scale)); color: var(--text-3); }
.acct-tile .bal { font-size: calc(13px * var(--fs-scale)); display: flex; justify-content: space-between; }

/* ---------------------------------------------------------------- buttons & forms */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); min-height: var(--ctl-h);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: calc(13.5px * var(--fs-scale)); cursor: pointer; transition: all .15s; white-space: nowrap; text-decoration: none;
}
.btn:hover { border-color: var(--text-2); text-decoration: none; }
.btn .ic { width: 17px; height: 17px; }
.btn-primary { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }
.btn-primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn-green { background: var(--green); color: var(--btn-green-fg, #fff); border-color: var(--green); }
.btn-green:hover { background: color-mix(in srgb, var(--green) 85%, #000); border-color: color-mix(in srgb, var(--green) 85%, #000); }
.btn-accent { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-accent:hover { background: color-mix(in srgb, var(--accent) 86%, #000); }
.btn-danger { background: var(--surface); color: var(--red); border-color: var(--red-line); }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-amber { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-line); }
.btn-sm { padding: 5px 10px; font-size: calc(12.5px * var(--fs-scale)); border-radius: var(--radius-xs); min-height: 0; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); }
.btn[disabled] { opacity: .5; pointer-events: none; }

.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.f-12 { grid-column: span 12; } .f-8 { grid-column: span 8; } .f-6 { grid-column: span 6; } .f-4 { grid-column: span 4; } .f-3 { grid-column: span 3; } .f-2 { grid-column: span 2; }
.lbl { display: block; font-size: calc(12.5px * var(--fs-scale)); font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
label.lbl .req, .lbl .req { color: var(--red); }
.hint { font-size: calc(12px * var(--fs-scale)); color: var(--text-3); margin-top: 4px; }
input[type=text], input[type=number], input[type=date], input[type=password], input[type=email], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--text); font: inherit; font-size: calc(14px * var(--fs-scale));
  transition: border-color .15s, box-shadow .15s; min-height: var(--ctl-h);
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }
::placeholder { color: var(--text-3); opacity: 1; }
option { background: var(--surface); color: var(--text); }
input.amount { font-size: calc(18px * var(--fs-scale)); font-weight: 700; font-variant-numeric: tabular-nums; direction: ltr; text-align: end; }
.money-input { display: flex; gap: 8px; }
.money-input input { flex: 1; }
.money-input select { width: 110px; flex: none; font-weight: 700; }
.check { display: flex; align-items: center; gap: 8px; font-size: calc(13.5px * var(--fs-scale)); cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
input[type=color] { width: 46px; height: var(--ctl-h); padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--input-bg); cursor: pointer; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; background: var(--input-bg); }
.seg label { padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: calc(13px * var(--fs-scale)); border-inline-end: 1px solid var(--line); }
.seg label:last-child { border-inline-end: 0; }
.seg input { display: none; }
.seg input:checked + span { color: var(--ink-fg); }
.seg label:has(input:checked) { background: var(--ink); color: var(--ink-fg); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; flex-wrap: wrap; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; margin: 0; }
legend { padding: 0 6px; font-weight: 700; font-size: calc(13px * var(--fs-scale)); color: var(--text-2); }

/* filters */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; padding: 14px 16px; }
.filters .fi { min-width: 150px; flex: 1 1 150px; max-width: 260px; }
.filters .fi.wide { max-width: 360px; flex-basis: 240px; }
.filters label { font-size: calc(11.5px * var(--fs-scale)); font-weight: 600; color: var(--text-3); display: block; margin-bottom: 4px; }
.filters input, .filters select { min-height: calc(var(--ctl-h) - 4px); padding: 6px 10px; font-size: calc(13.5px * var(--fs-scale)); }
.period-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.period-pills a { padding: 6px 12px; border-radius: var(--radius-pill); background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: calc(12.5px * var(--fs-scale)); font-weight: 600; }
.period-pills a:hover { text-decoration: none; border-color: var(--text-2); }
.period-pills a.on { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: calc(13.5px * var(--fs-scale)); }
.tbl th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-3); font-weight: 700; font-size: calc(11.5px * var(--fs-scale)); text-transform: uppercase; letter-spacing: .05em; text-align: start; padding: var(--pad-cell); border-bottom: 1px solid var(--line); white-space: nowrap; }
[dir="rtl"] .tbl th { letter-spacing: 0; font-size: calc(12px * var(--fs-scale)); }
.tbl td { padding: var(--pad-cell); border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr { transition: background .1s; }
.tbl tbody tr:hover { background: var(--surface-3); }
.tbl tr.row-muted td { color: var(--text-3); }
.tbl tr.row-warn td { background: var(--row-warn); }
.tbl tr.row-bad td { background: var(--row-bad); }
.tbl tfoot td { font-weight: 800; background: var(--surface-2); border-top: 2px solid var(--line-strong); }
.tbl .actions { white-space: nowrap; text-align: end; }
.tbl a.rowlink { color: var(--text); font-weight: 600; }
.empty { padding: 40px 20px; text-align: center; color: var(--text-3); }
.empty .ic { width: 38px; height: 38px; color: var(--line-strong); margin-bottom: 8px; }
.pager { display: flex; gap: 6px; align-items: center; justify-content: space-between; padding: 12px 16px; flex-wrap: wrap; font-size: calc(13px * var(--fs-scale)); color: var(--text-3); }
.pager .pages { display: flex; gap: 4px; }
.pager a, .pager span.cur-page { padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--radius-xs); background: var(--surface); color: var(--text-2); }
.pager span.cur-page { background: var(--ink); color: var(--ink-fg); border-color: var(--ink); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: var(--radius-pill); font-size: calc(11.5px * var(--fs-scale)); font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.badge-ok { background: var(--green-bg); color: var(--green); border-color: var(--green-line); }
.badge-warn { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-line); }
.badge-bad { background: var(--red-bg); color: var(--red); border-color: var(--red-line); }
.badge-info { background: var(--blue-bg); color: var(--blue); border-color: var(--blue-line); }
.badge-muted { background: var(--muted-bg); color: var(--text-3); border-color: var(--line); }

/* alerts */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 14px; font-size: calc(13.5px * var(--fs-scale)); }
.alert .ic { margin-top: 1px; }
.alert-success { background: var(--green-bg); border-color: var(--green-line); color: var(--green-text); }
.alert-error { background: var(--red-bg); border-color: var(--red-line); color: var(--red-text); }
.alert-warn { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber-text); }
.alert-info { background: var(--blue-bg); border-color: var(--blue-line); color: var(--blue-text); }
.alert a { color: inherit; text-decoration: underline; }

/* detail lists */
dl.kv { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: 0; margin: 0; }
dl.kv dt, dl.kv dd { padding: 9px 0; border-bottom: 1px solid var(--line); margin: 0; }
dl.kv dt { color: var(--text-3); font-size: calc(12.5px * var(--fs-scale)); font-weight: 600; }
dl.kv dd { font-weight: 600; }

/* charts (server-rendered SVG) */
.chart { width: 100%; height: auto; display: block; }
.chart text { font-family: inherit; font-size: calc(11px * var(--fs-scale)); fill: var(--text-3); }
.chart .bar { fill: var(--accent-2); transition: opacity .15s; }
.chart .bar.alt { fill: var(--accent); }
.chart .bar:hover { opacity: .8; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .line { fill: none; stroke: var(--accent-2); stroke-width: 2.2; }
.chart .area { fill: url(#areaGrad); }
.chart .area-stop { stop-color: var(--accent-2); }
.chart .dot { fill: var(--chart-dot); stroke: var(--accent-2); stroke-width: 2; }
.hbar { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; padding: 6px 0; font-size: calc(13px * var(--fs-scale)); }
.hbar .track { height: 9px; background: var(--chart-track); border-radius: 9px; overflow: hidden; }
.hbar .fill { height: 100%; background: linear-gradient(90deg, var(--accent-2), color-mix(in srgb, var(--accent-2) 70%, var(--surface))); border-radius: 9px; }
[dir="rtl"] .hbar .fill { background: linear-gradient(270deg, var(--accent-2), color-mix(in srgb, var(--accent-2) 70%, var(--surface))); }
.hbar a { color: var(--text); }
.legend { display: flex; gap: 14px; font-size: calc(12px * var(--fs-scale)); color: var(--text-3); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* login */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--auth-bg); }
.auth-art { position: relative; padding: 48px; color: var(--auth-fg); display: flex; flex-direction: column; justify-content: space-between; overflow: hidden;
  background: radial-gradient(1200px 600px at 20% 10%, var(--auth-glow-1) 0%, transparent 55%), radial-gradient(900px 500px at 90% 90%, var(--auth-glow-2) 0%, transparent 55%), var(--auth-bg); }
.auth-art .grid-bg { position: absolute; inset: 0; background-image: linear-gradient(var(--auth-grid) 1px, transparent 1px), linear-gradient(90deg, var(--auth-grid) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(circle at 40% 40%, #000 30%, transparent 75%); }
.auth-art h1 { font-size: calc(40px * var(--fs-scale)); line-height: 1.1; font-weight: 800; max-width: 520px; position: relative; letter-spacing: -.02em; }
.auth-art p { color: var(--auth-muted); max-width: 460px; position: relative; }
.auth-stats { display: flex; gap: 28px; position: relative; }
.auth-stats div b { display: block; font-size: calc(22px * var(--fs-scale)); color: var(--auth-fg); }
.auth-stats div span { font-size: calc(12px * var(--fs-scale)); color: var(--auth-muted); }
.auth-art .brand-name { color: var(--auth-fg); }
.auth-panel { background: var(--bg); display: grid; place-items: center; padding: 32px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .card { padding: 28px; box-shadow: var(--shadow-2); }

/* appearance: theme gallery (each .tp carries its own data-theme, so it renders that theme) */
.brand-mark-ink { background: var(--ink); color: var(--ink-fg); }
.theme-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: var(--gap); }
.theme-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s, transform .15s; }
.theme-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); transform: translateY(-2px); }
.theme-card.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-card.is-preview { box-shadow: 0 0 0 2px var(--blue); }
.theme-card .tc-current { display: none; }
.theme-card.is-current .tc-current { display: inline-flex; }
.theme-info { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.theme-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.theme-title h4 { font-size: calc(15px * var(--fs-scale)); font-weight: 800; }
.theme-info p { margin: 0; line-height: 1.45; }
.theme-swatches { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sw-set { display: inline-flex; border-radius: 20px; padding: 2px; border: 1px solid var(--line); background: var(--surface); }
.sw-set i { width: 14px; height: 14px; border-radius: 50%; display: block; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .25); }
.sw-set i + i { margin-inline-start: -3px; }
.theme-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }

.tp { --r: 7px; display: grid; grid-template-columns: 22% 1fr; height: 168px; background: var(--bg); color: var(--text); font-family: var(--font); direction: ltr; border-bottom: 1px solid var(--line); overflow: hidden; user-select: none; }
[hidden] { display: none !important; }
.tp-nav { background: linear-gradient(180deg, var(--nav-bg), var(--nav-bg-2)); padding: 9px 7px; display: flex; flex-direction: column; gap: 6px; border-inline-end: 1px solid var(--nav-line); }
.tp-brand { width: 18px; height: 18px; border-radius: 5px; background: linear-gradient(140deg, var(--brand-1), var(--brand-2)); color: var(--brand-fg); font: 800 10px/18px Inter, system-ui, sans-serif; text-align: center; margin-bottom: 4px; }
.tp-nav i { display: block; height: 8px; border-radius: 3px; background: var(--nav-tile-bg); border: 1px solid var(--nav-tile-line); }
.tp-nav i.on { background: var(--accent); border-color: transparent; box-shadow: 0 0 10px -2px var(--accent); }
.tp-main { padding: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tp-top { display: flex; align-items: center; justify-content: space-between; }
.tp-top b { width: 44%; height: 7px; border-radius: 3px; background: var(--text); opacity: .8; }
.tp-btn, .tp-btn2 { display: inline-grid; place-items: center; min-width: 18px; height: 14px; padding: 0 5px; border-radius: 4px; font: 700 9px/1 Inter, system-ui, sans-serif; background: var(--ink); color: var(--ink-fg); }
.tp-btn2 { background: var(--surface); border: 1px solid var(--line-strong); min-width: 26px; }
.tp-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.tp-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 6px; box-shadow: var(--shadow-1); min-width: 0; }
.tp-kpi small { display: block; font-size: 7px; color: var(--text-3); font-weight: 700; letter-spacing: .04em; }
.tp-kpi b { display: block; font-size: 10.5px; font-weight: 800; white-space: nowrap; overflow: hidden; }
.tp-hero { background: linear-gradient(150deg, var(--hero-1), var(--hero-2)); border-color: var(--hero-line); color: var(--hero-fg); }
.tp-hero small { color: var(--hero-muted); }
.tp-pos { color: var(--green); } .tp-neg { color: var(--red); }
.tp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; flex: 1; min-height: 0; }
.tp-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 5px; min-width: 0; }
.tp-chart { width: 100%; height: 100%; display: block; }
.tp-chart rect { fill: var(--accent-2); } .tp-chart rect.alt { fill: var(--accent); }
.tp-table { display: flex; flex-direction: column; justify-content: space-around; }
.tp-table div { display: flex; align-items: center; justify-content: space-between; gap: 4px; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.tp-table div:last-child { border-bottom: 0; }
.tp-table span { height: 5px; width: 55%; border-radius: 3px; background: var(--text-3); opacity: .55; }
.tp-table em { width: 22px; height: 8px; border-radius: 6px; border: 1px solid; }
.tp-table em.ok { background: var(--green-bg); border-color: var(--green-line); }
.tp-table em.warn { background: var(--amber-bg); border-color: var(--amber-line); }
.tp-table em.bad { background: var(--red-bg); border-color: var(--red-line); }
.tp-form { display: flex; gap: 5px; align-items: center; }
.tp-input { flex: 1; height: 14px; border-radius: 4px; background: var(--input-bg); border: 1px solid var(--line-strong); box-shadow: 0 0 0 2px var(--focus-ring); }

.preview-bar { display: none; position: sticky; top: 70px; z-index: 20; align-items: center; gap: 12px; padding: 10px 14px; margin-bottom: var(--gap);
  background: var(--surface); border: 1px solid var(--blue-line); border-radius: var(--radius-sm); box-shadow: var(--shadow-2); flex-wrap: wrap; }
.preview-bar.show { display: flex; }
.preview-bar > .ic { color: var(--blue); }
.preview-bar .small { display: block; color: var(--text-3); }
.preview-bar .spacer { flex: 1; }
.seg-wrap { display: flex; width: 100%; }
.seg-wrap label { flex: 1 1 0; text-align: center; padding: 8px 8px; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.seg label.is-off { opacity: .4; cursor: not-allowed; }
.seg label .ic { width: 15px; height: 15px; vertical-align: -3px; }
.color-field { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.color-field input[type=color] { width: 46px; height: 34px; padding: 2px; }
.contrast { font-size: calc(12px * var(--fs-scale)); font-weight: 600; color: var(--text-3); }
.contrast.ok { color: var(--green); } .contrast.low { color: var(--red); }
.toast { position: fixed; inset-inline-end: 20px; bottom: 20px; z-index: 60; max-width: 380px; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--ink); color: var(--ink-fg);
  box-shadow: var(--shadow-2); font-weight: 600; opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
.toast.err { background: var(--red); color: #fff; }
.theme-pick { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.theme-pick a { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); display: block; background: linear-gradient(135deg, var(--a) 50%, var(--b) 50%); }
.theme-pick a.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
html { transition: background-color .2s; }
.maint-bar { background: var(--amber-bg); color: var(--amber-text); border-bottom: 1px solid var(--amber-line); padding: 8px 18px; font-weight: 600; font-size: calc(13px * var(--fs-scale)); }

.clean-list { margin: 8px 0; padding-inline-start: 18px; }
.clean-list li { margin: 4px 0; }
.file-list { max-height: 260px; overflow: auto; margin: 0; padding: 8px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-xs); font-size: calc(12.5px * var(--fs-scale)); direction: ltr; text-align: left; }
.file-list li { list-style: none; padding: 2px 0; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.steps-log { margin: 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-xs); font: calc(12.5px * var(--fs-scale))/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; direction: ltr; text-align: left; max-height: 360px; overflow: auto; }
.danger-zone { border-color: var(--red-line); }
.danger-zone .card-head h3 .ic { color: var(--red); }

/* ---------------------------------------------------------------- printed documents (receipts, vouchers, invoices) */
.doc-body { background: #e8eaed; color: #111; }
.doc-toolbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 10px 18px; background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid #d6d9de; backdrop-filter: blur(8px); }
.doc-toolbar-title { flex: 1; font-weight: 700; text-align: center; color: #333; }
.doc-toolbar .btn .ic { width: 16px; height: 16px; }
[dir="ltr"] .doc-toolbar .btn:first-child .ic { transform: rotate(180deg); }
.doc-sheet { position: relative; width: 210mm; min-height: 297mm; margin: 22px auto 40px; padding: 14mm 14mm 12mm; background: #fff; color: #111;
  box-shadow: 0 10px 40px -12px rgba(0, 0, 0, .35); display: flex; flex-direction: column; gap: 14px; font-size: 13px; line-height: 1.5; }
.doc-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 14px; border-bottom: 3px solid #111; position: relative; }
.doc-header::after { content: ""; position: absolute; inset-inline: 0; bottom: -7px; height: 1px; background: #111; }
.doc-brand { display: flex; gap: 12px; align-items: center; }
.doc-mark { width: 52px; height: 52px; border-radius: 12px; display: grid; place-items: center; background: #111; color: #fff; font: 800 26px/1 Inter, system-ui, sans-serif;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; flex: 0 0 auto; }
.doc-company { font-size: 20px; font-weight: 800; line-height: 1.2; }
.doc-brandline { font: 700 10px Inter, system-ui, sans-serif; letter-spacing: .18em; text-transform: uppercase; color: #666; margin-top: 2px; direction: ltr; text-align: start; }
.doc-contact { font-size: 12px; color: #444; margin-top: 3px; }
.doc-meta { text-align: end; min-width: 200px; }
.doc-title { font-size: 21px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 6px; }
.doc-meta-table { margin-inline-start: auto; border-collapse: collapse; font-size: 12.5px; }
.doc-meta-table th { color: #666; font-weight: 600; text-align: start; padding: 2px 0; padding-inline-end: 12px; }
.doc-meta-table td { font-weight: 700; text-align: end; padding: 2px 0; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.doc-party { border: 1px solid #d9dce1; border-radius: 10px; padding: 10px 14px; }
.doc-party h4 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #777; margin: 0 0 4px; font-weight: 700; }
[dir="rtl"] .doc-party h4 { letter-spacing: 0; font-size: 12px; }
.doc-party-name { font-size: 16px; font-weight: 800; margin-bottom: 2px; }
.doc-party div { font-size: 12.5px; color: #333; }
.doc-amount { border: 1px solid #d9dce1; border-inline-start: 5px solid #111; border-radius: 10px; padding: 10px 16px; background: #f6f7f9;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc-amount-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #666; font-weight: 700; }
[dir="rtl"] .doc-amount-label { letter-spacing: 0; font-size: 12px; }
.doc-amount-value { font-size: 28px; font-weight: 800; letter-spacing: -.01em; line-height: 1.25; }
.doc-amount-words { font-size: 13px; font-style: italic; color: #333; }
[dir="rtl"] .doc-amount-words { font-style: normal; }
.doc-table, .doc-grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.doc-table th { text-align: start; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #333; background: #eef0f3; padding: 7px 10px;
  border-bottom: 2px solid #111; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
[dir="rtl"] .doc-table th { letter-spacing: 0; font-size: 12px; }
.doc-table td { padding: 7px 10px; border-bottom: 1px solid #e3e5e9; vertical-align: top; }
.doc-table .money, .doc-table th.money { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-table tfoot th { background: none; border-bottom: 0; text-align: end; text-transform: none; letter-spacing: 0; font-size: 12.5px; color: #444; padding: 6px 10px; }
.doc-table tfoot td { padding: 6px 10px; border-bottom: 0; }
.doc-table tfoot tr.doc-total th, .doc-table tfoot tr.doc-total td { border-top: 2px solid #111; font-size: 14.5px; font-weight: 800; color: #111; }
.doc-grid th, .doc-grid td { border: 1px solid #d9dce1; padding: 6px 9px; text-align: start; vertical-align: top; }
.doc-grid th { width: 18%; background: #f6f7f9; color: #555; font-weight: 600; font-size: 11.5px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc-grid td { font-weight: 600; }
.doc-words { font-size: 12.5px; padding: 6px 12px; border-inline-start: 3px solid #111; background: #f6f7f9; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc-notes, .doc-details { font-size: 12.5px; color: #333; }
.doc-details { display: grid; gap: 3px; }
.doc-terms { font-size: 11.5px; color: #555; margin: 0; }
.doc-signatures { display: grid; gap: 28px; margin-top: auto; padding-top: 46px; }
.doc-signatures div { text-align: center; font-size: 12px; font-weight: 600; color: #333; }
.doc-signatures span { display: block; border-top: 1px solid #333; margin-bottom: 6px; }
.doc-footer { border-top: 1px solid #d9dce1; padding-top: 8px; font-size: 11px; color: #666; }
.doc-note { margin-bottom: 4px; color: #333; }
.doc-foot-line { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.doc-stamp { display: inline-block; margin-top: 8px; transform: rotate(-5deg); border: 3px double currentColor; border-radius: 8px; padding: 4px 16px;
  font: 800 22px/1.2 Inter, "Vazirmatn", system-ui, sans-serif; text-transform: uppercase; letter-spacing: .08em; opacity: .75; pointer-events: none; }
.doc-stamp-void { color: #b3261e; } .doc-stamp-ok { color: #11744f; } .doc-stamp-warn { color: #9a5b00; }
@media screen and (max-width: 860px) {
  .doc-sheet { width: auto; min-height: 0; margin: 10px; padding: 18px; }
  .doc-header { flex-direction: column; } .doc-meta { text-align: start; } .doc-meta-table { margin-inline-start: 0; }
  .doc-parties { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- print-mode view (?print=1) on screen */
.print-mode .sidebar, .print-mode .topbar, .print-mode .footer, .print-mode .no-print, .print-mode .filters, .print-mode .pager,
.print-mode .page-head .actions, .print-mode .period-pills, .print-mode .alert { display: none !important; }
.print-mode .app { display: block; }
.print-mode .main { margin: 0; }
.print-mode .content { max-width: 1400px; margin: 0 auto; }
.print-mode .print-only { display: block !important; }
.print-mode .print-head.print-only { display: flex !important; }
.print-mode .doc-toolbar { margin: -24px -28px 18px; }
.th-sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.th-sort:hover, .th-sort:focus-visible { color: var(--text); text-decoration: underline; }
.th-sort[data-dir="asc"]::after { content: "▲"; font-size: 8px; } .th-sort[data-dir="desc"]::after { content: "▼"; font-size: 8px; }
.linklike { all: unset; cursor: pointer; color: var(--link); font-weight: 600; }
.linklike:hover { text-decoration: underline; }
.print-head .print-brand { display: flex; align-items: center; gap: 10px; }
.print-head .print-brand .doc-mark { width: 36px; height: 36px; font-size: 18px; border-radius: 9px; }

/* ---------------------------------------------------------------- Excel Management workspaces */
.ws-card-salfa { --ws: var(--green); --ws-bg: var(--green-bg); --ws-line: var(--green-line); }
.ws-card-cargo { --ws: var(--blue); --ws-bg: var(--blue-bg); --ws-line: var(--blue-line); }
.ws-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: calc(var(--gap) * 1.4); }
.ws-card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px; min-height: 320px; padding: 26px 28px;
  border-radius: calc(var(--radius) + 6px); border: 1px solid var(--ws-line); box-shadow: var(--shadow-2);
  background: radial-gradient(600px 260px at 100% 0%, color-mix(in srgb, var(--ws) 22%, transparent), transparent 70%),
              linear-gradient(160deg, var(--surface) 0%, color-mix(in srgb, var(--ws) 6%, var(--surface)) 100%); }
.ws-card::after { content: ""; position: absolute; inset-inline-end: -60px; bottom: -60px; width: 220px; height: 220px; border-radius: 50%;
  border: 30px solid color-mix(in srgb, var(--ws) 10%, transparent); pointer-events: none; }
.ws-card.is-locked { filter: grayscale(.6); opacity: .8; }
.ws-card-top { display: flex; align-items: center; justify-content: space-between; }
.ws-icon { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; color: #fff; flex: 0 0 auto;
  background: linear-gradient(140deg, var(--ws), color-mix(in srgb, var(--ws) 60%, #000)); box-shadow: 0 12px 26px -12px var(--ws); }
.ws-icon .ic { width: 28px; height: 28px; }
.ws-tag { font-size: calc(11px * var(--fs-scale)); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ws); background: var(--ws-bg);
  border: 1px solid var(--ws-line); padding: 4px 10px; border-radius: var(--radius-pill); }
.ws-title { font-family: var(--font-rtl); font-size: calc(40px * var(--fs-scale)); font-weight: 800; line-height: 1.2; margin-top: 8px; }
.ws-subtitle { color: var(--text-2); font-weight: 600; font-size: calc(15px * var(--fs-scale)); }
.ws-source { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: calc(13px * var(--fs-scale)); color: var(--text-3); }
.ws-source .ic { width: 16px; height: 16px; }
.ws-source b { color: var(--text); }
.ws-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0 4px; }
.ws-stats div { background: color-mix(in srgb, var(--surface) 70%, transparent); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.ws-stats dt { font-size: calc(11.5px * var(--fs-scale)); color: var(--text-3); font-weight: 600; }
.ws-stats dd { margin: 2px 0 0; font-size: calc(22px * var(--fs-scale)); font-weight: 800; }
.ws-open { margin-top: auto; align-self: flex-start; background: var(--ws); border-color: var(--ws); color: #fff; padding: 11px 18px; position: relative; z-index: 1; }
.ws-open:hover { background: color-mix(in srgb, var(--ws) 85%, #000); border-color: transparent; }
[dir="ltr"] .ws-open .ic, [dir="ltr"] .ws-sheet-open .ic { transform: rotate(180deg); }
.ws-locked { margin-top: auto; display: flex; gap: 8px; align-items: center; color: var(--text-3); font-weight: 600; }
.crumbs { display: flex; gap: 8px; align-items: center; font-size: calc(13px * var(--fs-scale)); color: var(--text-3); margin-bottom: 10px; flex-wrap: wrap; }
.crumbs a { color: var(--text-2); }
.ws-hero { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 22px; margin-bottom: var(--gap); border-radius: var(--radius);
  border: 1px solid var(--ws-line); background: linear-gradient(120deg, color-mix(in srgb, var(--ws) 14%, var(--surface)), var(--surface)); }
.ws-hero h2 { font-family: var(--font-rtl); font-size: calc(30px * var(--fs-scale)); font-weight: 800; line-height: 1.2; }
.ws-hero .spacer { flex: 1; }
.ws-totals { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--gap); }
.ws-total { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; background: var(--surface-2); }
.ws-total-label { font-size: calc(12.5px * var(--fs-scale)); font-weight: 700; color: var(--text-2); margin-bottom: 4px; }
.ws-total .cur-row .amt { font-size: calc(17px * var(--fs-scale)); }
.ws-sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: var(--gap); }
.ws-sheet { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2);
  color: inherit; transition: border-color .15s, transform .15s, box-shadow .15s; }
.ws-sheet:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.ws-sheet-name { font-family: var(--font-rtl); font-size: calc(18px * var(--fs-scale)); font-weight: 800; }
.ws-sheet-stats { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: calc(12.5px * var(--fs-scale)); }
.ws-sheet-totals { display: grid; gap: 3px; font-size: calc(12.5px * var(--fs-scale)); font-weight: 700; }
.ws-sheet-open { margin-top: auto; color: var(--link); font-weight: 700; font-size: calc(13px * var(--fs-scale)); display: inline-flex; align-items: center; gap: 4px; }
.ws-sheet-open .ic { width: 14px; height: 14px; }
.ws-summary { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.ws-summary .meta .badge { margin: 2px 0; }
.ws-pick { display: grid; gap: 8px; margin: 6px 0 4px; }
.ws-opt { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; background: var(--input-bg); }
.ws-opt span { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; }
.ws-opt span .ic { grid-row: span 2; width: 22px; height: 22px; color: var(--ws, var(--text-3)); }
.ws-opt b { font-family: var(--font-rtl); }
.ws-opt small { color: var(--text-3); }
.ws-opt:has(input:checked) { border-color: var(--ws, var(--accent)); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ws, var(--accent)) 30%, transparent); }
.ws-opt-salfa { --ws: var(--green); } .ws-opt-cargo { --ws: var(--blue); }
.ws-classify { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ws-classify select, .ws-classify input { min-height: 32px; padding: 4px 8px; width: auto; max-width: 170px; }
.excel-table td { vertical-align: top; }
.fname { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.ws-total.is-pending { border-style: dashed; background: var(--amber-bg); }
.ws-total.is-pending .ws-total-label { color: var(--amber-text); }
.tbl tr.row-bad td { background: var(--row-bad); }
.tbl tr.row-warn td { background: var(--row-warn); }
@media screen and (max-width: 1024px) { .ws-cards { grid-template-columns: 1fr; } .ws-card { min-height: 0; } .ws-title { font-size: 32px; } }

/* print / receipt */
.print-only { display: none !important; }
.print-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--text); padding-bottom: 10px; margin-bottom: 14px; }
.receipt { max-width: 720px; margin: 0 auto; }
.sig-row { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 50px; }
.sig-row div { border-top: 1px solid var(--text-2); padding-top: 6px; text-align: center; font-size: calc(12px * var(--fs-scale)); }

/* ------------------------------------------------------------------ 2.0: system selection & system chrome */
.sys-body { margin: 0; background: #06080b; }
.sys-select {
  --sx-bg: #06080b; --sx-fg: #eef1f5; --sx-muted: #8b95a3; --sx-dim: #5b6572; --sx-line: rgba(255, 255, 255, .08); --sx-line-2: rgba(255, 255, 255, .14);
  --sx-surface: linear-gradient(160deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .018));
  position: relative; min-height: 100vh; display: flex; flex-direction: column; overflow: hidden; color: var(--sx-fg); background: var(--sx-bg);
}
.sys-grid { position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 56px 56px; mask-image: radial-gradient(ellipse at 50% 30%, #000 25%, transparent 72%); }
.sys-glow { position: absolute; width: 640px; height: 640px; border-radius: 50%; filter: blur(110px); opacity: .32; pointer-events: none; }
.sys-glow-a { background: #b8862e; top: -260px; inset-inline-start: -180px; }
.sys-glow-b { background: #1b8fa0; bottom: -320px; inset-inline-end: -200px; }
.sys-glow-c { background: #5b47c7; top: 30%; inset-inline-end: -260px; width: 520px; height: 520px; opacity: .22; }
.sys-top { position: relative; z-index: 2; display: flex; align-items: center; gap: 16px; padding: 22px clamp(16px, 4vw, 48px); border-bottom: 1px solid var(--sx-line); backdrop-filter: blur(6px); }
.sys-brand { display: flex; align-items: center; gap: 12px; }
.sys-top .spacer { flex: 1; }
html[dir="ltr"] .sys-card h2, html[dir="ltr"] .sys-switch b, html[dir="ltr"] .sys-hero h2 { text-align: left; }
html[dir="rtl"] .sys-card h2, html[dir="rtl"] .sys-switch b, html[dir="rtl"] .sys-hero h2 { text-align: right; }
.sys-brand-name { display: block; font-family: "Inter", system-ui, sans-serif; font-weight: 800; letter-spacing: .3em; font-size: 16px; direction: ltr; }
.sys-brand-sub { display: block; font-size: 12px; color: var(--sx-muted); }
.sys-lang { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--sx-line); border-radius: 30px; background: rgba(255,255,255,.03); }
.sys-lang a { padding: 5px 12px; border-radius: 30px; font-size: 12.5px; color: var(--sx-muted); }
.sys-lang a:hover { color: var(--sx-fg); text-decoration: none; }
.sys-lang a.on { background: rgba(255,255,255,.1); color: var(--sx-fg); }
.sys-user { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 12px; border: 1px solid var(--sx-line); border-radius: 30px; background: rgba(255,255,255,.03); }
[dir="rtl"] .sys-user { padding: 4px 12px 4px 4px; }
.sys-user a { color: var(--sx-fg); display: flex; flex-direction: column; line-height: 1.2; }
.sys-user a:hover { text-decoration: none; }
.sys-user a b { font-size: 13px; }
.sys-user a span { font-size: 11px; color: var(--sx-muted); }
.sys-user form { margin: 0; }
.sys-user button { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--sx-line); background: transparent; color: var(--sx-muted); display: grid; place-items: center; cursor: pointer; }
.sys-user button:hover { color: var(--sx-fg); border-color: var(--sx-line-2); }
.sys-user .ic { width: 16px; height: 16px; }
.sys-main { position: relative; z-index: 1; flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; padding: clamp(28px, 5vw, 64px) clamp(16px, 4vw, 48px) 40px; box-sizing: border-box; }
.sys-intro { text-align: center; margin-bottom: clamp(28px, 4vw, 48px); }
.sys-kicker { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border: 1px solid var(--sx-line); border-radius: 30px; font-size: 12.5px; color: var(--sx-muted); background: rgba(255,255,255,.03); }
.sys-kicker .ic { width: 14px; height: 14px; }
.sys-intro h1 { margin: 18px 0 10px; font-size: clamp(28px, 4.2vw, 46px); line-height: 1.1; font-weight: 800; letter-spacing: -.025em;
  background: linear-gradient(180deg, #ffffff 30%, #a9b2bf); -webkit-background-clip: text; background-clip: text; color: transparent; }
[dir="rtl"] .sys-intro h1 { letter-spacing: 0; line-height: 1.3; }
.sys-intro p { margin: 0 auto; max-width: 620px; color: var(--sx-muted); font-size: 15px; }
.sys-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(16px, 2.4vw, 28px); }
.sys-card-salfa { --sx-acc: #e3b45f; --sx-acc-2: #9b6a1c; --sx-acc-soft: rgba(227, 180, 95, .12); }
.sys-card-cargo { --sx-acc: #4cc9d6; --sx-acc-2: #157a87; --sx-acc-soft: rgba(76, 201, 214, .12); }
.sys-card-flour { --sx-acc: #a594f9; --sx-acc-2: #5b47c7; --sx-acc-soft: rgba(165, 148, 249, .13); }
.sys-cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sys-cards-3 .sys-features { grid-template-columns: 1fr; }
.sys-cards-3 .sys-card h2 { font-size: clamp(22px, 2.4vw, 30px); }
.sys-card {
  position: relative; display: flex; flex-direction: column; gap: 18px; padding: clamp(22px, 3vw, 34px); border-radius: 22px; border: 1px solid var(--sx-line);
  background: var(--sx-surface); box-shadow: 0 30px 80px -40px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255,255,255,.05); overflow: hidden;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.sys-card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(600px circle at 85% -10%, var(--sx-acc-soft), transparent 55%); }
[dir="rtl"] .sys-card::after { background: radial-gradient(600px circle at 15% -10%, var(--sx-acc-soft), transparent 55%); }
.sys-card-edge { position: absolute; top: 0; inset-inline: 28px; height: 1px; background: linear-gradient(90deg, transparent, var(--sx-acc), transparent); opacity: .7; }
.sys-card:not(.is-locked):hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--sx-acc) 45%, transparent); box-shadow: 0 40px 90px -40px rgba(0,0,0,.95), 0 0 0 1px color-mix(in srgb, var(--sx-acc) 20%, transparent); }
.sys-card.is-locked { opacity: .62; }
.sys-card-top { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.sys-num { font-family: "Inter", system-ui, sans-serif; font-weight: 800; font-size: 13px; letter-spacing: .2em; color: var(--sx-acc); }
.sys-chip { font-size: 11.5px; padding: 3px 10px; border-radius: 20px; border: 1px solid var(--sx-line); color: var(--sx-muted); }
.sys-chip-last { border-color: color-mix(in srgb, var(--sx-acc) 40%, transparent); color: var(--sx-acc); margin-inline-start: auto; }
.sys-card-head { display: flex; align-items: center; gap: 18px; position: relative; z-index: 1; }
.sys-icon { width: 64px; height: 64px; flex: none; border-radius: 18px; display: grid; place-items: center; color: #0a0c0f;
  background: linear-gradient(140deg, var(--sx-acc), var(--sx-acc-2)); box-shadow: 0 14px 34px -14px var(--sx-acc), inset 0 1px 0 rgba(255,255,255,.35); }
.sys-icon .ic { width: 30px; height: 30px; }
.sys-card h2 { margin: 0; font-family: var(--font-rtl); font-size: clamp(26px, 3vw, 36px); font-weight: 800; line-height: 1.25; color: #fff; }
.sys-tagline { color: var(--sx-acc); font-size: 13.5px; font-weight: 600; margin-top: 2px; }
.sys-purpose { margin: 0; color: #c4cbd5; font-size: 15px; line-height: 1.6; position: relative; z-index: 1; }
.sys-features { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; position: relative; z-index: 1; }
.sys-features li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sx-muted); }
.sys-features .ic { width: 14px; height: 14px; color: var(--sx-acc); flex: none; }
.sys-source { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--sx-dim); padding-top: 14px; border-top: 1px dashed var(--sx-line); position: relative; z-index: 1; }
.sys-source b { color: var(--sx-muted); font-weight: 600; }
.sys-source .ic { width: 14px; height: 14px; }
.sys-enter {
  position: relative; z-index: 1; margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 16px 22px; border-radius: 14px;
  background: linear-gradient(140deg, var(--sx-acc), var(--sx-acc-2)); color: #0a0c0f; font-weight: 700; font-size: 15.5px;
  box-shadow: 0 18px 40px -18px var(--sx-acc), inset 0 1px 0 rgba(255,255,255,.35); transition: filter .2s, transform .2s;
}
[dir="rtl"] .sys-enter { padding: 16px 22px 16px 18px; }
.sys-enter:hover { text-decoration: none; filter: brightness(1.08); }
.sys-enter:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.sys-arrow { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(10, 12, 15, .14); transition: transform .2s; }
.sys-enter:hover .sys-arrow { transform: translateX(3px); }
[dir="rtl"] .sys-arrow .ic { transform: scaleX(-1); }
[dir="rtl"] .sys-enter:hover .sys-arrow { transform: translateX(-3px); }
.sys-locked { position: relative; z-index: 1; margin-top: auto; display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; border: 1px dashed var(--sx-line-2); color: var(--sx-muted); font-size: 13px; }
.sys-locked .ic { width: 18px; height: 18px; flex: none; }
.sys-admin { margin-top: clamp(28px, 4vw, 44px); padding: 18px 20px; border-radius: 18px; border: 1px solid var(--sx-line); background: rgba(255,255,255,.02); }
.sys-admin-title { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--sx-muted); margin-bottom: 12px; }
[dir="rtl"] .sys-admin-title { letter-spacing: 0; }
.sys-admin-title span { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--sx-dim); margin-inline-start: 8px; }
.sys-admin-links { display: flex; flex-wrap: wrap; gap: 8px; }
.sys-admin-links a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 12px; border: 1px solid var(--sx-line); color: #d5dbe3; font-size: 13.5px; background: rgba(255,255,255,.025); }
.sys-admin-links a:hover { border-color: var(--sx-line-2); background: rgba(255,255,255,.05); text-decoration: none; }
.sys-admin-links .ic { width: 16px; height: 16px; color: var(--sx-muted); }
.sys-badge { min-width: 20px; padding: 1px 6px; border-radius: 10px; background: #3a2a10; color: #ffcf7a; font-size: 11.5px; text-align: center; }
.sys-foot { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px clamp(16px, 4vw, 48px); border-top: 1px solid var(--sx-line); color: var(--sx-dim); font-size: 12.5px; }
.sys-foot a { color: var(--sx-muted); }
.sys-main .alert { margin-bottom: 18px; }
@media screen and (max-width: 1180px) {
  .sys-cards-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sys-cards-3 .sys-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media screen and (max-width: 900px) {
  .sys-cards, .sys-cards-3 { grid-template-columns: 1fr; }
  .sys-top { flex-wrap: wrap; }
  .sys-top .spacer { display: none; }
}
@media screen and (max-width: 520px) {
  .sys-top { flex-wrap: nowrap; gap: 8px; padding: 14px 16px; }
  .sys-brand-sub, .sys-brand-name { display: none; }
  .sys-lang a { padding: 5px 9px; font-size: 12px; }
  .sys-user { padding: 3px; border: 0; background: none; }
  .sys-features { grid-template-columns: 1fr; }
  .sys-user a { display: none; }
  .sys-card-head { gap: 14px; }
  .sys-icon { width: 52px; height: 52px; }
}

/* import destination (fixed: the current system) */
.ws-dest { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); margin: 6px 0 4px; }
.ws-dest > .ic { width: 22px; height: 22px; color: var(--sys-acc, var(--accent)); flex: none; }
.ws-dest b { display: block; font-family: var(--font-rtl); font-size: calc(16px * var(--fs-scale)); }
.ws-dest small { display: block; color: var(--text-3); }
html[dir="ltr"] .ws-dest b { text-align: left; }

/* حيساب طحين مانكي (2.1) */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--gap); }
.report-card { color: inherit; transition: border-color .15s, transform .15s; }
.report-card:hover { text-decoration: none; border-color: color-mix(in srgb, var(--sys-acc, var(--accent)) 50%, var(--line)); transform: translateY(-1px); }
.report-card .card-body { display: flex; flex-direction: column; gap: 6px; }
.report-ic { width: 38px; height: 38px; border-radius: var(--radius-sm); display: grid; place-items: center; color: var(--sys-acc, var(--accent));
  background: color-mix(in srgb, var(--sys-acc, var(--accent)) 12%, transparent); }
.warn-text { color: var(--amber-text); }
.fl-map select { min-width: 130px; }
.fl-map th, .fl-map td { white-space: nowrap; }
.fl-form input[dir="ltr"] { text-align: start; }

/* system identity inside each system: sidebar header, topbar badge and back button */
.app[data-system="salfa"] { --sys-acc: #c99536; }
.app[data-system="cargo"] { --sys-acc: #2aa6b4; }
.app[data-system="flour"] { --sys-acc: #8b78f0; }
.app[data-system] .brand { padding-bottom: 12px; }
.sys-switch { display: flex; align-items: center; gap: 10px; margin: -6px 2px 14px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--nav-line);
  background: color-mix(in srgb, var(--sys-acc, var(--accent)) 10%, var(--nav-bg-2)); color: var(--nav-strong); }
.sys-switch:hover { text-decoration: none; border-color: color-mix(in srgb, var(--sys-acc, var(--accent)) 45%, transparent); }
.sys-switch .sys-dot { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; color: #0a0c0f; background: var(--sys-acc, var(--accent)); }
.sys-switch .sys-dot .ic { width: 16px; height: 16px; }
.sys-switch b { display: block; font-family: var(--font-rtl); font-size: calc(15px * var(--fs-scale)); line-height: 1.3; }
.sys-switch small { display: block; color: var(--nav-muted); font-size: calc(11px * var(--fs-scale)); }
.sys-badge-top { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 20px; font-size: calc(12px * var(--fs-scale)); font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--sys-acc, var(--accent)) 45%, transparent); color: var(--text); background: color-mix(in srgb, var(--sys-acc, var(--accent)) 12%, transparent); }
.sys-badge-top i { width: 7px; height: 7px; border-radius: 50%; background: var(--sys-acc, var(--accent)); }
.btn-back-select { white-space: nowrap; }
@media screen and (max-width: 720px) { .btn-back-select span { display: none; } }
.topbar-title { min-width: 0; }
@media screen and (max-width: 560px) {
  .topbar { flex-wrap: wrap; row-gap: 6px; }
  .topbar-title { order: 5; flex-basis: 100%; }
  .topbar h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
.sys-hero { position: relative; overflow: hidden; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 22px 24px; margin-bottom: var(--gap); border-radius: var(--radius);
  background: linear-gradient(135deg, var(--hero-1), var(--hero-2)); color: var(--hero-fg); border: 1px solid var(--hero-line); }
.sys-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(520px circle at 90% 0%, color-mix(in srgb, var(--sys-acc, var(--accent)) 30%, transparent), transparent 60%); }
.sys-hero .sys-dot { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; color: #0a0c0f; background: var(--sys-acc, var(--accent)); flex: none; position: relative; z-index: 1; }
.sys-hero .sys-dot .ic { width: 26px; height: 26px; }
.sys-hero h2 { margin: 0; font-family: var(--font-rtl); font-size: calc(26px * var(--fs-scale)); color: var(--hero-fg); }
.sys-hero .sub { color: var(--hero-muted); font-size: calc(13px * var(--fs-scale)); }
.sys-hero > div, .sys-hero .actions { position: relative; z-index: 1; }
.sys-hero .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.sys-hero .btn { background: rgba(255,255,255,.08); color: var(--hero-fg); border-color: rgba(255,255,255,.14); }
.sys-hero .btn:hover { background: rgba(255,255,255,.14); }
.sys-hero .btn-primary { background: var(--sys-acc, var(--accent)); color: #0a0c0f; border-color: transparent; }

@media print {
  .btn-back-select, .sys-switch { display: none !important; }
  :root:root:root[data-theme] {
    color-scheme: light; --bg: #fff; --surface: #fff; --surface-2: #f2f2f2; --surface-3: #fff; --line: #c8c8c8; --line-strong: #999;
    --text: #000; --text-2: #222; --text-3: #555; --link: #000; --input-bg: #fff; --muted-bg: #eee; --row-warn: #fff; --row-bad: #fff;
    --hero-1: #fff; --hero-2: #fff; --hero-fg: #000; --hero-muted: #444; --hero-line: #999; --accent-2: #333; --chart-track: #e5e5e5;
    --green: #0b5e3f; --red: #9d1f16; --amber: #7a4a00; --green-bg: #fff; --red-bg: #fff; --amber-bg: #fff; --blue-bg: #fff;
    --cur-iqd-bg: #fff; --cur-usd-bg: #fff; --cur-iqd-fg: #000; --cur-usd-fg: #000;
    --accent: #000 !important; --accent-2: #333 !important; --accent-ink: #fff !important;
  }
  body { background: #fff; font-size: 12px; }
  .sidebar, .topbar, .footer, .no-print, .preview-bar, .toast, .maint-bar, .tabs, .filters, .pager, .actions, .btn, form.inline { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #bbb; break-inside: auto; }
  .kpi, .grid > .card:not(:has(table)) { break-inside: avoid; }
  .table-wrap { overflow: visible !important; }
  table.tbl { font-size: 9.5px; width: 100% !important; }
  .tbl th, .tbl td { white-space: normal !important; overflow-wrap: break-word; padding: 4px 5px !important; }
  .tbl td.nowrap, .tbl td.num, .tbl td.money, .tbl th.money { white-space: nowrap !important; }
  .tbl thead { display: table-header-group; }
  .tbl tr { break-inside: avoid; }
  .tbl .badge, .tbl .cur { font-size: 8.5px; padding: 1px 4px; }
  .print-landscape .app { page: landscape; }
  .doc-body { background: #fff; }
  .doc-toolbar { display: none !important; }
  .doc-sheet { width: auto; min-height: 268mm; margin: 0; padding: 0; box-shadow: none; }
  .doc-sheet, .doc-sheet * { color-adjust: exact; }
  .doc-sheet .btn { display: none !important; }
  .print-only { display: block !important; }
  .print-head.print-only { display: flex !important; }
  .tbl th { position: static; background: #eee !important; color: #000; }
  .tbl td, .tbl th { padding: 5px 6px; }
  a { color: #000; }
  .kpi::after { display: none; }
  @page { size: A4; margin: 10mm; }
  @page landscape { size: A4 landscape; margin: 8mm; }
}

/* ---------------------------------------------------------------- responsive */
@media screen and (max-width: 1280px) {
  .g-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media screen and (max-width: 1024px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar-w); transform: translateX(-105%); transition: transform .22s ease; box-shadow: 0 0 60px rgba(0,0,0,.4); }
  [dir="rtl"] .sidebar { transform: translateX(105%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: var(--overlay); z-index: 35; }
  .menu-btn { display: grid; place-items: center; }
  .g-3, .g-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media screen and (max-width: 720px) {
  .content { padding: 16px 14px 32px; }
  .topbar { padding: 10px 14px; gap: 8px; }
  .topbar h1 { font-size: calc(16px * var(--fs-scale)); }
  .user-chip .who, .topbar .crumb { display: none; }
  .g-4, .g-5 { grid-template-columns: 1fr 1fr; }
  .form-grid > * { grid-column: span 12 !important; }
  .kpi .value { font-size: calc(22px * var(--fs-scale)); }
  .page-head h2 { font-size: calc(20px * var(--fs-scale)); }
  .filters .fi { max-width: none; flex-basis: 45%; }
  dl.kv { grid-template-columns: 1fr; }
  dl.kv dt { border-bottom: 0; padding-bottom: 0; }
}
@media screen and (max-width: 460px) {
  .g-4, .g-5 { grid-template-columns: 1fr; }
  .lang-switch a { padding: 4px 7px; }
}

/* company logo (2.4): the uploaded image in place of the letter */
.brand-mark.has-logo, .doc-mark.has-logo { background: #fff; padding: 3px; overflow: hidden; }
.brand-mark.has-logo img, .doc-mark.has-logo img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 8px; }
.doc-mark.has-logo { border: 1px solid #ddd; }
.logo-field { display: flex; align-items: flex-start; gap: 14px; }
.logo-field .logo-preview { width: 64px; height: 64px; flex: none; font-size: 26px; }
/* a company name in Arabic script keeps its letters joined */
.brand-name.brand-rtl, .sys-brand-name.brand-rtl { letter-spacing: 0; direction: rtl; }

