/* ShareGrow portals — one stylesheet, no build step.
   Tokens first; every colour below comes from them so dark mode is just a token swap. */

:root {
  --brand: #11734f;
  --brand-strong: #0b5a3d;
  --brand-soft: #e6f3ed;
  --brand-ink: #ffffff;

  --bg: #f5f6f4;
  --surface: #ffffff;
  --surface-2: #f9faf8;
  --line: #e3e6e1;
  --line-strong: #cdd3cb;
  --ink: #18211c;
  --ink-2: #4a554e;
  --ink-3: #6f7a73;

  --success: #15803d; --success-bg: #e8f6ec;
  --info: #1d5fa8;    --info-bg: #e8f0fa;
  --warning: #9a5b00; --warning-bg: #fdf2dc;
  --danger: #b42318;  --danger-bg: #fdecea;
  --muted: #5d6762;   --muted-bg: #eef0ed;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 20, .05), 0 1px 3px rgba(16, 24, 20, .06);
  --shadow-lg: 0 8px 24px rgba(16, 24, 20, .08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar: 232px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #3fbf8a; --brand-strong: #6dd3a8; --brand-soft: #143528; --brand-ink: #06140e;
    --bg: #0f1412; --surface: #161d1a; --surface-2: #1b2420; --line: #26312c; --line-strong: #34413a;
    --ink: #e8eeea; --ink-2: #b6c2bb; --ink-3: #8c9993;
    --success: #5fd08a; --success-bg: #13301f;
    --info: #7fb2ee;    --info-bg: #142538;
    --warning: #f0b95a; --warning-bg: #33260e;
    --danger: #f28b82;  --danger-bg: #3a1714;
    --muted: #a3aea8;   --muted-bg: #222b27;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 8px 24px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--font); font-variant-numeric: tabular-nums;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
small, .small { font-size: .85rem; }
.muted { color: var(--ink-3); }
.mono { font-family: var(--mono); font-size: .9em; }
.cur { color: var(--ink-3); font-weight: 500; font-size: .8em; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 2px; }
.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
        stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; height: 60px;
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-size: 1.05rem; }
.brand:hover { text-decoration: none; }
.brand small { display: block; font-weight: 500; color: var(--ink-3); font-size: .75rem; line-height: 1; margin-top: 2px; }
/* Same logo and name as the login page */
.brand .leaf-logo { width: 30px; height: 30px; }
.brand-name { display: block; color: var(--forest); letter-spacing: -.02em; line-height: 1.15; }
.brand-name .accent { color: var(--leaf); }
@media (prefers-color-scheme: dark) { .brand-name { color: var(--leaf); } .brand-name .accent { color: #7fd3a3; } }
@media (max-width: 480px) { .brand-text { display: none; } }
.topbar .spacer { flex: 1; }
.switch { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--muted-bg); }
.switch a { padding: 5px 12px; border-radius: 999px; color: var(--ink-2); font-size: .85rem; font-weight: 600; }
.switch a:hover { text-decoration: none; color: var(--ink); }
.switch a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.icon-btn { position: relative; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
            color: var(--ink-2); }
.icon-btn:hover { background: var(--muted-bg); color: var(--ink); text-decoration: none; }
.dot { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
       background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center;
       border: 2px solid var(--surface); }
.who { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 999px; color: var(--ink); }
.who:hover { background: var(--muted-bg); text-decoration: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-strong);
          display: grid; place-items: center; font-weight: 700; font-size: .85rem; }
.who-name { font-weight: 600; font-size: .9rem; line-height: 1.2; }
.who-name small { display: block; color: var(--ink-3); font-weight: 500; font-size: .75rem; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: calc(100vh - 60px); }
.sidebar { border-right: 1px solid var(--line); background: var(--surface); padding: 16px 12px; }
.sidebar nav { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 14px 12px 6px; font-size: .72rem; font-weight: 700; letter-spacing: .06em;
             text-transform: uppercase; color: var(--ink-3); }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm);
            color: var(--ink-2); font-weight: 550; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-item.on { background: var(--brand-soft); color: var(--brand-strong); }
.nav-item .count { margin-left: auto; font-size: .75rem; font-weight: 700; padding: 1px 8px; border-radius: 999px;
                   background: var(--warning-bg); color: var(--warning); }
main { padding: 28px 40px 64px; max-width: 1180px; width: 100%; margin-inline: auto; }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }  /* never wider than the screen */
  .sidebar { position: sticky; top: 60px; z-index: 15; padding: 6px 8px; border-right: 0;
             border-bottom: 1px solid var(--line); }
  .sidebar nav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 4px; }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .nav-label { display: none; }
  .nav-item { flex: none; padding: 8px 12px; font-size: .9rem; }
  .nav-item .icon { width: 18px; height: 18px; }
  main { padding: 20px 16px 56px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .who-name, .brand small { display: none; }
  h1 { font-size: 1.35rem; }
}

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
             margin-bottom: 22px; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); }
.crumbs { font-size: .85rem; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a { color: var(--ink-3); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Cards and grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-body { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
             padding: 14px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head a { font-size: .875rem; font-weight: 600; }
.card + .card, .stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }
@media (max-width: 1000px) { .grid-main, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.section { margin-top: 24px; }

/* ---------- Stat tiles ---------- */
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 20px; }
.stat { padding: 16px 18px; }
.stat-label { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: .82rem; font-weight: 600; }
.stat-label .icon { width: 17px; height: 17px; }
.stat-value { margin-top: 6px; font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.stat-note { margin-top: 4px; font-size: .82rem; color: var(--ink-3); }
.stat.hero { background: linear-gradient(135deg, var(--brand), var(--brand-strong)); border-color: transparent; color: var(--brand-ink); }
.stat.hero .stat-label, .stat.hero .stat-note, .stat.hero .cur { color: color-mix(in srgb, var(--brand-ink) 78%, transparent); }
.stat.alert-danger { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.stat.alert-danger .stat-value { color: var(--danger); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
         font-size: .76rem; font-weight: 650; white-space: nowrap; line-height: 1.6; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-muted { background: var(--muted-bg); color: var(--muted); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px;
       padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface);
       color: var(--ink); font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-solid-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: .84rem; border-radius: 8px; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Tables ---------- */
/* No table ever scrolls sideways. A table shows as a table while it fits; when it would not fit
   (phone, tablet, narrow window, sidebar open), portal.js adds .is-stacked and each row becomes a card
   listing every value with its column name. Without JavaScript, phones get the older stacked view. */
.table-wrap { overflow-x: auto; }
.js .table-wrap { overflow-x: visible; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
     color: var(--ink-3); padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2);
     white-space: nowrap; }
.js th { white-space: normal; }  /* headings may take two lines before the table has to become cards */
td { overflow-wrap: break-word; }  /* long emails and references break instead of widening the table */
table.is-stacked td { overflow-wrap: anywhere; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.is-new td { background: color-mix(in srgb, var(--brand-soft) 60%, transparent); }
.cell-main { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: .82rem; color: var(--ink-3); }
a.row-link { color: inherit; }
a.row-link:hover { text-decoration: none; }
a.row-link:hover .cell-main { color: var(--brand); }

/* Compact tables: the step before cards */
table.is-compact th, table.is-compact td { padding-left: 8px; padding-right: 8px; }
table.is-compact th.sortable { padding: 0; }
table.is-compact th.sortable a { padding: 10px 8px; }
table.is-compact td.nowrap, table.is-compact .badge { white-space: normal; }
table.is-compact th:first-child, table.is-compact td:first-child { padding-left: 16px; }

/* Stacked tables: one card per row, "Label  value" lines, nothing hidden */
table.is-stacked, table.is-stacked tbody, table.is-stacked tr, table.is-stacked td { display: block; width: auto; }
table.is-stacked thead { display: none; }
table.is-stacked tr { position: relative; padding: 12px 16px; border-bottom: 1px solid var(--line); }
table.is-stacked tr:last-child { border-bottom: 0; }
table.is-stacked tr[hidden] { display: none; }
table.is-stacked td { display: flow-root; padding: 4px 0; border: 0; text-align: right; white-space: normal; }
table.is-stacked td::before { content: attr(data-label); float: left; max-width: 45%; margin-right: 14px; text-align: left;
  font-size: .74rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-3); line-height: 1.9;
  font-family: var(--font); }
table.is-stacked td > div, table.is-stacked td > form { display: inline-block; vertical-align: top; text-align: right; max-width: 55%; }
table.is-stacked td > .cell-sub { display: block; max-width: none; }  /* the small second line goes underneath */
table.is-stacked td:empty, table.is-stacked td.cell-blank { display: none; }
table.is-stacked td.hide-sm { display: flow-root; }     /* every column is shown, with its name */
table.is-stacked td.cell-title { display: block; text-align: left; padding: 0 0 6px; font-size: 1rem; }
table.is-stacked td.cell-title > div { display: block; max-width: none; text-align: left; }
table.is-stacked td.cell-title::before { content: none; }
table.is-stacked td.num { white-space: normal; }
table.is-stacked td.cell-control { display: grid; gap: 4px; text-align: left; }  /* cells holding a box or button */
table.is-stacked td.cell-control::before { float: none; max-width: none; line-height: 1.4; }
table.is-stacked td.cell-control > div, table.is-stacked td.cell-control > form { display: block; max-width: none; text-align: left; }
table.is-stacked td.cell-control input:not([type=checkbox]), table.is-stacked td.cell-control select { width: 100%; min-width: 0; }
table.is-stacked td.select { position: absolute; top: 12px; right: 16px; width: auto; padding: 0; display: block; }
table.is-stacked td.select::before { content: none; }
table.is-stacked.selectable td.cell-title { padding-right: 34px; }
table.is-stacked .show-sm { display: none; }            /* those details now have their own lines */
table.is-stacked tbody tr:hover td { background: none; }
table.is-stacked tr.is-selected { background: color-mix(in srgb, var(--brand-soft) 70%, transparent); }
table.is-stacked tr.is-selected td { background: none; }
table.is-stacked tr.has-errors { background: color-mix(in srgb, var(--danger-bg) 70%, transparent); }

@media (min-width: 700px) {  /* tablets: the details of a card in two columns */
  table.is-stacked tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 36px; }
  table.is-stacked td.cell-title { grid-column: 1 / -1; }
}

/* Phones without JavaScript: the older stacked rows */
@media (max-width: 640px) {
  html:not(.js) table.stack-sm thead { display: none; }
  html:not(.js) table.stack-sm tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 16px;
                      border-bottom: 1px solid var(--line); }
  html:not(.js) table.stack-sm td { padding: 0; border: 0; }
  html:not(.js) table.stack-sm td.num { grid-column: 2; }
  html:not(.js) table.stack-sm td.hide-sm { display: none; }
}

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 13px 20px; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .icon-tile { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
                   background: var(--muted-bg); color: var(--ink-2); flex: none; }
.icon-tile.t-brand { background: var(--brand-soft); color: var(--brand-strong); }
.icon-tile.t-warning { background: var(--warning-bg); color: var(--warning); }
.icon-tile.t-danger { background: var(--danger-bg); color: var(--danger); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 0; }
.dl dt { color: var(--ink-3); font-size: .88rem; }
.dl dd { margin: 0; font-weight: 550; text-align: right; }
.dl.left dd { text-align: left; }

/* ---------- Tabs and toolbars ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap;
           margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.tabs a { padding: 9px 14px; color: var(--ink-3); font-weight: 600; font-size: .9rem; white-space: nowrap;
          border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--brand-strong); border-bottom-color: var(--brand); }
.tabs .n { margin-left: 6px; padding: 0 7px; border-radius: 999px; background: var(--muted-bg); color: var(--ink-2);
           font-size: .75rem; }
.search { position: relative; }
.search input { min-width: 260px; }
.search input[type=search] { padding-left: 40px; } /* beats the generic input rule further down */
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-2);
                width: 19px; height: 19px; stroke-width: 2.5; pointer-events: none; }
@media (max-width: 640px) { .search, .search input { width: 100%; min-width: 0; } }

/* ---------- Data tables: search, filters, sorting ---------- */
.table-tools { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; padding: 14px 16px;
               border-bottom: 1px solid var(--line); }
.table-tools .grow { flex: 1 1 260px; }
.table-tools .search input { min-width: 0; width: 100%; }
.table-tools .tool { display: flex; flex-direction: column; gap: 4px; font-size: .75rem; font-weight: 600; color: var(--ink-3); }
.table-tools .tool select, .table-tools .tool input { min-height: 38px; padding: 6px 10px; font-size: .9rem; width: auto; }
.table-tools .tool-actions { display: flex; gap: 6px; align-items: center; min-height: 38px; }
.js .table-tools [type=submit] { display: none; }  /* filters apply as soon as they change */
.table-count { padding: 8px 16px; font-size: .8rem; color: var(--ink-3); border-bottom: 1px solid var(--line); }
th.sortable { padding: 0; }
th.sortable a { display: flex; gap: 6px; align-items: center; padding: 10px 16px; color: inherit; }
th.sortable.num a { justify-content: flex-end; }
th.sortable a:hover { color: var(--ink); text-decoration: none; }
th.sortable.sorted { color: var(--brand-strong); }
.sort-arrow { font-size: .7rem; opacity: .45; }
th.sorted .sort-arrow { opacity: 1; }
.show-sm { display: none; }  /* repeated details for phones without JavaScript */
@media (max-width: 640px) {
  html:not(.js) .show-sm { display: block; }
  .table-tools .tool { flex: 1 1 140px; }
  .table-tools .tool select, .table-tools .tool input { width: 100%; }
}

/* ---------- Forms ---------- */
.form { display: grid; gap: 18px; }
.field label, .field legend { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; padding: 0; }
.field fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.field .help { margin-top: 6px; font-size: .82rem; color: var(--ink-3); }
.field .errors { margin: 6px 0 0; padding: 0; list-style: none; color: var(--danger); font-size: .85rem; font-weight: 550; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=date], input[type=search], input[type=tel],
select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: inherit; font-size: 1rem;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); }
.amount-input { position: relative; }
.amount-input input { font-size: 1.35rem; font-weight: 700; padding-right: 64px; }
.amount-input .unit { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-weight: 600; }

/* Radio choices drawn as cards */
.choices > div, .choices { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.choices label { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 14px; border: 1px solid var(--line-strong);
                 border-radius: 10px; cursor: pointer; font-weight: 550; background: var(--surface); }
.choices label:hover { border-color: var(--brand); }
.choices input { accent-color: var(--brand); width: 18px; height: 18px; margin: 0; }
.choices label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong);
                                    box-shadow: 0 0 0 1px var(--brand) inset; }
.checklist { max-height: 280px; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: 10px; }
.checklist > div > div, .checklist label { display: flex; }
.checklist label { gap: 10px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); margin: 0;
                   font-weight: 500; cursor: pointer; width: 100%; }
.checklist label:has(input:checked) { background: var(--brand-soft); }
.checklist input { accent-color: var(--brand); width: 18px; height: 18px; }

/* ---------- Messages and callouts ---------- */
.messages { display: grid; gap: 10px; margin-bottom: 18px; }
.msg, .callout { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: 10px;
                 border: 1px solid transparent; font-weight: 500; }
.msg .icon, .callout .icon { margin-top: 1px; }
.msg-success { background: var(--success-bg); color: var(--success); }
.msg-error, .callout-danger { background: var(--danger-bg); color: var(--danger); }
.msg-warning, .callout-warning { background: var(--warning-bg); color: var(--warning); }
.msg-info, .callout-info { background: var(--info-bg); color: var(--info); }
.callout-brand { background: var(--brand-soft); color: var(--brand-strong); }
.callout .grow { flex: 1; }
.callout p { margin: 2px 0 0; color: inherit; opacity: .9; font-weight: 450; }
.callout .btn { margin-left: auto; }

/* ---------- Loan stepper ---------- */
.stepper { display: flex; list-style: none; margin: 0; padding: 0; counter-reset: step; overflow-x: auto; }
.stepper li { flex: 1; min-width: 92px; position: relative; text-align: center; font-size: .8rem; font-weight: 600;
              color: var(--ink-3); padding-top: 38px; }
.stepper li::before { counter-increment: step; content: counter(step); position: absolute; top: 0; left: 50%;
                      transform: translateX(-50%); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
                      background: var(--surface); border: 2px solid var(--line-strong); color: var(--ink-3); z-index: 1;
                      font-size: .8rem; }
.stepper li::after { content: ""; position: absolute; top: 13px; left: calc(-50% + 14px); right: calc(50% + 14px);
                     height: 2px; background: var(--line-strong); }
.stepper li:first-child::after { display: none; }
.stepper li.done { color: var(--ink-2); }
.stepper li.done::before { content: "✓"; background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.stepper li.done::after, .stepper li.current::after, .stepper li.stopped::after { background: var(--brand); }
.stepper li.current { color: var(--brand-strong); }
.stepper li.current::before { border-color: var(--brand); color: var(--brand-strong);
                              box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.stepper li.stopped { color: var(--danger); }
.stepper li.stopped::before { content: "✕"; background: var(--danger); border-color: var(--danger); color: #fff; }

/* ---------- Progress bar ---------- */
.progress { height: 8px; border-radius: 999px; background: var(--muted-bg); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.hero .progress { background: rgba(255,255,255,.25); }
.hero .progress > span { background: var(--brand-ink); }
.progress-meta { display: flex; justify-content: space-between; font-size: .82rem; color: var(--ink-3); margin-top: 6px; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 4px 0 0; }
.timeline li { position: relative; padding: 0 0 18px 26px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 10px; height: 10px; border-radius: 50%;
                       background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.timeline li::after { content: ""; position: absolute; left: 9px; top: 20px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline .when { font-size: .8rem; color: var(--ink-3); }
.timeline .what { font-weight: 600; }
.timeline .comment { margin-top: 4px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2);
                     border: 1px solid var(--line); font-size: .9rem; color: var(--ink-2); }

/* ---------- Quote box ---------- */
.quote { background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 16px 18px; }
.quote .big { font-size: 1.6rem; font-weight: 750; letter-spacing: -.02em; }
.quote[data-state="empty"] .quote-body { display: none; }
.quote[data-state="ready"] .quote-empty { display: none; }
.quote .problem { margin-top: 10px; color: var(--danger); font-weight: 600; font-size: .9rem; }
.quote[data-state="problem"] .quote-body, .quote[data-state="problem"] .quote-empty { display: none; }
.quote[data-state="problem"] .problem { margin-top: 0; }
.period-pick { display: grid; grid-template-columns: 1fr 8rem; gap: 0 16px; align-items: start; }
.period-pick input[type=number] { max-width: 8rem; }
@media (max-width: 480px) { .period-pick { grid-template-columns: 1fr; } }

/* ---------- Empty states and pagination ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty .icon { width: 40px; height: 40px; color: var(--line-strong); margin-bottom: 8px; stroke-width: 1.5; }
.empty h3 { color: var(--ink-2); margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-top: 1px solid var(--line);
         font-size: .875rem; color: var(--ink-3); }

/* ---------- Receipt ---------- */
.receipt { max-width: 520px; }
.receipt-top { text-align: center; padding: 26px 20px 18px; border-bottom: 1px dashed var(--line-strong); }
.receipt-top .stat-value { font-size: 2rem; }
.receipt-state { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 10px; }
.receipt-state .icon { width: 28px; height: 28px; stroke-width: 2.2; }

/* ---------- Sign in ---------- */
/* Brand colours from the "Save Today, Grow Tomorrow" design. */
:root { --forest: #1b5e3b; --forest-dark: #14462c; --forest-light: #257a4e; --leaf: #3da66e;
        --gold: #d9822b; --gold-light: #e0a526; --login-bg: #eceef2; }
@media (prefers-color-scheme: dark) { :root { --login-bg: #0b100e; } }

.login { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; background: var(--login-bg); }
.login-card { width: 100%; max-width: 1040px; display: grid; grid-template-columns: 48fr 52fr; min-height: 660px;
              padding: 14px; border-radius: 24px; background: var(--surface); box-shadow: 0 20px 50px rgba(0, 0, 0, .06); }

/* Left: the green panel */
.login-hero { position: relative; overflow: hidden; border-radius: 16px; padding: 40px; color: #fff;
              display: flex; flex-direction: column; justify-content: space-between; user-select: none;
              /* Layers, top first: soft highlights, a see-through green tint, then the tailoring
                 picture (set by the template as --hero-image), on a mid-green base. */
              background:
                radial-gradient(circle at 10% 20%, rgba(61, 166, 110, .45) 0%, transparent 50%),
                radial-gradient(circle at 85% 75%, rgba(224, 165, 38, .25) 0%, transparent 45%),
                linear-gradient(160deg, rgba(27, 94, 59, .55) 0%, rgba(17, 63, 39, .72) 100%),
                var(--hero-image, none) center / cover no-repeat,
                #2f7d55;
              box-shadow: inset 0 2px 8px rgba(0, 0, 0, .12); }
/* A photo (often light, busy or on white) needs a deeper tint so the white text stays readable. */
.login-hero.has-photo { background:
    radial-gradient(circle at 10% 20%, rgba(61, 166, 110, .35) 0%, transparent 50%),
    linear-gradient(160deg, rgba(27, 94, 59, .78) 0%, rgba(17, 63, 39, .9) 100%),
    var(--hero-image, none) center / cover no-repeat,
    #1b5e3b; }
.login-hero h1, .login-kicker, .login-hero .group-name { text-shadow: 0 1px 12px rgba(0, 0, 0, .25); }
.login-hero::before { content: ""; position: absolute; inset: 0; pointer-events: none;
                      background: radial-gradient(ellipse at top left, rgba(255, 255, 255, .15) 0%, transparent 60%); }
.login-hero .blob { position: absolute; border-radius: 50%; pointer-events: none; }
.login-hero .blob-1 { right: -64px; top: -64px; width: 320px; height: 320px; background: rgba(52, 211, 153, .12); filter: blur(64px); }
.login-hero .blob-2 { left: -40px; bottom: 80px; width: 256px; height: 256px; background: rgba(37, 122, 78, .22); filter: blur(40px); }
.login-hero > :not(.blob) { position: relative; z-index: 1; }
.login-kicker { margin: 8px 0 12px; font-size: .875rem; font-weight: 500; letter-spacing: .02em; color: #d1fae5; opacity: .9; }
.login-hero h1 { max-width: 340px; font-size: 2.5rem; line-height: 1.15; letter-spacing: -.025em; font-weight: 700; color: #fff; }
.login-hero .group-name { margin-top: 14px; color: rgba(209, 250, 229, .85); font-size: .95rem; }
.login-pill { align-self: center; display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px;
              background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .15); backdrop-filter: blur(4px);
              font-size: .75rem; font-weight: 500; letter-spacing: .02em; color: rgba(209, 250, 229, .9); }
.login-pill .icon { width: 16px; height: 16px; color: #d1fae5; }

/* Right: the form */
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: 40px 56px; }
.login-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; font-size: 1.25rem; font-weight: 700;
               letter-spacing: -.02em; color: var(--forest); }
.login-brand .accent { color: var(--leaf); }
.leaf-logo { position: relative; width: 32px; height: 32px; flex: none; }
.leaf-logo span { position: absolute; left: 50%; bottom: 3px; width: 16px; height: 24px; margin-left: -8px; border-radius: 999px;
                  transform-origin: 50% 100%; }
.leaf-logo span:nth-child(1) { background: var(--forest); transform: rotate(-28deg); }
.leaf-logo span:nth-child(2) { background: var(--leaf); opacity: .92; }
.leaf-logo span:nth-child(3) { width: 14px; height: 20px; margin-left: -7px; background: var(--gold); opacity: .92; transform: rotate(28deg); }
.login-panel h2 { font-size: 1.875rem; font-weight: 700; letter-spacing: -.025em; }
.login-panel .lead { margin: 4px 0 24px; font-size: .875rem; color: var(--ink-3); }

.login-form { display: grid; gap: 16px; }
.login-form .row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.login-form label { display: block; font-size: .75rem; font-weight: 600; color: var(--ink-2); }
.login-form .row label { margin: 0; }
.login-form .field > label { margin-bottom: 6px; }
.login-form input[type=text], .login-form input[type=password] {
  min-height: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: .9rem; }
.login-form input:focus { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(27, 94, 59, .2); }
.login-form .help { font-size: .75rem; }
.link-btn { padding: 0; border: 0; background: none; font: inherit; font-size: .75rem; font-weight: 500; color: var(--forest); cursor: pointer; }
.link-btn:hover { color: var(--gold); }
.forgot-note { margin-top: 8px; padding: 10px 12px; border-radius: 8px; background: var(--brand-soft); color: var(--brand-strong); font-size: .8rem; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 42px !important; }
.reveal { position: absolute; inset: 0 0 0 auto; width: 40px; display: grid; place-items: center; border: 0; background: none;
          color: var(--ink-3); cursor: pointer; border-radius: 0 8px 8px 0; }
.reveal:hover, .reveal[aria-pressed="true"] { color: var(--forest); }
.reveal .icon { width: 17px; height: 17px; }
.reveal .icon-hide, .reveal[aria-pressed="true"] .icon-show { display: none; }
.reveal[aria-pressed="true"] .icon-hide { display: block; }
.login-submit { width: 100%; margin-top: 8px; padding: 11px 16px; border: 0; border-radius: 8px; background: var(--forest); color: #fff;
                font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.login-submit:hover { background: var(--forest-dark); box-shadow: 0 2px 6px rgba(0, 0, 0, .12); }
.login-foot { margin-top: 18px; text-align: center; font-size: .75rem; color: var(--ink-3); }

@media (prefers-color-scheme: dark) {
  .login-brand, .link-btn, .reveal:hover, .reveal[aria-pressed="true"] { color: var(--leaf); }
}
@media (max-width: 1023px) {
  .login-card { grid-template-columns: 1fr; min-height: 0; }
  .login-hero { padding: 32px; gap: 40px; }
  .login-hero h1 { font-size: 1.9rem; }
  .login-panel { padding: 32px 24px; }
}
@media (max-width: 480px) {
  .login { padding: 12px; }
  .login-card { padding: 10px; border-radius: 20px; }
  .login-hero { padding: 26px 22px; }
  .login-hero h1 { font-size: 1.6rem; }
  .login-panel { padding: 26px 8px 18px; }
}

/* Language switcher: a small pill in the top bar, full names on the login page */
.lang-switch { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--muted-bg); }
.lang-switch button { padding: 4px 10px; border: 0; border-radius: 999px; background: none; color: var(--ink-2);
                      font: inherit; font-size: .78rem; font-weight: 700; letter-spacing: .02em; cursor: pointer; }
.lang-switch button:hover { color: var(--ink); }
.lang-switch button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.lang-switch-full button { padding: 5px 12px; font-size: .8rem; font-weight: 600; letter-spacing: 0; }
.lang-switch-full button.on { color: var(--forest); }
.login-lang { display: flex; justify-content: flex-end; margin-bottom: 18px; }

/* Phones: drop the green panel so the form comes first; the switcher sits above the form. */
@media (max-width: 640px) {
  .login-hero { display: none; }
  .login { place-items: start center; }
  .login-card { padding: 6px; }
  .login-panel { padding: 18px 16px 20px; }
  .login-lang { justify-content: center; margin-bottom: 22px; }
}

/* Error pages */
.auth-form { display: grid; place-items: center; padding: 32px 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }

/* Stacked alerts */
.callout + .callout { margin-top: 10px; }


/* ---------- Office dashboard ---------- */
/* Chart colours: a validated categorical set (CVD-safe in any order), in a fixed order:
   1 = paid / savings, 2 = expected / shares, 3 = loan repayments. */
:root { --s1: #1baf7a; --s2: #eb6834; --s3: #2a78d6; }
@media (prefers-color-scheme: dark) { :root { --s1: #199e70; --s2: #d95926; --s3: #3987e5; } }

.dash-head .search input { min-width: 300px; background: var(--surface); }
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.dash-main, .dash-side { display: grid; gap: 18px; min-width: 0; }
@media (max-width: 1180px) { .dash { grid-template-columns: minmax(0, 1fr); } .dash-side { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); } }

.kpis { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .kpis { grid-template-columns: minmax(0, 1fr); } }
.kpi { padding: 16px 18px 18px; border-radius: 16px; }
.kpi-icon { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 14px;
            background: var(--brand-soft); color: var(--forest); }
.kpi-label { color: var(--ink-3); font-size: .88rem; font-weight: 600; }
.kpi-value { margin-top: 2px; font-size: 1.45rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; overflow-wrap: anywhere; }
.kpi-note { margin-top: 4px; font-size: .8rem; color: var(--ink-3); }
.kpi-hero { background: linear-gradient(150deg, var(--forest-light), var(--forest) 55%, var(--forest-dark)); border-color: transparent; color: #fff;
            box-shadow: 0 10px 24px rgba(27, 94, 59, .28); }
.kpi-hero .kpi-icon { background: rgba(255, 255, 255, .16); color: #fff; }
.kpi-hero .kpi-label, .kpi-hero .kpi-note, .kpi-hero .cur { color: rgba(255, 255, 255, .8); }
.kpi-alert .kpi-value { color: var(--danger); }

.dash-charts { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
@media (max-width: 900px) { .dash-charts { grid-template-columns: minmax(0, 1fr); } }
.chart-card .card-head { border-bottom: 0; padding-bottom: 0; }
.chart-sub { margin: 0 0 6px; font-size: .82rem; color: var(--ink-3); }
.legend { display: flex; gap: 14px; list-style: none; margin: 0; padding: 0; font-size: .8rem; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: 6px; }
.key { display: inline-block; flex: none; }
.key-line { width: 16px; height: 0; border-top: 2px solid; }
.key-dash { width: 16px; height: 0; border-top: 2px dashed; }
.key-dot { width: 10px; height: 10px; border-radius: 50%; background: currentColor; }
.key.s1 { color: var(--s1); border-color: var(--s1); }
.key.s2 { color: var(--s2); border-color: var(--s2); }
.key.s3 { color: var(--s3); border-color: var(--s3); }

.chart-wrap { position: relative; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--ink-3); font-size: 11px; }
.chart .line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .line.dashed { stroke-dasharray: 6 5; }
.chart .s1 { stroke: var(--s1); } .chart .s2 { stroke: var(--s2); } .chart .s3 { stroke: var(--s3); }
.chart .dot { fill: var(--surface); stroke-width: 2; }
.chart .crosshair { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hit { fill: transparent; cursor: crosshair; }
.tip { position: absolute; z-index: 5; pointer-events: none; min-width: 150px; padding: 8px 10px; border-radius: 10px;
       background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); font-size: .8rem; color: var(--ink); }
.tip-title { font-weight: 700; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.tip-row b { margin-left: auto; padding-left: 10px; }
.table-toggle { margin-top: 10px; font-size: .85rem; }
.table-toggle summary { cursor: pointer; color: var(--ink-3); }
.table-toggle table { margin-top: 8px; font-size: .85rem; }

.ring-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.ring-wrap { width: 150px; flex: none; }
.ring { display: block; width: 100%; height: auto; }
.ring-track { fill: none; stroke: var(--muted-bg); }
.ring-slice { fill: none; cursor: pointer; transition: stroke-width .15s; }
.ring-slice:hover { stroke-width: 24; }
.ring-slice.s1 { stroke: var(--s1); } .ring-slice.s2 { stroke: var(--s2); } .ring-slice.s3 { stroke: var(--s3); }
.ring-total { fill: var(--ink); font-size: 20px; font-weight: 750; }
.ring-caption { fill: var(--ink-3); font-size: 11px; }
.ring-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; flex: 1; min-width: 150px; font-size: .85rem; }
.ring-legend li { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.ring-legend b { color: var(--ink); }
.period-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; padding-top: 14px;
                 border-top: 1px solid var(--line); }
.period-totals span { display: block; font-size: .78rem; color: var(--ink-3); }
.period-totals b { font-size: .92rem; overflow-wrap: anywhere; }

.tx-table td { padding-top: 10px; padding-bottom: 10px; }
.tx-who { display: flex; align-items: center; gap: 10px; }
.tx-who .cell-sub { display: block; }
.avatar-sm { width: 32px; height: 32px; font-size: .75rem; flex: none; }

.side-card .card-head { border-bottom: 0; padding-bottom: 0; }
.side-card .card-body { display: grid; gap: 14px; }
.fund-card { position: relative; overflow: hidden; padding: 18px; border-radius: 14px; color: #fff; min-height: 168px;
             display: flex; flex-direction: column; justify-content: space-between;
             background: radial-gradient(circle at 85% 15%, rgba(224, 165, 38, .35), transparent 45%),
                         linear-gradient(140deg, var(--forest-light), var(--forest) 50%, #113f27);
             box-shadow: 0 12px 26px rgba(27, 94, 59, .3); }
.fund-card::after { content: ""; position: absolute; right: -50px; bottom: -70px; width: 180px; height: 180px; border-radius: 50%;
                    background: rgba(255, 255, 255, .07); }
.fund-top { display: flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 600; }
.leaf-logo-light span:nth-child(1) { background: #fff; }
.leaf-logo-light span:nth-child(2) { background: #9fe0bd; }
.fund-label { margin-top: 18px; font-size: .78rem; color: rgba(255, 255, 255, .75); }
.fund-value { font-size: 1.5rem; font-weight: 750; letter-spacing: -.02em; }
.fund-value .cur { color: rgba(255, 255, 255, .75); }
.fund-foot { display: flex; justify-content: space-between; margin-top: 12px; font-size: .78rem; color: rgba(255, 255, 255, .85); position: relative; z-index: 1; }
.fund-panel { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.fund-panel-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.fund-panel-value { font-size: 1.15rem; font-weight: 750; }
.fund-dl { font-size: .85rem; }
.trend-chip { padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.trend-chip.up { background: var(--success-bg); color: var(--success); }
.trend-chip.down { background: var(--danger-bg); color: var(--danger); }
.btn-soft { background: var(--brand-soft); border-color: transparent; color: var(--brand-strong); }
.btn-soft:hover { background: color-mix(in srgb, var(--brand-soft) 80%, var(--brand)); }

.avatar-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.avatar-row .avatar { font-size: .75rem; text-decoration: none; border: 2px solid var(--surface); }
.avatar-row .avatar:hover { box-shadow: 0 0 0 2px var(--brand); }
.avatar-more { background: var(--muted-bg); color: var(--ink-2); }
.avatar-more .icon { width: 16px; height: 16px; }
.todo { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.todo li + li { border-top: 1px solid var(--line); }
.todo a { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; color: var(--ink); font-weight: 550; font-size: .9rem; }
.todo a:hover { background: var(--surface-2); text-decoration: none; }
.count-pill { min-width: 26px; text-align: center; padding: 1px 8px; border-radius: 999px; background: var(--muted-bg); color: var(--ink-2);
              font-size: .78rem; font-weight: 700; }
.count-pill.hot { background: var(--warning-bg); color: var(--warning); }
.quick-find { gap: 10px; }
.quick-find label { font-size: .85rem; font-weight: 600; }


/* ---------- Confirmation box (sign out) ---------- */
.confirm-dialog { width: min(400px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: 16px;
                  background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(0, 0, 0, .25); text-align: center; }
.confirm-dialog::backdrop { background: rgba(10, 20, 15, .45); backdrop-filter: blur(2px); }
.confirm-dialog[open] { animation: confirm-in .14s ease-out; }
@keyframes confirm-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .confirm-dialog[open] { animation: none; } }
.confirm-icon { width: 48px; height: 48px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center;
                background: var(--danger-bg); color: var(--danger); }
.confirm-dialog h2 { font-size: 1.15rem; }
.confirm-dialog p { margin: 8px 0 20px; color: var(--ink-3); font-size: .9rem; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.confirm-actions .btn { flex: 1; min-width: 140px; }


/* ---------- How to pay (BK Pay / USSD) ---------- */
.pay-dialog { width: min(440px, calc(100vw - 32px)); }
.pay-dialog .pay-icon { background: var(--success-bg, #e6f4ec); color: var(--success, #1f7a4a); }
.pay-dialog .pay-phone p { margin-bottom: 12px; }
.pay-dialog .pay-phone .btn { margin-bottom: 16px; }
.pay-dialog .pay-steps { text-align: left; margin: 0 0 4px; font-size: .9rem; }
.pay-dialog .pay-steps summary { cursor: pointer; font-weight: 600; text-align: center; color: var(--ink-3); }
.pay-dialog .pay-steps ol { margin: 8px 0 0; padding-left: 1.3em; display: grid; gap: 6px; }
.pay-dialog .pay-steps p { margin: 0 0 8px; text-align: left; }
.pay-dialog[data-device="computer"] .pay-phone { display: none; }
.pay-dialog[data-device="computer"] .pay-steps summary { display: none; }
.pay-dialog[data-device="phone"] .pay-computer { display: none; }

/* ---------- Administration: records, imports, exports ---------- */
.rec-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.rec-card { display: flex; flex-direction: column; }
.rec-card-main { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px 12px; flex: 1; }
.rec-card-main .kpi-icon { margin: 0; flex: none; }
.rec-card-main h2 { margin-bottom: 4px; }
.rec-card-main p { margin: 0; }
.rec-count { font-size: 1.4rem; font-weight: 750; color: var(--ink); }
.rec-card-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 20px 18px; }

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 230px; padding: 6px;
             background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); }
.menu-list a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 8px; color: var(--ink); font-weight: 600; }
.menu-list a:hover { background: var(--surface-2); text-decoration: none; }
.menu-note { margin: 4px 12px 6px; }

.dropzone { display: grid; justify-items: center; gap: 6px; padding: 32px 20px; text-align: center; cursor: pointer;
            border: 2px dashed var(--line-strong); border-radius: 14px; background: var(--surface-2); }
.dropzone:hover, .dropzone:focus-within { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .icon { width: 32px; height: 32px; color: var(--brand); }
.dropzone input[type=file] { max-width: 100%; font: inherit; font-size: .85rem; }
.dropzone-name { font-weight: 600; color: var(--brand-strong); }

.map-table td { vertical-align: top; }
.map-table select { min-width: 220px; }
.map-missing td { background: var(--danger-bg); }

/* ---------- Member ID cards (85.6 × 54 mm), front and back ----------
   The Rwanda Tailors Association's own card: its artwork (static/portal/card/) is the background and the
   member's details sit where they sit on the original. Every position is in --u, which is 1 mm when printed,
   so the card prints at true bank-card size and shows larger on screen. Colours stay light in dark mode. */
.idcard-pair { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.idcard { --u: 1.45mm; --rta: #1f5fa8;
  position: relative; width: calc(85.6 * var(--u)); height: calc(54 * var(--u)); overflow: hidden; flex: none;
  border-radius: calc(3.2 * var(--u)); background: #fff; color: #1e1e1e;
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.10); border: 1px solid #dbe2ec;
  font-family: Arial, Helvetica, sans-serif; line-height: 1;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; break-inside: avoid; }
.idcard > * { position: absolute; }
.idcard-art { inset: 0; width: 100%; height: 100%; display: block; }
.idcard-name { left: calc(5.2 * var(--u)); top: calc(11 * var(--u)); max-width: calc(42 * var(--u)); font-size: calc(3.9 * var(--u));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.idcard-role { left: calc(5.2 * var(--u)); top: calc(15.8 * var(--u)); font-size: calc(1.65 * var(--u)); font-weight: 700; }
.idcard-id { left: calc(5.2 * var(--u)); top: calc(18.1 * var(--u)); font-size: calc(1.6 * var(--u)); color: var(--rta); }
.idcard-line { left: calc(10.9 * var(--u)); font-size: calc(1.85 * var(--u)); color: #2b2b2b; white-space: nowrap;
  max-width: calc(19 * var(--u)); overflow: hidden; text-overflow: ellipsis; }
.idcard-phone { top: calc(24.2 * var(--u)); }
.idcard-web { top: calc(30.1 * var(--u)); background: #fff; padding-right: calc(1 * var(--u)); }
.idcard-address { top: calc(36.2 * var(--u)); }
.idcard-qr { left: calc(30.7 * var(--u)); top: calc(17.2 * var(--u)); width: calc(14.8 * var(--u)); height: calc(14.8 * var(--u));
  box-sizing: border-box; padding: calc(.35 * var(--u)); background: #fff; border: calc(.45 * var(--u)) solid #1e7fd8; }
.idcard-qr .qr { display: block; width: 100%; height: 100%; }
.idcard-qr-logo { position: absolute; left: 50%; top: 50%; width: 17%; transform: translate(-50%, -50%);
  background: #fff; border-radius: 50%; padding: 2%; }
.idcard-photo { left: calc(48.7 * var(--u)); top: calc(14.8 * var(--u)); width: calc(25.2 * var(--u)); height: calc(25.2 * var(--u));
  border-radius: 50%; overflow: hidden; background: #e8eef7; display: grid; place-items: center; }
.idcard-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.idcard-photo span { font-size: calc(8 * var(--u)); font-weight: 700; color: #1f4f99; }
.idcard-signature { left: calc(9.9 * var(--u)); top: calc(40.2 * var(--u)); width: calc(13 * var(--u)); height: calc(4.6 * var(--u));
  object-fit: contain; object-position: center bottom; }
.idcard-motto { right: calc(5.2 * var(--u)); bottom: calc(4.4 * var(--u)); color: #fff; font-weight: 700; font-size: calc(3.2 * var(--u)); }
/* Only when the association is not RTA: cover the printed logo and name with theirs */
.idcard-head-cover { left: 0; right: 0; top: 0; height: calc(10.5 * var(--u)); background: #fff; display: flex; align-items: center;
  gap: calc(3 * var(--u)); padding: 0 calc(4 * var(--u)); }
.idcard-logo { flex: none; width: calc(9.5 * var(--u)); height: calc(9.5 * var(--u)); border-radius: 50%; overflow: hidden; display: grid; place-items: center; }
.idcard-logo img { width: 100%; height: 100%; object-fit: contain; }
.idcard-logo span { width: 100%; height: 100%; display: grid; place-items: center; background: #1f4f99; color: #fff; font-weight: 800; font-size: calc(2.6 * var(--u)); }
.idcard-org { font-size: calc(3.1 * var(--u)); font-weight: 700; color: #3a3a3a; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.card-stage { display: grid; place-items: center; padding: 20px 0; overflow-x: auto; }
@media (max-width: 520px) { .card-stage .idcard { --u: 1mm; } }  /* fits a phone screen */
.photo-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.photo-form input[type=file] { width: auto; min-height: 0; padding: 6px; font-size: .85rem; }

/* Sheet of cards for printing: 2 across, 5 down on A4, with a gap to cut along */
.card-sheet { display: grid; grid-template-columns: 171.2mm; gap: 4mm; justify-content: center; padding: 10mm 0; }
.card-sheet .idcard-pair { gap: 0; flex-wrap: nowrap; break-inside: avoid; }
.card-sheet .idcard { --u: 1mm; box-shadow: none; }
.card-sheet .idcard-front { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.card-sheet .idcard-back { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: .2mm dashed #9aa6b8; }
.print-bar { position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.print-bar .grow { flex: 1; color: var(--ink-3); font-size: .9rem; }

@media print {
  @page { size: A4; margin: 8mm; }
  body { background: #fff !important; }
  .topbar, .sidebar, .messages, .no-print, .print-bar, .page-head .actions { display: none !important; }
  .layout { display: block; }
  main { padding: 0; max-width: none; }
  .card-stage { padding: 0; place-items: start; }
  .card-stage .idcard, .card-sheet .idcard { --u: 1mm; box-shadow: none; border: .2mm solid #cfd5d0; }
  .card-sheet { padding: 0; }
}

/* ---------- Selectable tables (tick rows, act on the selection) ---------- */
th.select, td.select { width: 44px; padding-right: 0; }
th.select input, td.select input { width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; }
tr.is-selected td { background: color-mix(in srgb, var(--brand-soft) 70%, transparent); }
.select-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 10px 16px;
  border-bottom: 1px solid var(--line); background: var(--surface-2); }
.select-bar .spacer { flex: 1; }
.select-count { font-size: .9rem; color: var(--ink-2); }
[data-select]:not(.has-selection) [data-select-clear] { visibility: hidden; }



/* Selection bar: only shown once rows are ticked (always shown without JavaScript). */
.js [data-select]:not(.has-selection) .select-bar { display: none; }
.select-form { margin: 0; }
.select-export { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.select-bar { animation: select-in .12s ease-out; }
@keyframes select-in { from { opacity: 0; transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .select-bar { animation: none; } }
.table-export { margin-left: auto; align-self: flex-end; }
.table-export .menu-list { right: 0; }
/* Count and rows per page live in the pager, under the table */
.pager { flex-wrap: wrap; gap: 10px 16px; }
.pager-size { display: flex; align-items: center; gap: 8px; margin: 0; }
.pager-size label { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--ink-3); }
.pager-size select { min-height: 32px; width: auto; padding: 4px 28px 4px 10px; font-size: .85rem; }
.pager .actions { align-items: center; }

/* ---------- Bank statement import ---------- */
.checklist-plain { margin: 0; padding-left: 18px; display: grid; gap: 10px; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); border-radius: 999px;
  padding: 4px 12px; font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer; }
.chip.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); }
table.statement td { vertical-align: top; }
table.statement .member-pick { min-width: 230px; min-height: 36px; padding: 6px 10px; font-size: .88rem; }
table.statement .member-pick.matched { border-color: color-mix(in srgb, var(--brand) 45%, var(--line-strong)); }
table.statement select { min-height: 36px; padding: 6px 8px; font-size: .88rem; width: auto; }
table.statement .narration { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.statement .check-cell { min-width: 220px; }
table.statement tr.state-skip td { color: var(--ink-3); }
table.statement tr.has-errors td { background: color-mix(in srgb, var(--danger-bg) 70%, transparent); }
.cell-error { color: var(--danger); font-weight: 600; font-size: .84rem; margin-top: 4px; }

/* Read-only boxes (e.g. the account name above "Change password") look fixed, not editable */
input[readonly] { background: var(--surface-2); color: var(--ink-2); cursor: default; }
input[readonly]:focus { box-shadow: none; border-color: var(--line-strong); }


/* ---------- Pay by mobile money, step by step ---------- */
.pay-progress { margin-bottom: 18px; }
.pay-step { max-width: 640px; }
.pay-q { font-size: 1.2rem; margin-bottom: 14px; }
.pay-options { display: grid; gap: 12px; }
.pay-option { display: flex; align-items: center; gap: 14px; padding: 16px 18px; color: var(--ink); }
.pay-option:hover { border-color: var(--brand); text-decoration: none; box-shadow: var(--shadow-lg); }
.pay-option .kpi-icon { margin: 0; flex: none; }
.pay-option .grow { display: grid; gap: 2px; }
.pay-option > .icon { color: var(--ink-3); }
.pay-total { font-size: 2rem; font-weight: 750; letter-spacing: -.02em; margin: 4px 0 6px; }
.pay-button { min-height: 54px; font-size: 1.05rem; }
.pay-wait { text-align: center; display: grid; justify-items: center; gap: 8px; padding: 32px 24px; }
.pay-wait h2 { font-size: 1.3rem; }
.pay-spinner { width: 56px; height: 56px; border-radius: 50%; border: 5px solid var(--brand-soft); border-top-color: var(--brand);
  animation: pay-spin 1s linear infinite; margin-bottom: 6px; }
@keyframes pay-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pay-spinner { animation-duration: 3s; } }
.sandbox-phone { text-align: left; margin-top: 14px; width: 100%; }

/* ---------- Sign-in preloader: the logo grows while the sign-in is sent ---------- */
.preloader { position: fixed; inset: 0; z-index: 1000; display: grid; place-content: center; justify-items: center;
             gap: 6px; background: color-mix(in srgb, var(--bg) 92%, transparent);
             backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: preloader-in .2s ease-out; }
.preloader[hidden] { display: none; }
.preloader-mark { position: relative; display: grid; place-items: center; width: 132px; height: 132px; margin-bottom: 14px; }
.preloader-ring { position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--line);
                  border-top-color: var(--leaf); border-right-color: var(--gold);
                  animation: preloader-spin 1.1s linear infinite; }
.preloader .leaf-logo { transform: scale(2.4); }
.preloader .leaf-logo span { scale: 0; animation: leaf-grow 2.4s cubic-bezier(.34, 1.56, .64, 1) infinite; }
.preloader .leaf-logo span:nth-child(2) { animation-delay: .18s; }
.preloader .leaf-logo span:nth-child(3) { animation-delay: .36s; }
.preloader-brand { margin: 0; font-weight: 700; font-size: 1.1rem; letter-spacing: -.02em; color: var(--forest); }
.preloader-brand .accent { color: var(--leaf); }
.preloader-text { margin: 0; font-size: .875rem; color: var(--ink-3); }
@media (prefers-color-scheme: dark) { .preloader-brand { color: var(--leaf); } .preloader-brand .accent { color: #7fd3a3; } }
@keyframes preloader-in { from { opacity: 0; } }
@keyframes preloader-spin { to { rotate: 360deg; } }
@keyframes leaf-grow {   /* each leaf sprouts, sways once, then folds away to grow again */
  0% { scale: 0; } 22% { scale: 1; } 40% { scale: 1.06; } 58% { scale: 1; } 85% { scale: 1; opacity: .92; }
  100% { scale: 0; opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .preloader-ring { animation-duration: 3s; }
  .preloader .leaf-logo span { scale: 1; animation: leaf-pulse 1.6s ease-in-out infinite; }
}
@keyframes leaf-pulse { 50% { opacity: .45; } }
