/* iBills base styles. Logical properties only (inline/block, start/end),
 * so the same rules serve dir="ltr" and dir="rtl". No physical
 * left/right anywhere in this file.
 */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 100%; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.5;
}
/* Arabic marks (shadda, tanwin) need more room between lines (UI review 2026-10-29) */
html:lang(ar) body { line-height: 1.65; }
html:lang(ar) .page-title { line-height: 1.3; }

a { color: var(--brand); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Numbers, phones, UIDs, MACs and amounts stay LTR inside Arabic text */
.ltr, bdi.num, .num { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.pre { white-space: pre-line; overflow-wrap: anywhere; }
.range > span { white-space: nowrap; } /* a "from → to" range breaks only at the arrow, never inside a date */
/* The whole range moves to the next line as one unit, so the arrow never ends up pointing at the label in RTL. */
.range { display: inline-block; max-inline-size: 100%; }

/* Icons that point (back, next, chevrons) flip in RTL */
[dir="rtl"] .icon-flip { transform: scaleX(-1); }

/* ---------- Layout ---------- */
.app-header {
  position: sticky; inset-block-start: 0; z-index: 10;
  display: flex; align-items: center; gap: var(--sp-3);
  padding-block: var(--sp-2); padding-inline: var(--sp-4);
  background: var(--surface); border-block-end: 1px solid var(--border);
}
.brand { display: flex; align-items: baseline; gap: var(--sp-2); font-weight: 700; color: var(--text); text-decoration: none; }
.brand small { font-weight: 400; color: var(--text-muted); font-size: var(--fs-xs); }
.app-header .spacer { flex: 1; }
/* Who is signed in (admin): login · role, a badge for a break-glass session (UI review A14) */
.app-header .who { font-size: var(--fs-sm); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-inline-size: 16rem; }

main { max-inline-size: var(--content-max); margin-inline: auto; padding: var(--sp-4); }

.grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.stack > * + * { margin-block-start: var(--sp-4); }

/* Bottom tab bar on phones, hidden on wide screens */
.tabbar {
  position: fixed; inset-inline: 0; inset-block-end: 0;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--surface); border-block-start: 1px solid var(--border);
  padding-block-end: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-block-size: 56px; color: var(--text-muted); text-decoration: none; font-size: var(--fs-xs);
}
.tabbar a[aria-current="page"] { color: var(--brand); font-weight: 600; }
body.has-tabbar { padding-block-end: 72px; }
@media (min-width: 800px) {
  .tabbar { display: none; }
  body.has-tabbar { padding-block-end: 0; }
}

/* Back to top: a round arrow in the corner, shown by theme.js once the page is scrolled down a screen.
   Above the phone tab bar; inline-end, so on the left in Arabic. */
.btn.to-top {
  position: fixed; inset-inline-end: var(--sp-4); inset-block-end: calc(var(--sp-4) + env(safe-area-inset-bottom));
  z-index: 15; inline-size: var(--tap); padding: 0; border-radius: 50%; box-shadow: var(--shadow);
}
.btn.to-top[hidden] { display: none; }
#top:focus { outline: none; } /* focus target of the back-to-top button, not a control */
body.has-tabbar .btn.to-top { inset-block-end: calc(56px + var(--sp-4) + env(safe-area-inset-bottom)); }
@media (min-width: 800px) { body.has-tabbar .btn.to-top { inset-block-end: var(--sp-4); } }
/* Room under the last row (pager, buttons) so the arrow never sits on it at the bottom of a long page */
body.long-page { padding-block-end: calc(var(--tap) + 2 * var(--sp-4)); }
body.has-tabbar.long-page { padding-block-end: calc(72px + var(--tap) + var(--sp-4)); }
@media (min-width: 800px) { body.has-tabbar.long-page { padding-block-end: calc(var(--tap) + 2 * var(--sp-4)); } }

/* ---------- Cards and figures ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: var(--sp-4);
}
.card h2 { margin: 0 0 var(--sp-3); font-size: var(--fs-md); color: var(--text-muted); font-weight: 600; }

.figure { font-size: var(--fs-2xl); font-weight: 700; line-height: 1.1; }
.figure .unit { font-size: var(--fs-md); font-weight: 500; color: var(--text-muted); margin-inline-start: var(--sp-1); }
.sub { color: var(--text-muted); font-size: var(--fs-sm); }

.meter { block-size: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-block: var(--sp-2); }
.meter > span { display: block; block-size: 100%; background: var(--brand); border-radius: inherit; }
.meter.low > span { background: var(--warn); }
.meter.empty > span { background: var(--danger); }

dl.facts { display: grid; grid-template-columns: fit-content(45%) minmax(0, 1fr); gap: var(--sp-2) var(--sp-4); margin: 0; }
dl.facts dd bdi.num { white-space: nowrap; } /* a date or amount never breaks at its hyphen */
dl.facts dt { color: var(--text-muted); }
dl.facts dd { margin: 0; font-weight: 500; }
dl.facts dd.negative { color: var(--danger); }
tr.current td { font-weight: 700; }

/* ---------- Badges and alerts ---------- */
.badge { display: inline-block; padding: 2px var(--sp-2); border-radius: 999px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted); background: var(--surface-2); }
.badge.ok { color: var(--ok); background: var(--ok-bg); }
.swatch { display: inline-block; width: 0.9em; height: 0.9em; border-radius: 3px; vertical-align: middle; border: 1px solid var(--border); }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.danger { color: var(--danger); background: var(--danger-bg); }
.badge.info { color: var(--info); background: var(--info-bg); }

.alert { border-radius: var(--radius-sm); padding: var(--sp-3) var(--sp-4); border-inline-start: 4px solid; }
.alert.warn { background: var(--warn-bg); border-color: var(--warn); }
.alert.danger { background: var(--danger-bg); border-color: var(--danger); }
.alert.ok { background: var(--ok-bg); border-color: var(--ok); }

/* ---------- Buttons and forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-block-size: var(--tap); padding-inline: var(--sp-4);
  border: 1px solid var(--border-input); border-radius: var(--radius-sm); /* 3:1 boundary (WCAG 1.4.11) */
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }
.btn.primary:hover { background: var(--brand-strong); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.block { inline-size: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.actions { display: grid; gap: var(--sp-2); grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

label { display: block; font-weight: 600; margin-block-end: var(--sp-1); }
.hint { color: var(--text-muted); font-size: var(--fs-sm); margin-block-start: var(--sp-1); }
input, select, textarea {
  inline-size: 100%; min-block-size: var(--tap);
  padding-block: var(--sp-2); padding-inline: var(--sp-3);
  border: 1px solid var(--border-input); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit;
}
input.num { text-align: start; }
.field + .field { margin-block-start: var(--sp-4); }
.pw-row { display: flex; gap: var(--sp-2); }
.pw-row input { flex: 1; min-inline-size: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { inline-size: 100%; border-collapse: collapse; }
th, td { padding: var(--sp-2) var(--sp-3); text-align: start; border-block-end: 1px solid var(--border); white-space: nowrap; }
th { color: var(--text-muted); font-size: var(--fs-sm); font-weight: 600; }
td.amount, th.amount { text-align: end; font-variant-numeric: tabular-nums; }
/* A bare "-75.000" in an RTL cell reads "75.000-": the cell is LTR, aligned to the RTL end (UI review A3) */
td.amount { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] td.amount { text-align: left; }

/* ---------- Utilities ---------- */
.muted { color: var(--text-muted); }
.row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.nowrap { white-space: nowrap; }
.between { justify-content: space-between; }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: var(--sp-2) var(--sp-3); }
fieldset.group { border: 1px solid var(--border-input); border-radius: var(--radius-sm); padding: var(--sp-3); margin: 0; min-inline-size: 0; }
fieldset.group legend { padding-inline: var(--sp-2); font-weight: 600; }
[hidden] { display: none !important; } /* over .btn and other display rules */
.visually-hidden { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link:focus { inset-block-start: var(--sp-2); inset-inline-start: var(--sp-2); inline-size: auto; block-size: auto; clip-path: none; z-index: 100;
  padding: var(--sp-2) var(--sp-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* ---------- App pieces ---------- */
.page-title { font-size: var(--fs-xl); margin: 0; }
.center { text-align: center; }
.prefs { display: flex; gap: var(--sp-1); }
.prefs .btn, .app-header form .btn { white-space: nowrap; min-block-size: 36px; padding-inline: var(--sp-3); font-size: var(--fs-sm); }
.card .actions { margin-block-start: var(--sp-4); }
main.login { max-inline-size: 420px; padding-block-start: var(--sp-7); }
progress {
  inline-size: 100%; block-size: 10px; margin-block: var(--sp-2);
  appearance: none; border: 0; border-radius: 999px; overflow: hidden; background: var(--surface-2);
}
progress::-webkit-progress-bar { background: var(--surface-2); }
progress::-webkit-progress-value { background: var(--brand); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--brand); border-radius: 999px; }
[dir="rtl"] progress::-webkit-progress-value { border-radius: 999px; }
.sms-help { margin: 0; padding-inline-start: var(--sp-5); }
.sms-help li { unicode-bidi: plaintext; text-align: start; }
.demo-banner { background: var(--warn-bg); color: var(--warn); text-align: center; font-size: var(--fs-sm); font-weight: 600; padding: var(--sp-1) var(--sp-4); }
.topnav { display: none; gap: var(--sp-4); margin-inline-start: var(--sp-4); }
.topnav a { color: var(--text-muted); text-decoration: none; font-weight: 600; }
.topnav a[aria-current="page"] { color: var(--brand); }
@media (min-width: 800px) { .topnav { display: flex; } }
.topsearch { flex: 1; max-inline-size: 420px; margin-inline-start: var(--sp-4); }
.topsearch input { min-block-size: 36px; }
/* Phones: the search takes its own full row under the brand and buttons instead of shrinking to nothing. */
@media (max-width: 600px) { .topsearch { flex-basis: 100%; max-inline-size: none; margin-inline-start: 0; order: 9; } }
/* Search results while typing (admin.js) */
.suggest-wrap { position: relative; display: block; }
.suggest {
  position: absolute; inset-inline: 0; inset-block-start: calc(100% + 4px); z-index: 30; margin: 0; padding: var(--sp-1) 0;
  list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); max-block-size: 70vh; overflow-y: auto; min-inline-size: min(420px, 92vw);
}
.suggest li { display: grid; grid-template-columns: auto 1fr; column-gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); cursor: pointer; }
.suggest li .num:first-child { font-weight: 600; color: var(--brand); }
.suggest li .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.suggest li .sub { grid-column: 2; font-size: var(--fs-sm); }
.suggest li[aria-selected="true"] { background: var(--surface-2); outline: 2px solid var(--focus); outline-offset: -2px; }
.suggest li.none { display: block; cursor: default; }
.suggest li .more { grid-column: 1 / -1; color: var(--brand); font-weight: 600; }
/* Money page in a dialog over the customer card (admin.js) */
dialog.modal {
  inline-size: min(560px, calc(100vw - 32px)); max-block-size: calc(100vh - 32px); padding: var(--sp-5);
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--text); box-shadow: var(--shadow);
}
dialog.modal::backdrop { background: rgb(0 0 0 / 0.45); }
dialog.modal > main { margin: 0; padding: 0; max-inline-size: none; }
dialog.modal[aria-busy="true"] { cursor: progress; }
main.narrow { max-inline-size: 560px; }
main.wide { max-inline-size: 1400px; }
.grow { flex: 1; min-inline-size: 0; inline-size: auto; }
td.negative, th.negative { color: var(--danger); }
table.pools td.indent { padding-inline-start: var(--sp-6); }
table.pools tr.chain th { color: var(--text); }
.card.flush { padding: 0; }
.summary { display: grid; grid-template-columns: 1fr auto; gap: var(--sp-2) var(--sp-4); margin: 0; }
.summary dd { margin: 0; text-align: end; font-weight: 600; font-variant-numeric: tabular-nums; }
.summary .total { border-block-start: 1px solid var(--border); padding-block-start: var(--sp-2); }
.alert dl.facts { margin-block-start: var(--sp-2); }
details.day { border-block-start: 1px solid var(--border); }
details.day > summary { cursor: pointer; padding-block: var(--sp-2); display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); align-items: baseline; list-style: none; }
details.day > summary::-webkit-details-marker { display: none; }
details.day > summary::after { content: "+"; margin-inline-start: auto; color: var(--text-muted); font-weight: 600; }
details.day[open] > summary::after { content: "−"; }
.alert p { margin: 0; }
/* the whole row or banner is the link's tap area */
.stretch-host { position: relative; }
a.stretch::after { content: ""; position: absolute; inset: 0; }
details.confirm > summary { list-style: none; }
details.confirm > summary::-webkit-details-marker { display: none; }
details.confirm[open] > summary { display: none; }
.alert p + p { margin-block-start: var(--sp-2); }
.kpis { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.kpi { text-decoration: none; color: inherit; }
a.kpi:hover { border-color: var(--brand); }
.kpi .figure { font-size: var(--fs-xl); }
/* Dashboard cash chart (server-side SVG): one series in the brand colour, recessive grid and labels. */
.chart { display: block; inline-size: 100%; block-size: auto; direction: ltr; }
.chart-bar { fill: var(--brand); }
.chart-hit { fill: transparent; }
.chart-col:hover .chart-hit { fill: var(--border); }
.chart-grid { stroke: var(--border); stroke-dasharray: 4 4; }
.chart-axis { stroke: var(--text-muted); }
.chart-dates { display: flex; justify-content: space-between; direction: ltr; color: var(--text-muted); font-size: var(--fs-sm); }
/* Phones: two KPI columns, and lists keep the columns that matter (UI review A21). */
@media (max-width: 600px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* minmax(0): "1,000.000 LYD" at 360px no longer widens the page */
  .kpi .figure { overflow-wrap: anywhere; }
  .kpi .figure { font-size: var(--fs-lg); }
  .wide-only { display: none; }
}
.filters { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: flex-end; }
.filters select, .filters input[type="date"] { inline-size: auto; }
/* Selects keep their width (a long group name is capped, never squeezes its neighbours); the search box takes the rest. */
.filters select { flex: 0 0 auto; max-inline-size: min(13rem, 100%); }
.filters label.check { white-space: nowrap; align-self: center; margin: 0; }
@media (max-width: 600px) { .filters select { flex: 1 1 9rem; min-inline-size: 0; max-inline-size: 100%; } }
.filters > .grow { flex: 1 1 16rem; min-inline-size: min(14rem, 100%); }
.filters > .suggest-wrap > input { inline-size: 100%; }
.pad { padding: var(--sp-4) var(--sp-4) 0; }
.figure.negative { color: var(--danger); }
.alert.info-note { background: var(--info-bg); border-color: var(--info); }
progress.low::-webkit-progress-value { background: var(--warn); }
progress.low::-moz-progress-bar { background: var(--warn); }
progress.empty::-webkit-progress-value { background: var(--danger); }
progress.empty::-moz-progress-bar { background: var(--danger); }
/* Portal lists: one entry per row, stacks cleanly on a phone. */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); padding-block: var(--sp-3); border-block-end: 1px solid var(--border); }
.list > li:last-child { border-block-end: 0; }
.list .main { min-inline-size: 0; }
.list .main > div:first-child { font-weight: 600; }
.list .end { text-align: end; flex-shrink: 0; }
.amount.pos { color: var(--ok); }
.amount.neg { color: var(--danger); }
.list code { font-size: var(--fs-sm); background: var(--surface-2); padding: 2px var(--sp-2); border-radius: var(--radius-sm); overflow-wrap: anywhere; }
/* SMS commands: the whole row is the tap target, label at the start, code and a send icon at the end (UI review 2026-10-29) */
.list.sms:not(.links) > li { flex-direction: column; align-items: flex-start; gap: var(--sp-1); } /* usage brackets */
.list.sms > li > a { min-block-size: var(--tap); flex-wrap: wrap; row-gap: var(--sp-1); }
.list.sms .name { font-weight: 500; flex: 1 1 12rem; }
.list.sms .cmd { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--brand); margin-inline-start: auto; }
.list.sms code { color: var(--text); }
[dir="rtl"] .list.sms .ico, [dir="rtl"] .sms-btn .ico { transform: scaleX(-1); }
.sms-btn { margin-block-start: var(--sp-2); }
.sms-btn code { background: none; font-size: var(--fs-md); }
.brand-mark { inline-size: 28px; block-size: 28px; align-self: center; }
.login-mark { inline-size: 72px; block-size: 72px; display: block; margin: 0 auto var(--sp-2); }
@media (max-width: 420px) {
  .brand small { display: none; }
  .app-header { gap: var(--sp-2); padding-inline: var(--sp-3); }
  .prefs .btn, .app-header form .btn { padding-inline: var(--sp-2); }
  .app-header .who { display: none; }
}
/* Never wider than the screen: on the narrowest phones the buttons go to a second row
   instead of scrolling the page sideways (Arabic labels are the widest). */
.app-header { flex-wrap: wrap; }
/* Payments: day badge, title, amount on one line. */
.month-totals.period { margin: 0; padding-block: var(--sp-3); font-size: var(--fs-md); } /* the statement's period totals, a card of their own under the form */
.month-totals { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin-block: calc(-1 * var(--sp-2)) var(--sp-2); font-weight: 600; font-size: var(--fs-sm); }
.list.pay > li { justify-content: flex-start; }
.list.pay .main { flex: 1; }
.list.pay .day { flex-shrink: 0; inline-size: 4.25rem; /* fits "September" */ text-align: center; line-height: 1.1; color: var(--text-muted); }
.list.pay .day bdi { display: block; font-size: var(--fs-lg); font-weight: 700; color: var(--text); }
.list.pay .day span { font-size: var(--fs-xs); }
.list.pay .amount { font-weight: 700; white-space: nowrap; }
.list.pay .amount .unit { font-weight: 400; font-size: var(--fs-xs); color: var(--text-muted); }
.list .span { font-size: var(--fs-sm); }
.list .span > span { white-space: nowrap; }

@media print {
  nav, .tabbar, .topnav, .btn, .to-top, form, footer, #theme-toggle, details.tip { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #000; box-shadow: none; }
}
/* Customer portal on phones: language and theme are on Account, the header keeps Sign out only. */
@media (max-width: 799px) { body.realm-customer.has-tabbar .app-header .prefs { display: none; } }
.forgot { margin-block-start: var(--sp-2); }
.forgot summary { cursor: pointer; color: var(--brand); font-weight: 600; padding-block: var(--sp-2); }
.forgot code { background: var(--surface-2); padding: 2px var(--sp-2); border-radius: var(--radius-sm); }
.tabbar a { text-align: center; line-height: 1.2; padding-inline: 2px; }
label.check { display: flex; gap: var(--sp-2); align-items: center; font-weight: 400; }
label.check input { inline-size: auto; min-block-size: auto; }
.checklist { max-block-size: 13rem; overflow-y: auto; padding: var(--sp-2); border: 1px solid var(--border); border-radius: var(--radius-sm, 6px); display: grid; gap: var(--sp-1, 4px); }

/* SMS notification text as typed: keep its line breaks */
.sms-text { white-space: pre-wrap; margin: 0; }

/* Printable customer memo: English | value | Arabic, as the old memo template */
/* A fixed bilingual document: English | value | Arabic whatever the UI language; codes wrap on phones (A20) */
.memo table { inline-size: 100%; border-collapse: collapse; direction: ltr; }
.memo td.v code { white-space: normal; overflow-wrap: anywhere; } /* <wbr> after each "+": inside a word only when one part alone is too wide */
.memo .ar { min-inline-size: 6rem; }
.memo th, .memo td { border: 1px solid var(--border); padding: var(--sp-2); vertical-align: middle; white-space: normal; overflow-wrap: break-word; }
.memo .en { text-align: left; }
.memo .ar { text-align: right; }
.memo .v, .memo th[dir="ltr"]:not(.en) { text-align: center; font-weight: 700; }
@media print {
  .memo th, .memo td { border-color: #000; }
  .memo-page .alert { display: none !important; }
}

/* ---------- Support ---------- */
.typegrid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.typegrid .btn { min-block-size: 72px; padding-inline: var(--sp-2); text-align: center; white-space: normal; }
.row select { inline-size: auto; }
.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.msg { max-inline-size: 85%; padding: var(--sp-3); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.msg.mine { margin-inline-start: auto; background: var(--info-bg); }
.msg.inner { margin-inline-start: auto; background: var(--warn-bg); border-style: dashed; }
.msg .text { white-space: pre-wrap; overflow-wrap: anywhere; margin-block-start: var(--sp-1); }
.dot { display: inline-block; inline-size: 8px; block-size: 8px; border-radius: 50%; background: var(--brand); vertical-align: middle; }
.desk { display: grid; gap: var(--sp-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .desk { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); } }

/* ---------- Reseller portal (2026-10-27 UI review) ---------- */
/* Tabs: one component for in-page switches (History | Statement, Payments | Invoices, report views)
   and, with .bar, the admin's full-width section bar. Phones scroll it sideways; wide screens wrap
   so no section is hidden behind the edge (UI review 2026-10-29). */
.tabs { display: flex; gap: var(--sp-1); overflow-x: auto; border-block-end: 1px solid var(--border); }
.tabs a { padding: var(--sp-2) var(--sp-3); color: var(--text-muted); text-decoration: none; font-weight: 600; white-space: nowrap; border-block-end: 2px solid transparent; }
.tabs a[aria-current="page"], .tabs a[aria-current="true"] { color: var(--brand); border-block-end-color: var(--brand); }
.tabs.bar { padding-inline: var(--sp-4); background: var(--surface); }
.tabs.bar a { padding-block: var(--sp-3); }
@media (min-width: 700px) { .tabs.bar { flex-wrap: wrap; overflow-x: visible; } }
@media (min-width: 700px) and (max-width: 1499px) { .tabs.bar { gap: 0; padding-inline: var(--sp-2); } .tabs.bar a { padding-inline: var(--sp-2); } }
@media (min-width: 700px) and (max-width: 1399px) { [dir="rtl"] .tabs.bar a { padding-inline: var(--sp-1); } } /* Arabic labels are wider: the 14 items fit one row at 1280 */
/* One-tap amounts and quick filters */
.chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-block-start: var(--sp-2); }
.chip { display: inline-flex; align-items: center; gap: var(--sp-1); min-block-size: 40px; min-inline-size: 56px; justify-content: center; padding-inline: var(--sp-3); border: 1px solid var(--border-input); border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; }
.chip.on, .chip[aria-current="page"] { border-color: var(--brand); color: var(--brand); }
/* A list row that is one link (sales, recent customers, days) */
.list.links > li { padding: 0; }
.list.links > li > a { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); padding-block: var(--sp-3); color: inherit; text-decoration: none; inline-size: 100%; }
.list.links .main { display: flex; flex-direction: column; min-inline-size: 0; }
.list.links .name { font-weight: 600; }
.list.links .end, .list.links .badge { flex-shrink: 0; white-space: nowrap; }
.list .sub bdi.num { white-space: nowrap; }
.list > li.reversed .amount { text-decoration: line-through; color: var(--text-muted); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
/* The quote's total line runs across both columns */
.summary { column-gap: 0; }
.summary dd { padding-inline-start: var(--sp-4); }
/* Reseller on phones: language and theme are on Settings, the header keeps Sign out only. */
@media (max-width: 799px) { body.realm-dealer.has-tabbar .app-header .prefs { display: none; } }
.print-only { display: none; }
.receipt-head .receipt-title { text-align: center; margin: var(--sp-3) 0 var(--sp-2); font-size: 1.25rem; }
.receipt-foot { border-block-start: 1px solid #999; padding-block-start: var(--sp-2); text-align: center; }
.receipt-foot p { margin: 0 0 var(--sp-1); }
/* the receipt header is compact: name and the other-language block side by side, small mark (Zied 2026-11-02) */
.receipt-head .doc-head { flex-wrap: nowrap; gap: var(--sp-3); font-size: 0.85rem; }
.receipt-head .doc-company { font-size: 1.05rem; }
.receipt-head .doc-issuer-o { font-size: 0.75rem; flex: none; }
.receipt-head .doc-issuer-o img { inline-size: 36px; block-size: 36px; }
@media print {
  /* a printed receipt is the receipt only: no portal header (its mark printed twice), title, tab bar or buttons */
  body:has(.card.receipt) .app-header, body:has(.card.receipt) .skip-link, body:has(.card.receipt) .demo-banner,
  body:has(.card.receipt) .tabbar, body:has(.card.receipt) main > :not(.card.receipt):not(.alert.warn) { display: none !important; }
  .dealer-only { display: none !important; }
  .print-only { display: block; }
  .card.receipt, .card.receipt * { background: #fff !important; color: #000 !important; }
}

/* ---------- Invoices and receipts (docs/invoices.md) ---------- */
/* One sheet in the document's own language and direction; light on screen and paper whatever the theme. */
.docsheet { position: relative; overflow: hidden; background: #fff; color: #111; border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--sp-5, 24px); display: grid; gap: var(--sp-4); max-inline-size: 210mm; inline-size: 100%; margin-inline: auto; }
.docsheet .sub { color: #555; }
/* header as ICONA's Odoo invoices (Zied 2026-11-02): company in the document language at the start, the mark
   and the other language's name and address at the end, a heavy rule under both */
.doc-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: var(--sp-4);
  border-block-end: 3px solid #111; padding-block-end: var(--sp-2); }
.doc-issuer { display: grid; gap: 2px; min-inline-size: 0; overflow-wrap: anywhere; }
.doc-company { font-size: 1.2rem; font-weight: 600; margin-block-end: var(--sp-1); }
.doc-issuer-o { display: grid; gap: 0; font-size: 0.9rem; line-height: 1.35; min-inline-size: 0; }
.doc-issuer-o img { margin-block-end: 2px; }
.doc-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--sp-3); }
.doc-title h2 { margin: 0; font-size: 1.4rem; }
.doc-contacts { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 var(--sp-2); font-size: 0.9rem; }
.doc-contacts span + span::before { content: "|"; margin-inline-end: var(--sp-2); color: #777; }
.docsheet dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px var(--sp-3); margin: 0; }
.docsheet dt { color: #555; }
.docsheet dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.doc-lines { inline-size: 100%; border-collapse: collapse; }
.doc-lines th, .doc-lines td { border: 1px solid #999; padding: var(--sp-2); text-align: start; vertical-align: top; white-space: normal; }
.doc-lines .num { text-align: end; white-space: nowrap; }
.doc-lines thead th { background: #f0f0f0; }
.docsheet th { color: #222; }
.doc-lines tfoot th { text-align: end; }
.doc-sign { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.doc-sign > div { border: 1px dashed #999; min-block-size: 5rem; padding: var(--sp-2); color: #555; }
.doc-foot { border-block-start: 1px solid #999; padding-block-start: var(--sp-2); display: grid; gap: 2px; text-align: center; }
.doc-note { margin: var(--sp-2) 0 0; font-weight: 700; color: #a00; }
/* reversed: a diagonal stamp across the sheet */
.doc-void { position: absolute; inset-block-start: 40%; inset-inline: -10%; text-align: center; transform: rotate(-20deg);
  font-size: 4rem; font-weight: 800; color: rgba(170, 0, 0, .18); pointer-events: none; letter-spacing: .1em; }
.doc-preview { border: 1px dashed var(--border); padding: var(--sp-2); border-radius: var(--radius); }
.doc-staff dd { font-weight: 400; }
td.pre { white-space: pre-wrap; }
/* phones: one copy per line, so quantity and unit price are left out on screen (they print) */
@media (max-width: 599px) { .docsheet { padding: var(--sp-3); }
  .doc-lines .col-x { display: none; } }
@media print {
  @page { size: A4; margin: 12mm; }
  body:has(.doc-page) .app-header, body:has(.doc-page) .skip-link, body:has(.doc-page) .demo-banner, .doc-staff { display: none !important; }
  .doc-page { padding: 0; margin: 0; }
  .docsheet { border: 0; padding: 0; max-inline-size: none; }
  .docsheet, .docsheet * { color: #000 !important; background: transparent !important; }
  .doc-lines thead th { background: #eee !important; }
  .doc-void { color: rgba(170, 0, 0, .25) !important; }
}

/* ---------- Icons (UI review 2026-10-29) ---------- */
/* One inline SVG sprite per page (layout.html, template "icons"); no external asset. */
.sprite { position: absolute; inline-size: 0; block-size: 0; overflow: hidden; }
.ico { inline-size: 24px; block-size: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { inline-size: 18px; block-size: 18px; }
.topnav .ico { display: none; }

/* ---------- Customer Home (UI review 2026-10-29) ---------- */
.hello { row-gap: var(--sp-1); }
.hello .page-title { font-size: var(--fs-lg); margin-inline-end: var(--sp-1); }
@media (max-width: 600px) {
  .grid.figures { grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
  .grid.figures > .card { padding: var(--sp-3); }
  .grid.figures .figure { font-size: var(--fs-xl); }
}
@media (max-width: 340px) { .grid.figures { grid-template-columns: 1fr; } }
/* Usage: one line per day, the day's total in bold at the end */
details.day > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto 1.25rem; align-items: center; min-block-size: var(--tap); }
details.day .day-head { display: inline-flex; align-items: center; gap: var(--sp-1) var(--sp-2); flex-wrap: wrap; }
details.day .day-total { font-weight: 700; white-space: nowrap; }
details.day .day-free { grid-column: 1 / -1; grid-row: 2; }
details.day > summary::after { grid-column: 3; grid-row: 1; margin-inline-start: 0; text-align: center; font-size: var(--fs-lg); }
.list.docs > li { flex-wrap: wrap; }
.list.docs .main { flex: 1 1 12rem; }
.list.docs .end { flex: 1 1 auto; min-inline-size: 0; flex-wrap: wrap; justify-content: flex-start; }
@media (max-width: 599px) { .list.docs > li { gap: var(--sp-2); } .list.docs .end { flex-basis: 100%; } .list.docs .chip { flex: 1 1 0; min-inline-size: 0; } }
.list.docs .unit { font-size: var(--fs-xs); color: var(--text-muted); }
/* A card that opens (dealer commission, history by day): the heading is the toggle */
details.card > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; min-block-size: var(--tap); margin-block: calc(-1 * var(--sp-2)); }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { margin: 0; }
details.card > summary::after { content: "+"; color: var(--text-muted); font-weight: 600; font-size: var(--fs-lg); }
details.card[open] > summary::after { content: "−"; }
details.card[open] > summary { margin-block-end: var(--sp-2); }
/* Dealer Home: three figures on one strip; on phones balance takes the full row, today and month share the next */
.kpis .kpi h2 { margin-block-end: var(--sp-1); font-size: var(--fs-sm); }
@media (max-width: 600px) {
  .realm-dealer .kpis > .kpi:first-child { grid-column: 1 / -1; }
  .realm-dealer .kpis > .kpi { padding: var(--sp-3); }
  .realm-dealer .kpis .sub { font-size: var(--fs-xs); }
}

/* ---------- Admin customer card (UI review 2026-10-29) ---------- */
.cust-head > * + * { margin-block-start: var(--sp-3); }
.cust-head .page-title { font-size: var(--fs-lg); }
.head-facts { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-6); margin: 0; }
.head-facts dt { color: var(--text-muted); font-size: var(--fs-sm); }
.head-facts dd { margin: 0; font-weight: 600; }
.head-facts dd.figure { font-size: var(--fs-xl); }
.actionbar { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; border-block-start: 1px solid var(--border); padding-block-start: var(--sp-3); }
.actionbar form { display: contents; }
.actionbar .spacer { flex: 1; }
.edits { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-block-start: var(--sp-4); }
.edits form { display: contents; }
/* Card money table: the description wraps and the Reverse column stays pinned at the end, so Reverse never
   scrolls out of the card (prod 2026-10-30: long descriptions pushed it off-screen; it was also hover-only).
   It stays muted and the review step still guards it. */
table.ledger td.desc { white-space: normal; overflow-wrap: anywhere; min-inline-size: 10rem; }
table.ledger td.act, table.ledger th.act { position: sticky; inset-inline-end: 0; background: var(--surface); }
/* Admin dashboard: 8 KPIs as two rows of four, never 7 + 1 (UI review 2026-10-29) */
@media (min-width: 1000px) { .realm-admin .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* Filter rows: inputs keep a size that fits what they hold */
.filters label.inline { margin: 0; }
.filters input.w-uid { inline-size: 8rem; }
.filters input.w-date { inline-size: 11rem; }
.grid-fields.wide-fields { grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: var(--sp-3); }
.wide-fields > .field + .field { margin-block-start: 0; }

/* ---------- Built-in help (docs/help.md) ---------- */
/* A "?" after a label or heading: wrap both in .with-tip. The explanation opens below the "?"
   (a sheet at the bottom of the screen on a phone). Works without script; theme.js closes it on Escape or a click elsewhere. */
/* The ? stays on the first line of what it explains: the label, heading or paragraph wraps, not the row. */
.with-tip { display: flex; align-items: baseline; gap: var(--sp-2); }
.with-tip > * { min-inline-size: 0; }
.with-tip > details.tip { flex: none; }
.with-tip > label, .with-tip > h1, .with-tip > h2, .with-tip > h3, .with-tip > p { margin-block: 0; }
/* a value with its ? (dl.facts, the card summary): the value wraps, the ? stays on its first line */
dd.with-tip { display: flex; min-inline-size: 0; }
/* Admin facts on a phone: the label above its value, so a long Arabic label or a phone number never squeezes
   the value (and its ?) into a narrow column. */
@media (max-width: 40rem) {
  .realm-admin dl.facts { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
  .realm-admin dl.facts dt { font-size: var(--fs-sm); margin-block-start: var(--sp-2); }
  .realm-admin dl.facts dt:first-child { margin-block-start: 0; }
}
span.with-tip { display: inline-flex; }
/* a sentence with its ? inside a value (the card's scheduled change): flows as text, never squeezes the sentence */
dd > span.with-tip { display: inline; }
/* hints keep their usual gap; a note right after a table keeps its distance */
.with-tip > p.hint { margin-block-start: var(--sp-1); }
.table-wrap + .with-tip { margin-block-start: var(--sp-3); }
.filters > details.tip { align-self: center; }
/* A key/value table with a ? per row: the ? in its own last cell (not in the row header, whose name it would
   join); the header wraps so a phone never scrolls the table sideways. */
table.kv th { white-space: normal; }
/* Not wider than a reading line: on a wide screen the ? stays next to its label instead of ~1,200px away (2026-10-29) */
table.kv { max-inline-size: 48rem; }
table.kv th code { overflow-wrap: anywhere; }
td.tip-cell { inline-size: 1%; padding-inline: var(--sp-2) 0; }
.field > .with-tip { margin-block-end: var(--sp-1); }
.card > .with-tip { margin-block-end: var(--sp-3); }
details.tip { display: inline-block; position: relative; font-size: var(--fs-sm); font-weight: 400; color: var(--text); }
details.tip > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  inline-size: 1.4em; block-size: 1.4em; border-radius: 999px; border: 1px solid var(--border-input);
  color: var(--text-muted); font-weight: 700; font-size: var(--fs-xs); line-height: 1;
}
details.tip > summary::-webkit-details-marker { display: none; }
details.tip > summary:hover, details.tip[open] > summary { color: var(--brand); border-color: var(--brand); }
details.tip > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.tip-body {
  position: absolute; inset-block-start: calc(100% + var(--sp-1)); inset-inline-start: 0; z-index: 20;
  inline-size: max-content; max-inline-size: min(40ch, 80vw); white-space: normal; text-align: start;
  padding: var(--sp-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow); line-height: 1.45;
}
/* closed: no box at all (newer engines lay out a closed details' content, and a tip near the edge widened the page) */
details.tip:not([open]) > .tip-body { display: none; }
.tip-body.tip-fixed { position: fixed; inset-block-start: auto; inset-inline-start: auto; }
@media (max-width: 40rem) {
  .tip-body { position: fixed; inset-block-start: auto; inset-block-end: var(--sp-3); inset-inline: var(--sp-3); max-inline-size: none; inline-size: auto; }
}
.app-header .help-link { white-space: nowrap; min-block-size: 36px; padding-inline: var(--sp-3); font-size: var(--fs-sm); }
.app-header .help-link[aria-current="page"] { color: var(--brand); border-color: var(--brand); }
.help-search input { flex: 1; min-inline-size: 0; }
.help-list { margin: 0; padding-inline-start: var(--sp-5); }
.help-list li + li { margin-block-start: var(--sp-3); }
.help-article { line-height: 1.55; max-inline-size: 75ch; }
html:lang(ar) .help-article { line-height: 1.65; } /* as the rest of the Arabic UI: room for shadda and tanwin */
/* the sticky header is up to ~150px tall on a narrow phone (search on its own row) */
.help-article h2 { color: var(--text); font-size: var(--fs-lg); margin-block: var(--sp-5) var(--sp-2); scroll-margin-block-start: 10rem; }
.help-article table { display: block; overflow-x: auto; }
.help-article h2:target { color: var(--brand); }
.help-article td, .help-article th { white-space: normal; }
/* one classic save written as several lines: one block, when and who shown once (UX review 2026-11-01 A1) */
tr:has(+ tr.cont) > td { border-block-end-color: transparent; }
tr.cont > td { padding-block-start: 0; }
/* Phones: the card's money list keeps date, amount and the actions; Reverse and Delete stack (UX review 2026-11-01 A3) */
@media (max-width: 600px) { table.ledger td.act a { display: block; } }
/* A cell with a long list (NAS names of a pool) wraps instead of pushing the table past the card (A15) */
td.wrap { white-space: normal; min-inline-size: 12rem; }
/* Checkbox lists: a wrapped name keeps its box on the first line (bulk SMS resellers, A12) */
.checklist label.check { align-items: flex-start; }
.checklist label.check input { margin-block-start: 0.2em; flex: none; }
/* Sub-pages of a list (a tariff, a staff account) start with the way back to the list (A13) */
.crumb { margin: 0; font-size: var(--fs-sm); }
.crumb a::before { content: "‹ "; }
[dir="rtl"] .crumb a::before { content: "› "; }
/* A speed input carries its unit in a bold tag at its end, so nobody types kbit/s into an Mbps field (A9) */
.with-unit { display: flex; align-items: stretch; }
.with-unit input { flex: 1 1 auto; min-inline-size: 0; border-start-end-radius: 0; border-end-end-radius: 0; }
.with-unit .unit-tag { display: inline-flex; align-items: center; padding-inline: var(--sp-3); border: 1px solid var(--border-input); border-inline-start: 0;
  border-start-end-radius: var(--radius-sm); border-end-end-radius: var(--radius-sm); background: var(--info-bg); color: var(--info); font-weight: 700; direction: ltr; }
.unit-note { font-weight: 600; }
fieldset.group .grid-fields > .field { display: flex; flex-direction: column; justify-content: space-between; } /* inputs line up when a label wraps */
/* Copy buttons next to numbers (theme.js adds them only where the browser can copy) */
.copy-btn {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  inline-size: 1.75rem; block-size: 1.75rem; margin-inline-start: var(--sp-1); padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: none; color: var(--text-muted); cursor: pointer;
}
.copy-btn:hover { border-color: var(--border); color: var(--text); }
.copy-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.copy-btn.done { color: var(--ok); border-color: currentColor; }
@media print { .copy-btn { display: none; } }
/* Recent customers in the empty search box (admin.js) */
.suggest li.clear { display: block; color: var(--text-muted); font-size: var(--fs-sm); border-block-start: 1px solid var(--border); }
/* Sign-out warning (theme.js): pinned above the page bottom so it is seen wherever staff are on the page */
.session-warn {
  position: fixed; inset-inline: var(--sp-4); inset-block-end: var(--sp-4); z-index: 40;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); box-shadow: var(--shadow);
}
.session-warn[hidden], .session-warn [hidden] { display: none; }

/* ---------- Reseller portal in icona_site's look (Alex 2026-11-02) ----------
   icona_site, the page resellers used before: beige header band over a dark brown rule, brown buttons,
   beige zebra table, a framed customer card. Light theme only; the dark theme keeps the shared tokens. */
body.realm-dealer {
  --ic-beige: #d8cfc4; --ic-beige-2: #e6dcd0; --ic-brown: #4d2a1d;
  --brand: #4d2a1d; --brand-strong: #6b3d2a; --brand-contrast: #ffffff; --focus: #4d2a1d;
  --bg: #f5f5f5;
}
/* dark: back to the shared dark tokens (gold), the bands take the dark surfaces */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.realm-dealer {
    --ic-beige: var(--surface-2); --ic-beige-2: var(--surface-2); --ic-brown: #d4ae45;
    --brand: #d4ae45; --brand-strong: #e0bd5a; --brand-contrast: #0b1620; --focus: #e0bd5a; --bg: #0e1116;
  }
}
:root[data-theme="dark"] body.realm-dealer {
  --ic-beige: var(--surface-2); --ic-beige-2: var(--surface-2); --ic-brown: #d4ae45;
  --brand: #d4ae45; --brand-strong: #e0bd5a; --brand-contrast: #0b1620; --focus: #e0bd5a; --bg: #0e1116;
}
body.realm-dealer .app-header { background: var(--ic-beige); border-block-end: 3px solid var(--ic-brown); }
body.realm-dealer .app-header .brand, body.realm-dealer .app-header .brand small { color: var(--ic-brown); }
/* number · name · balance, as icona_site's header line */
.dealer-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--radius);
  background: var(--ic-beige, var(--surface-2)); border: 3px solid var(--ic-brown, var(--border)); color: var(--ic-brown, var(--text));
}
.dealer-bar .name { margin: 0; font-size: var(--fs-lg); }
.dealer-bar .no, .dealer-bar .bal { font-weight: 700; font-size: var(--fs-lg); }
.dealer-bar .bal { margin-inline-start: auto; }
.dealer-bar .bal.positive { color: var(--ok); }
.dealer-bar .bal.negative { color: var(--danger); }
/* one search field in the middle of the page */
.search-big { display: flex; gap: var(--sp-2); justify-content: center; inline-size: 100%; max-inline-size: 560px; margin-inline: auto; }
.search-big input { flex: 1; min-inline-size: 0; font-size: var(--fs-lg); border: 2px solid var(--ic-beige, var(--border-input)); }
.search-big input:focus { border-color: var(--ic-brown, var(--focus)); }
/* one customer found: icona_site's framed card with Transfer under it */
.callout { background: var(--ic-beige-2, var(--surface-2)); border: 3px solid var(--ic-brown, var(--border)); border-radius: var(--radius); padding: var(--sp-4); max-inline-size: 640px; margin-inline: auto; inline-size: 100%; box-sizing: border-box; }
.callout dl.facts dt { color: var(--ic-brown, var(--text-muted)); font-weight: 600; }
.callout .actions { display: flex; justify-content: flex-end; margin-block-start: var(--sp-3); }
/* several found: icona_site's table, beige head and zebra rows */
table.found th { background: var(--ic-beige, var(--surface-2)); color: var(--ic-brown, var(--text)); text-align: center; }
table.found tbody tr:nth-child(even) { background: var(--ic-beige-2, var(--surface-2)); }
table.found td.negative { color: var(--danger); }
table.found td.act { text-align: end; }
/* phones: each row becomes a small card, the column name before each value */
@media (max-width: 699px) {
  table.found thead { display: none; }
  table.found, table.found tbody, table.found tr, table.found td { display: block; inline-size: 100%; box-sizing: border-box; }
  table.found tr { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-block-end: var(--sp-2); padding: var(--sp-2); }
  table.found td { border: 0; padding: var(--sp-1) var(--sp-2); white-space: normal; }
  table.found td[data-label]:empty { display: none; }
  table.found td[data-label]::before { content: attr(data-label) ": "; color: var(--text-muted); font-size: var(--fs-sm); }
  table.found td.act .btn { inline-size: 100%; }
}

/* Reseller sign-in as icona_site's login page (Alex 2026-11-02): beige title band over a dark brown rule on a
   light grey page, a white card with a soft shadow, bold brown labels, inputs with a beige border that turns brown
   on focus, a full-width brown button. Dark theme: the same shapes on the dark surfaces and gold. */
body.realm-dealer .ic-band {
  margin: 0; padding: var(--sp-5) var(--sp-4); text-align: center; font-size: var(--fs-xl);
  background: var(--ic-beige); color: var(--ic-brown); border-block-end: 3px solid var(--ic-brown);
}
body.realm-dealer main.login { padding-block-start: var(--sp-6); }
body.realm-dealer main.login .card { border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, .1); border-color: transparent; }
body.realm-dealer main.login label:not(.check) { color: var(--ic-brown); font-weight: 700; }
body.realm-dealer main.login input[type="text"], body.realm-dealer main.login input[type="password"],
body.realm-dealer main.login input:not([type]) { border: 2px solid var(--ic-beige); border-radius: 8px; }
body.realm-dealer main.login input:focus { border-color: var(--ic-brown); outline: none; }
body.realm-dealer main.login .btn.primary { background: var(--ic-brown); border-color: var(--ic-brown); color: #fff; border-radius: 8px; }
body.realm-dealer main.login .btn.primary:hover { background: var(--ic-beige); color: var(--ic-brown); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body.realm-dealer main.login .btn.primary { color: var(--brand-contrast); }
  :root:not([data-theme="light"]) body.realm-dealer main.login input[type="password"],
  :root:not([data-theme="light"]) body.realm-dealer main.login input:not([type]) { border-color: var(--border-input); }
}
:root[data-theme="dark"] body.realm-dealer main.login .btn.primary { color: var(--brand-contrast); }
:root[data-theme="dark"] body.realm-dealer main.login input[type="password"],
:root[data-theme="dark"] body.realm-dealer main.login input:not([type]) { border-color: var(--border-input); }
body.realm-dealer main.login .pw-row .btn:not(.primary) { border: 2px solid var(--ic-beige); border-radius: 8px; color: var(--ic-brown); }

/* Live search (theme.js, Alex 2026-11-02): the parts a search replaces sit in the page as if unwrapped;
   while the answer is on its way they fade a little; the searched text is marked in the results. */
[data-live-part] { display: contents; }
[data-live-part][aria-busy="true"] > * { opacity: 0.55; transition: opacity 0.15s; }
form.live-busy { cursor: progress; }
mark.hit { background: var(--warn-bg); color: inherit; border-radius: 2px; padding: 0 1px; }
