/* GCANI Members — "Gezira fields" design system. One stylesheet, no framework.
 *
 * Palette from the Gezira Scheme: Nile ink, canal teal, sorghum gold, on a cool mineral
 * ground. Mobile first. Right-to-left safe: only logical properties (start/end,
 * inline/block), so Arabic mirrors automatically. Never use left/right here.
 */

:root {
  --ink: #12343b;          /* Nile ink: sidebar, headings */
  --ink-2: #1c4a52;
  --teal: #1f7a74;         /* canal teal: actions, charts */
  --teal-dark: #155c57;
  --teal-soft: #e3f0ee;
  --gold: #c8962e;         /* sorghum gold: active, highlights */
  --gold-soft: #f6ecd6;
  --clay: #b4432f;         /* warnings, errors */
  --clay-soft: #f8e6e1;
  --ground: #f2f5f4;       /* mineral background */
  --surface: #ffffff;
  --line: #d9e2e0;
  --line-strong: #b9c7c4;
  --text: #1a2b2e;
  --muted: #5b6e71;
  --radius-s: 6px;
  --radius: 10px;
  --radius-l: 16px;
  --shadow: 0 1px 2px rgba(18, 52, 59, 0.06), 0 4px 16px rgba(18, 52, 59, 0.05);
  --tap: 46px;
  --sidebar: 248px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "SF Arabic",
    "Noto Sans Arabic", "Noto Sans", Tahoma, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
html[dir="rtl"] { font-size: 18px; }
body {
  margin: 0;
  font-family: var(--font);
  line-height: 1.55;
  color: var(--text);
  background: var(--ground);
  font-variant-numeric: tabular-nums;
}
a { color: var(--teal-dark); text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
svg.icon { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

h1 { font-size: 1.6rem; line-height: 1.2; font-weight: 700; color: var(--ink);
  letter-spacing: -0.01em; margin-block: 0 0.75rem; }
h2 { font-size: 1.05rem; font-weight: 650; color: var(--ink); margin-block: 0 0.75rem; }
p { margin-block: 0 0.75rem; }
.help { display: block; color: var(--muted); font-size: 0.9rem; font-weight: 400; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* --- App shell ------------------------------------------------------------------ */
.nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.shell { min-height: 100vh; }

.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 30;
  width: var(--sidebar); display: flex; flex-direction: column;
  background: var(--ink); color: #d7e6e4;
  transform: translateX(-100%); transition: transform 0.2s ease;
}
html[dir="rtl"] .sidebar { transform: translateX(100%); }
.nav-toggle:checked ~ .shell .sidebar { transform: none; }
.scrim { display: none; }
.nav-toggle:checked ~ .scrim {
  display: block; position: fixed; inset: 0; z-index: 20; background: rgba(18, 52, 59, 0.45);
}

/* Brand block: a faint canal grid, like the Gezira irrigation map */
.brand {
  display: flex; gap: 0.75rem; align-items: center; padding: 1.25rem 1.1rem 1.1rem;
  color: #fff; text-decoration: none;
  background-color: var(--ink-2);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(160deg, transparent 58%, rgba(200, 150, 46, 0.35) 58.5%, transparent 60%);
  background-size: 22px 22px, 22px 22px, 100% 100%;
  border-block-end: 1px solid rgba(255, 255, 255, 0.08);
}
.brand:hover { color: #fff; }
.brand-mark { width: 40px; height: 40px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name { font-weight: 700; font-size: 1rem; }
.brand-sub { font-size: 0.78rem; color: #a9c4c1; }

.side-nav { flex: 1; overflow-y: auto; padding: 0.75rem 0.6rem; }
.side-group { margin-block: 0.75rem 0.25rem; padding-inline: 0.6rem; font-size: 0.78rem;
  color: #87a5a2; }
.side-link {
  display: flex; align-items: center; gap: 0.7rem; min-height: 44px;
  padding: 0.45rem 0.7rem; border-radius: var(--radius-s);
  color: #d7e6e4; text-decoration: none; font-size: 0.95rem;
  border-inline-start: 3px solid transparent;
}
.side-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.side-link.active { background: rgba(255, 255, 255, 0.09); color: #fff;
  border-inline-start-color: var(--gold); font-weight: 600; }
.side-link .count { margin-inline-start: auto; min-width: 1.6rem; padding: 0 0.45rem;
  border-radius: 999px; background: var(--gold); color: var(--ink); font-size: 0.78rem;
  font-weight: 700; text-align: center; line-height: 1.5; }

.side-foot { padding: 0.75rem 0.6rem 1rem; border-block-start: 1px solid rgba(255, 255, 255, 0.08); }
.who { padding: 0.25rem 0.7rem 0.5rem; font-size: 0.85rem; color: #a9c4c1; }
.who strong { display: block; color: #fff; font-size: 0.95rem; }
.side-foot form { margin: 0; }
.side-foot button.side-link { width: 100%; background: none; border-block: 0; border-inline-end: 0;
  border-radius: var(--radius-s); justify-content: flex-start; font: inherit; font-weight: 400;
  color: #d7e6e4; cursor: pointer; text-align: start; }
.side-foot button.side-link:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.main-col { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; inset-block-start: 0; z-index: 10;
  display: flex; align-items: center; gap: 0.75rem; min-height: 60px;
  padding: 0.5rem 1rem; background: var(--surface); border-block-end: 1px solid var(--line);
}
.menu-button { display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius-s); color: var(--ink); cursor: pointer; }
.menu-button:hover { background: var(--ground); }
.topbar-brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.top-search { flex: 1; max-width: 520px; position: relative; margin: 0; }
.top-search svg { position: absolute; inset-inline-start: 0.75rem; inset-block-start: 50%;
  transform: translateY(-50%); color: var(--muted); }
.top-search input[type="search"] { min-height: 44px; padding-inline-start: 2.6rem; background: var(--ground);
  border-color: transparent; }
.top-search input[type="search"]:focus { background: var(--surface); border-color: var(--line-strong); }
.top-spacer { flex: 1; }
.lang-switch { margin: 0; }
.lang-switch button { min-height: 44px; padding: 0.2rem 0.85rem; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 0.9rem; font-weight: 500; cursor: pointer; }
.lang-switch button:hover { border-color: var(--teal); color: var(--teal-dark); background: var(--surface); }

.page { width: 100%; max-width: 760px; margin-inline: auto; padding: 1.25rem 1rem 2rem; flex: 1; }
.page.wide { max-width: 1180px; }
.footer { padding: 1.25rem 1rem; text-align: center; color: var(--muted); font-size: 0.82rem; }

@media (max-width: 639px) {
  .topbar { flex-wrap: wrap; }
  .top-spacer { flex: 1; }
  .topbar-brand { flex: 1; }
  .top-search { order: 3; flex-basis: 100%; max-width: none; }
}

@media (min-width: 1024px) {
  .sidebar, html[dir="rtl"] .sidebar { transform: none; }
  .main-col { margin-inline-start: var(--sidebar); }
  .menu-button, .topbar-brand { display: none; }
  .nav-toggle:checked ~ .scrim { display: none; }
  .page { padding: 1.75rem 2rem 2.5rem; }
  .topbar { padding-inline: 2rem; }
}

/* --- Sign-in layout --------------------------------------------------------------- */
.auth-layout { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
.auth-brand {
  display: flex; flex-direction: column; justify-content: space-between; gap: 1.5rem;
  padding: 1.5rem; color: #fff; background-color: var(--ink);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(155deg, transparent 62%, rgba(200, 150, 46, 0.4) 62.4%, transparent 64%);
  background-size: 28px 28px, 28px 28px, 100% 100%;
}
.auth-brand .lang-switch button { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.5); }
.auth-title { font-size: 1.5rem; font-weight: 700; line-height: 1.25; margin: 0; }
.auth-title span { display: block; font-size: 1rem; font-weight: 400; color: #b8d1ce; margin-block-start: 0.35rem; }
.auth-main { display: flex; flex-direction: column; justify-content: center; padding: 2rem 1.25rem; }
.auth-main > * { width: 100%; max-width: 420px; margin-inline: auto; }
.auth-main form { background: var(--surface); padding: 1.5rem; border-radius: var(--radius-l);
  box-shadow: var(--shadow); border: 1px solid var(--line); }
.auth-main form button[type="submit"] { width: 100%; }
/* allauth's "Cancel" is a second button tied to an otherwise empty form */
.auth-main form button + button { margin-block-start: 0.6rem; background: var(--surface);
  color: var(--ink); border-color: var(--line-strong); }
.auth-main form:not(:has(input:not([type="hidden"]), button)) { display: none; }
@media (min-width: 768px) {
  .auth-layout { grid-template-columns: minmax(340px, 42%) 1fr; }
  .auth-brand { padding: 2.5rem; }
  .auth-title { font-size: 2.1rem; }
}

/* --- Page header ----------------------------------------------------------------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 0.75rem 1.5rem; margin-block-end: 1.25rem; }
.page-head h1 { margin: 0; }
.page-head .help { margin-block-start: 0.25rem; }
.crumb { display: inline-flex; gap: 0.35rem; align-items: center; font-size: 0.9rem;
  margin-block-end: 0.6rem; text-decoration: none; color: var(--muted); }
.crumb:hover { color: var(--teal-dark); }

/* --- Panels (cards) ------------------------------------------------------------------- */
.card, .panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.15rem; margin-block-end: 1rem;
}
.panel { box-shadow: var(--shadow); }
.card > :first-child, .panel > :first-child, .card > summary + * { margin-block-start: 0; }
.card > :last-child { margin-block-end: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  margin-block-end: 0.75rem; }
.panel-head h2 { margin: 0; }
.panel-head a { font-size: 0.88rem; }
details.middle-names { margin-block-end: 0.25rem; }
details.middle-names > summary { cursor: pointer; font-weight: 600; color: var(--teal-dark);
  padding-block: 0.6rem; }
details.middle-names[open] > summary { margin-block-end: 0.75rem; }
details.card > summary { cursor: pointer; font-weight: 600; color: var(--ink); min-height: 2rem;
  list-style-position: inside; }

/* --- Messages ---------------------------------------------------------------------------- */
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li, .alert {
  padding: 0.75rem 1rem; border-radius: var(--radius); margin-block-end: 0.5rem;
  background: var(--teal-soft); border: 1px solid #bcdcd7; color: var(--ink);
}
.messages li.error, .alert-error, .errorlist { background: var(--clay-soft); border-color: #eab9ad; color: #7d2a1b; }
.messages li.warning, .alert-warning { background: var(--gold-soft); border-color: #e6cf9c; color: #5e4510; }
.errorlist { list-style: none; padding: 0.5rem 0.75rem; border-radius: var(--radius-s); margin: 0.3rem 0;
  border: 1px solid #eab9ad; }

/* --- Forms ---------------------------------------------------------------------------------- */
form p, .field { margin-block: 0 1rem; }
label { display: block; font-weight: 600; margin-block-end: 0.3rem; color: var(--ink); font-size: 0.95rem; }
input[type="text"], input[type="password"], input[type="email"], input[type="tel"],
input[type="number"], input[type="date"], input[type="search"], input[type="url"], select, textarea {
  width: 100%; min-height: var(--tap); padding: 0.55rem 0.8rem;
  font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(31, 122, 116, 0.18); }
textarea { min-height: 6rem; }
select[multiple] { min-height: 9rem; padding: 0.35rem; }
input[type="checkbox"], input[type="radio"] { width: 1.25rem; height: 1.25rem; accent-color: var(--teal); flex: none; }
input[type="tel"], input[autocomplete="one-time-code"], input[name="code"] { direction: ltr; text-align: start; }
html[dir="rtl"] input[type="tel"] { text-align: end; }
input.narrow { width: 5.5rem; display: inline-block; }

.field label:has(> input[type="radio"]), .field label:has(> input[type="checkbox"]) {
  display: flex; align-items: center; gap: 0.6rem; min-height: 2.6rem; font-weight: 400; margin: 0;
}
.field > label:has(> input[type="checkbox"]) { font-weight: 600; }
.checks .field > div { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 640px) { .checks .field > div { grid-template-columns: 1fr 1fr; } }
.yes-no .field > div { display: flex; flex-wrap: wrap; gap: 0 2rem; }
.yes-no { border-block-end: 1px solid var(--line); margin-block-end: 0.75rem; }
.yes-no:last-child { border-block-end: 0; }
.script { font-size: 1.05rem; background: var(--ground); padding: 0.85rem 1rem; border-radius: var(--radius-s);
  border-inline-start: 4px solid var(--gold); }
fieldset.item { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.75rem 1rem; margin: 0 0 1rem; }
fieldset.item.new { border-style: dashed; }
fieldset.item legend { font-weight: 650; padding-inline: 0.4rem; color: var(--ink); }
label.remove { display: flex; align-items: center; gap: 0.5rem; color: var(--clay); font-weight: 400; }
.filter-row { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; margin-block-start: 0.5rem; }
.filter-row select, .filter-row input[type="search"] { width: auto; flex: 1 1 12rem; }
.filter-row .field { margin: 0; }
.filters label { margin-block-end: 0.3rem; }

/* --- Buttons ----------------------------------------------------------------------------------- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: var(--tap); padding: 0.55rem 1.15rem;
  font: inherit; font-weight: 600; text-decoration: none; line-height: 1.2;
  color: #fff; background: var(--teal); border: 1px solid var(--teal); border-radius: var(--radius-s);
  cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
button:hover, .button:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.button.secondary, button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.button.secondary:hover, button.secondary:hover { background: var(--ground); border-color: var(--teal); color: var(--ink); }
.button.danger, button.danger { background: var(--clay); border-color: var(--clay); }
.button.block, button.block { width: 100%; }
button.link { background: none; border: 0; padding: 0; min-height: auto; color: inherit; font-weight: inherit;
  text-decoration: underline; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-block-start: 1rem; }
.actions + .card, .actions + form { margin-block-start: 1.25rem; }
.page-head .actions { margin: 0; }

/* Big choice buttons (Simple mode "Add wife or husband" …, quick actions) */
.choice-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem; margin-block-end: 1rem; }
@media (min-width: 640px) { .choice-grid { grid-template-columns: 1fr 1fr; } }
.choice-grid .button { min-height: 60px; font-size: 1rem; justify-content: flex-start; padding-inline: 1rem; }

/* --- Wizard progress ------------------------------------------------------------------------------ */
.progress { display: flex; gap: 0.35rem; margin-block: 0.25rem 1.5rem; padding: 0; list-style: none; counter-reset: step; }
.progress li { flex: 1; text-align: center; font-size: 0.8rem; color: var(--muted);
  padding-block-start: 0.55rem; border-block-start: 5px solid var(--line); }
.progress li a { color: inherit; }
.progress li.done { border-color: #8fc3bd; color: var(--ink); }
.progress li.current { border-color: var(--teal); color: var(--ink); font-weight: 700; }

/* --- Lists, tables, badges ------------------------------------------------------------------------- */
.list { list-style: none; padding: 0; margin: 0; }
.list > li { padding: 0.7rem 0; border-block-end: 1px solid var(--line); }
.list > li:last-child { border-block-end: 0; }
/* .list resets padding/margin, so a list that is also a card gets the card's back */
.card.list { padding: 0.25rem 1.15rem; margin-block-end: 1.25rem; }
table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); font-size: 0.95rem; }
th { font-weight: 650; color: var(--muted); font-size: 0.8rem; letter-spacing: 0.02em;
  background: var(--ground); white-space: nowrap; }
th, td { padding: 0.7rem 0.85rem; border: 0; border-block-end: 1px solid var(--line);
  text-align: start; vertical-align: middle; }
tbody tr:last-child td { border-block-end: 0; }
tbody tr:hover td { background: #f8fbfa; }
td .help { display: block; margin: 0.1rem 0 0; }
.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); margin-block-end: 1rem; }
.table-scroll table { border: 0; }
.card .table-scroll, .panel .table-scroll { border-radius: var(--radius-s); margin-inline: 0; }
.badge { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.08rem 0.6rem;
  border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: #e7eeec; color: var(--ink);
  text-decoration: none; white-space: nowrap; }
.badge.ok { background: var(--teal-soft); color: var(--teal-dark); }
.badge.warn { background: var(--gold-soft); color: #7a5810; }
.badge.bad { background: var(--clay-soft); color: #8c3020; }

dl.details { display: grid; grid-template-columns: max-content 1fr; gap: 0.45rem 1.25rem; margin: 0; }
dl.details dt { color: var(--muted); font-size: 0.9rem; }
dl.details dd { margin: 0; }
/* Two-factor method selector (My account) */
fieldset.methods { border: 0; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
fieldset.methods legend { font-weight: 650; color: var(--ink); margin-block-end: 0.5rem; padding: 0; }
.method { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.8rem 1rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.method:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.method input { margin-block-start: 0.15rem; }
.method .help { display: block; margin-block-start: 0.2rem; }
.method .badge { margin-inline-start: 0.4rem; }
.method.is-disabled { cursor: not-allowed; opacity: 0.7; background: var(--ground); }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 1rem; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* Permission grids (Settings → Roles / Users): area names stay in view while the
   action columns scroll sideways on a phone. */
.matrix { width: auto; min-width: 30rem; }
.matrix th, .matrix td { text-align: center; padding-block: 0.5rem; }
.matrix th:not(:first-child), .matrix td:not(:first-child) { padding-inline: 0.4rem; }
.matrix th:first-child, .matrix td:first-child {
  text-align: start; position: sticky; inset-inline-start: 0; z-index: 1;
  min-width: 7.5rem; max-width: 9rem; background: var(--surface); border-inline-end: 1px solid var(--line);
}
@media (min-width: 768px) {
  .matrix th:first-child, .matrix td:first-child { min-width: 13rem; max-width: none; }
}
.matrix th:first-child { background: var(--ground); }
.matrix td:first-child { color: var(--ink); font-weight: 500; line-height: 1.3; }
.matrix td:first-child .badge { margin-inline-start: 0.35rem; font-size: 0.7rem; }

/* "Edit all at once" tables for Settings lists */
.edit-all td { padding: 0.35rem 0.5rem; vertical-align: top; }
.edit-all th { white-space: nowrap; }
.edit-all input[type=text], .edit-all input:not([type]), .edit-all select { width: 100%; min-width: 9rem; margin: 0; }
.edit-all td.col-text { min-width: 15rem; }
.edit-all td.col-select { min-width: 13rem; }
.edit-all input[type=number] { width: 5.5rem; min-width: 0; margin: 0; }
.edit-all td.col-checkbox, .edit-all th:has(.tick-column) { text-align: center; }
.edit-all .tick-column { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 600; margin: 0; cursor: pointer; }
.edit-all tr.has-error td { background: var(--clay-soft); }
.edit-all .errorlist { margin: 0.25rem 0 0; padding: 0.25rem 0.5rem; font-size: 0.85rem; }
.sticky-actions { position: sticky; inset-block-end: 0; background: var(--ground); padding-block: 0.75rem; z-index: 2; }
.matrix th:not(:first-child), .matrix td:not(:first-child) { width: 4.5rem; }
.matrix input[type="checkbox"] { vertical-align: middle; margin: 0; cursor: pointer; }
.matrix select {
  appearance: none; width: 2.75rem; min-height: 2rem; padding: 0; border-radius: 999px;
  text-align: center; text-align-last: center; font-size: 1.35rem; font-weight: 800;
  line-height: 1; color: var(--muted); background: var(--surface); cursor: pointer;
}
.matrix select:has(option[value="allow"]:checked) { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-dark); }
.matrix select:has(option[value="deny"]:checked) { background: var(--clay-soft); border-color: var(--clay); color: #8c3020; }
.matrix .denied { color: var(--clay); font-weight: 700; }
.matrix .granted { color: var(--teal); font-weight: 700; }

/* --- Dashboard ------------------------------------------------------------------------------------- */
.figures {
  display: grid; grid-template-columns: repeat(2, 1fr); margin-block-end: 1.25rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l);
  box-shadow: var(--shadow); overflow: hidden;
}
.figure { padding: 1rem 1.15rem; border-block-end: 1px solid var(--line); text-decoration: none; color: inherit; }
.figure:nth-child(odd) { border-inline-end: 1px solid var(--line); }
.figure-value { display: block; font-size: 2rem; font-weight: 700; line-height: 1.1; color: var(--ink); }
.figure-label { display: block; color: var(--muted); font-size: 0.9rem; margin-block-start: 0.2rem; }
a.figure:hover .figure-value { color: var(--teal); }
@media (min-width: 768px) {
  .figures { grid-template-columns: repeat(4, 1fr); }
  .figure { border-block-end: 0; border-inline-end: 1px solid var(--line); }
  .figure:last-child { border-inline-end: 0; }
}
.dash-grid { display: grid; grid-template-columns: 1fr; gap: 0 1.25rem; }
@media (min-width: 768px) { .dash-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .dash-grid .span-2 { grid-column: 1 / -1; } }

.todo { list-style: none; padding: 0; margin: 0; }
.todo a { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0.25rem;
  border-block-end: 1px solid var(--line); text-decoration: none; color: var(--text); }
.todo li:last-child a { border-block-end: 0; }
.todo a:hover { color: var(--teal-dark); }
.todo .todo-icon { display: inline-flex; width: 34px; height: 34px; border-radius: 50%;
  align-items: center; justify-content: center; background: var(--ground); color: var(--teal); }
.todo .todo-count { margin-inline-start: auto; font-weight: 700; font-size: 1.1rem; color: var(--ink); }
.todo .zero .todo-count { color: var(--muted); font-weight: 400; }

/* Horizontal bar charts (plain HTML, mirrors in Arabic) */
.bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.55rem; }
.bar-row { display: grid; grid-template-columns: minmax(7rem, 46%) 1fr auto; gap: 0.75rem; align-items: center; font-size: 0.92rem; }
.bar-label { line-height: 1.3; overflow-wrap: anywhere; }
.bar-track { display: block; height: 12px; background: var(--ground); border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--teal); border-radius: 999px; }
.bar-row.highlight .bar-fill { background: var(--gold); }
.bar-value { font-weight: 650; color: var(--ink); min-width: 2rem; text-align: end; }
td .bar-track { height: 8px; min-width: 60px; margin-block-start: 0.45rem; }
.empty { color: var(--muted); padding-block: 0.5rem; }

.footer-note { color: var(--muted); font-size: 0.85rem; }

img[src^="data:image/svg"] { max-width: 220px; background: #fff; padding: 0.5rem; border-radius: var(--radius-s); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
@media print {
  .sidebar, .topbar, .footer, .actions, .lang-switch, .scrim { display: none !important; }
  .main-col { margin: 0 !important; }
  body { background: #fff; }
}

/* --- Public self-registration pages (no sidebar) ------------------------------------------------ */
body.public { background: var(--ground); }
.public-top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.75rem 1rem; background: var(--ink); color: #fff;
}
.public-brand { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.public-brand strong { display: block; font-size: 1rem; line-height: 1.25; }
.public-brand span span { display: block; font-size: 0.8rem; color: #b8d1ce; }
.public-top .lang-switch button { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.5); }
.public-page { max-width: 720px; }
body.public .footer { text-align: center; }
/* the bot trap: off screen, never focusable by people */
.hp { position: absolute; inset-inline-start: -10000px; width: 1px; height: 1px; overflow: hidden; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
button.small, .button.small { min-height: 2.25rem; padding: 0.3rem 0.8rem; font-size: 0.9rem; }

/* Sharing a registration link */
.share input[readonly] { font-family: ui-monospace, monospace; font-size: 0.9rem; }
.qr-box { display: flex; justify-content: center; }
.qr-box svg { width: min(100%, 300px); height: auto; }
@media print {
  .sidebar, .topbar, .footer, .share, form, .page-head .badge { display: none !important; }
  .qr-box svg { width: 70mm; }
}
.notice-scroll { max-height: 18rem; overflow-y: auto; padding-inline-end: 0.5rem; border-block-end: 1px solid var(--line); }
