/* Funeral Welfare — UI
   Dusk indigo for structure, candle amber for the one thing that needs attention. */
:root {
  --canvas: #eef0f5;
  --surface: #ffffff;
  --surface-2: #f6f7fa;
  --ink: #1b1d2a;
  --ink-2: #4a4e63;
  --muted: #7a7f94;
  --line: #e3e6ee;
  --line-strong: #cfd3df;

  --dusk: #2e2552;
  --dusk-2: #3d3270;
  --dusk-soft: #ece9f6;
  --candle: #e0a43a;
  --candle-soft: #fbf0db;
  --candle-ink: #8a5a0b;

  --ok: #2f8a68;   --ok-bg: #e3f3ec;
  --bad: #c0473e;  --bad-bg: #fbe9e7;
  --warn: #9b6a10; --warn-bg: #fbf0db;
  --info: #3d5a9e; --info-bg: #e8eef9;

  --r-lg: 20px;
  --r: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(27, 29, 42, .04), 0 4px 16px -6px rgba(27, 29, 42, .08);
  --shadow-lift: 0 12px 32px -12px rgba(46, 37, 82, .45);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-w: 252px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 500 15px/1.55 var(--font);
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
}
a { color: var(--dusk-2); text-decoration: none; font-weight: 600; }
a:hover { color: var(--dusk); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0 0 .5rem; letter-spacing: -.02em; color: var(--ink); }
h1 { font-size: 1.65rem; font-weight: 800; line-height: 1.2; }
h2 { font-size: 1.05rem; font-weight: 750; line-height: 1.3; }
h3 { font-size: .98rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; font-weight: 650; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid rgba(224, 164, 58, .55); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ================= Admin shell ================= */
.shell { display: grid; grid-template-columns: var(--nav-w) 1fr; min-height: 100vh; }
#nav-toggle { position: absolute; opacity: 0; pointer-events: none; }

.sidebar {
  background: var(--dusk);
  color: #fff;
  padding: 1.25rem .85rem;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar .brand { display: flex; align-items: center; gap: .7rem; padding: .25rem .55rem 1.4rem; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: var(--candle); color: var(--dusk);
  display: grid; place-items: center; font-weight: 800; font-size: 1.05rem;
}
.sidebar .brand strong { display: block; font-size: .95rem; line-height: 1.25; font-weight: 750; }
.sidebar .brand small { display: block; opacity: .6; font-size: .78rem; font-weight: 500; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a, .sidebar nav button {
  all: unset; box-sizing: border-box; cursor: pointer;
  display: flex; align-items: center; gap: .75rem;
  padding: .62rem .75rem; border-radius: var(--r-sm);
  color: rgba(255, 255, 255, .72); font-size: .92rem; font-weight: 600;
}
.sidebar nav a:hover, .sidebar nav button:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: #fff; color: var(--dusk); }
.sidebar nav a.active .icon { stroke: var(--candle-ink); }
.sidebar .group { margin: 1.1rem .75rem .35rem; font-size: .76rem; color: rgba(255, 255, 255, .45); font-weight: 600; }
.sidebar .bottom { margin-top: auto; padding-top: 1rem; border-top: 1px solid rgba(255, 255, 255, .1); }
.sidebar form { margin: 0; }

.main-wrap { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .75rem;
  padding: .8rem 2rem;
  background: rgba(238, 240, 245, .85);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar .burger { display: none; }
.top-search { flex: 1; max-width: 420px; position: relative; }
.top-search .icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.top-search input { padding-left: 2.4rem !important; background: var(--surface) !important; border-color: transparent !important; box-shadow: var(--shadow); }
.topbar .spacer { flex: 1; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--dusk-soft); color: var(--dusk); font-weight: 800; font-size: .85rem;
}
.who { display: flex; align-items: center; gap: .6rem; }
.who .meta { line-height: 1.2; }
.who .meta strong { display: block; font-size: .88rem; }
.who .meta span { font-size: .78rem; color: var(--muted); }

.main { padding: 1.75rem 2rem 3.5rem; max-width: 1280px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.page-head p { margin: .2rem 0 0; color: var(--muted); }
.scrim { display: none; }

/* ================= Member portal shell ================= */
.portal-head { background: var(--dusk); color: #fff; }
.portal-head .inner { max-width: 1040px; margin: 0 auto; padding: .9rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.portal-head .brand { display: flex; align-items: center; gap: .65rem; font-weight: 750; }
.portal-head .brand-mark { width: 32px; height: 32px; border-radius: 10px; font-size: .9rem; }
.portal-tabs { display: flex; gap: .25rem; }
.portal-tabs a {
  display: flex; align-items: center; gap: .45rem; padding: .5rem .85rem; border-radius: 99px;
  color: rgba(255, 255, 255, .72); font-size: .9rem;
}
.portal-tabs a:hover { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; }
.portal-tabs a.active { background: #fff; color: var(--dusk); }
.linkbtn { all: unset; cursor: pointer; display: inline-flex; white-space: nowrap; align-items: center; gap: .4rem; color: rgba(255, 255, 255, .8); font-size: .88rem; font-weight: 600; padding: .45rem .6rem; border-radius: 99px; }
.linkbtn:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.portal-main { max-width: 1040px; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; }
.bottom-tabs { display: none; }

/* Membership card — the portal's signature element */
.member-card {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--dusk) 0%, var(--dusk-2) 100%);
  color: #fff; border-radius: var(--r-lg); padding: 1.6rem 1.75rem;
  box-shadow: var(--shadow-lift); margin-bottom: 1.5rem;
  display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.5rem;
}
.member-card::after {
  content: ""; position: absolute; right: -60px; top: -80px; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(224, 164, 58, .28), transparent 70%);
  pointer-events: none;
}
.member-card .org { font-size: .85rem; opacity: .7; margin-bottom: 1.1rem; display: flex; align-items: center; gap: .6rem; }
.member-card .name { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.member-card .no { font-size: 1.05rem; letter-spacing: .12em; opacity: .85; margin-top: .35rem; font-weight: 600; }
.member-card .cover { margin-top: 1.25rem; font-size: .9rem; opacity: .9; }
.candles { display: flex; gap: .45rem; margin: .5rem 0 .3rem; }
.candles span { width: 30px; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .18); }
.candles span.lit { background: var(--candle); box-shadow: 0 0 12px rgba(224, 164, 58, .6); }
.member-card .due {
  position: relative; z-index: 1;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
  border-radius: var(--r); padding: 1.15rem 1.25rem; align-self: end;
}
.member-card .due .lbl { font-size: .85rem; opacity: .75; }
.member-card .due .amt { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; margin: .1rem 0 .2rem; }
.member-card .due .sub { font-size: .82rem; opacity: .7; margin-bottom: .9rem; }
.member-card .pill { background: rgba(255, 255, 255, .14); color: #fff; }

/* ================= Auth ================= */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side {
  background: linear-gradient(160deg, var(--dusk) 0%, var(--dusk-2) 100%);
  color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.auth-side::after {
  content: ""; position: absolute; left: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%;
  background: radial-gradient(circle, rgba(224, 164, 58, .25), transparent 70%);
}
.auth-side .brand { display: flex; align-items: center; gap: .75rem; font-weight: 750; font-size: 1.05rem; }
.auth-side h2 { color: #fff; font-size: 2rem; font-weight: 800; line-height: 1.15; max-width: 15ch; margin-bottom: .75rem; }
.auth-side p { opacity: .75; max-width: 40ch; font-size: 1rem; }
.auth-main { display: grid; place-items: center; padding: 2rem 1.25rem; background: var(--surface); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { margin-bottom: .3rem; }
.auth-card .lead { color: var(--muted); margin-bottom: 1.75rem; }
.auth-card .links { display: flex; justify-content: space-between; margin-top: 1.25rem; font-size: .9rem; }

/* ================= Cards & stats ================= */
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 1.35rem 1.4rem; margin-bottom: 1.4rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 1.4rem; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.stat { background: var(--surface); border-radius: var(--r); padding: 1.1rem 1.2rem; box-shadow: var(--shadow); position: relative; }
a.stat:hover { text-decoration: none; box-shadow: 0 0 0 2px var(--dusk-soft), var(--shadow); }
.stat .label { color: var(--muted); font-size: .85rem; font-weight: 600; }
.stat .value { font-size: 1.5rem; font-weight: 800; margin-top: .15rem; letter-spacing: -.02em; color: var(--ink); }
.stat .sub { font-size: .82rem; color: var(--muted); margin-top: .1rem; }
.stat.hl { background: var(--dusk); }
.stat.hl .label, .stat.hl .sub { color: rgba(255, 255, 255, .7); }
.stat.hl .value { color: #fff; }
.stat.hl a { color: var(--candle); }
.stat .dot { position: absolute; top: 1.15rem; right: 1.15rem; width: 9px; height: 9px; border-radius: 50%; }

/* Collection ring (admin dashboard hero) */
.ring-card { display: grid; grid-template-columns: auto 1fr; gap: 1.75rem; align-items: center; }
.ring {
  --p: 0;
  width: 150px; height: 150px; border-radius: 50%;
  background: conic-gradient(var(--candle) calc(var(--p) * 1%), rgba(255, 255, 255, .12) 0);
  display: grid; place-items: center;
}
.ring-inner { width: 118px; height: 118px; border-radius: 50%; background: var(--dusk); display: grid; place-items: center; text-align: center; line-height: 1.1; }
.ring-inner strong { font-size: 1.9rem; font-weight: 800; color: #fff; }
.ring-inner span { font-size: .78rem; color: rgba(255, 255, 255, .65); }
.hero {
  background: linear-gradient(135deg, var(--dusk) 0%, var(--dusk-2) 100%); color: #fff;
  border-radius: var(--r-lg); padding: 1.6rem 1.75rem; box-shadow: var(--shadow-lift); margin-bottom: 1.4rem;
}
.hero h2 { color: #fff; font-size: 1.15rem; }
.hero .figures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.hero .figures div span { display: block; font-size: .82rem; color: rgba(255, 255, 255, .65); }
.hero .figures div strong { font-size: 1.25rem; font-weight: 800; letter-spacing: -.01em; }

dl.kv { display: grid; grid-template-columns: 150px 1fr; gap: .55rem 1rem; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .88rem; font-weight: 600; }
dl.kv dd { margin: 0; font-weight: 600; }

.steps { display: flex; gap: .4rem; margin: .6rem 0; }
.steps span { flex: 1; height: 8px; border-radius: 99px; background: var(--line); }
.steps span.done { background: var(--candle); }

/* ================= Tables ================= */
.table-wrap { overflow-x: auto; margin: 0 -1.4rem; padding: 0 1.4rem; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
th, td { text-align: left; padding: .75rem .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; color: var(--muted); font-weight: 700; background: var(--surface-2); border-bottom: 0; }
th:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
th:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfd; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.num { font-weight: 650; }
.empty { text-align: center; color: var(--muted); padding: 2.25rem 1rem; }

/* ================= Badges ================= */
.badge, .pill {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .22rem .65rem; border-radius: 99px; font-size: .78rem; font-weight: 700; white-space: nowrap;
  background: var(--surface-2); color: var(--muted);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-active, .badge-paid, .badge-success, .badge-sent { background: var(--ok-bg); color: var(--ok); }
.badge-grace, .badge-partial, .badge-pending, .badge-logged { background: var(--candle-soft); color: var(--candle-ink); }
.badge-lapsed, .badge-unpaid, .badge-failed, .badge-suspended { background: var(--bad-bg); color: var(--bad); }
.badge-deceased, .badge-waived, .badge-removed { background: var(--surface-2); color: var(--muted); }
.member-card .badge { background: rgba(255, 255, 255, .14); color: #fff; }
.member-card .badge-active::before { background: #7be0b5; }
.member-card .badge-grace::before { background: var(--candle); }
.member-card .badge-lapsed::before { background: #ff8f86; }

/* ================= Alerts ================= */
.alert { display: flex; gap: .65rem; align-items: flex-start; padding: .85rem 1rem; border-radius: var(--r-sm); margin-bottom: 1.1rem; font-size: .93rem; font-weight: 600; }
.alert-success { background: var(--ok-bg); color: #1d5c44; }
.alert-error { background: var(--bad-bg); color: #8f2f28; }
.alert-info { background: var(--info-bg); color: #2c4479; }
.alert-warn { background: var(--candle-soft); color: var(--candle-ink); }

/* ================= Forms ================= */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem 1.25rem; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.form-grid .field { margin-bottom: 0; }
label { font-size: .86rem; font-weight: 700; color: var(--ink-2); }
.hint { font-size: .8rem; color: var(--muted); font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], input[type=month], select, textarea {
  font: 500 .95rem var(--font); width: 100%; padding: .68rem .85rem;
  border: 1.5px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
select { appearance: none; padding-right: 2.2rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237a7f94' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; }
textarea { min-height: 90px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--dusk-2); background: var(--surface); box-shadow: 0 0 0 4px var(--dusk-soft); }
.field.has-error input, .field.has-error select { border-color: var(--bad); background: #fff; }
.field .error { color: var(--bad); font-size: .8rem; font-weight: 600; }
.check { display: flex; align-items: center; gap: .55rem; font-weight: 600; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--dusk); }
.inline-form { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; margin: 0; }
.inline-form .field { margin: 0; flex: 1 1 160px; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; min-width: 150px; background-color: var(--surface-2); }

/* ================= Buttons ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .66rem 1.1rem; border-radius: var(--r-sm); border: 1.5px solid transparent;
  font: 700 .9rem var(--font); cursor: pointer; white-space: nowrap;
  background: var(--dusk); color: #fff; text-decoration: none;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--dusk-2); color: #fff; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-light { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-light:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line-strong); }
.btn-gold, .member-card .btn { background: var(--candle); color: var(--dusk); }
.btn-gold:hover, .member-card .btn:hover { background: #ebb352; color: var(--dusk); }
.btn-danger { background: var(--bad); }
.btn-sm { padding: .38rem .7rem; font-size: .8rem; }
.btn-block { width: 100%; }
.actions { display: flex; gap: .55rem; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }

.pagination { display: flex; gap: .3rem; justify-content: flex-end; margin-top: 1.1rem; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 36px; text-align: center; padding: .4rem .7rem; border-radius: var(--r-sm); font-size: .85rem; background: var(--surface-2); color: var(--ink-2); }
.pagination a:hover { background: var(--dusk-soft); text-decoration: none; }
.pagination span.current { background: var(--dusk); color: #fff; }

/* ================= Bars (collections trend) ================= */
.bars { display: flex; align-items: flex-end; gap: .9rem; height: 170px; padding-top: 1rem; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: .4rem; }
.bars .bar span.fill { width: 100%; max-width: 44px; background: var(--dusk-soft); border-radius: 8px; min-height: 4px; }
.bars .bar.current span.fill { background: var(--candle); }
.bars .bar .lbl { font-size: .78rem; color: var(--muted); font-weight: 600; }
.bars .bar .amt { font-size: .76rem; color: var(--ink-2); font-weight: 700; }

.pay-box { text-align: center; padding: 1.5rem 1rem; border-radius: var(--r); background: var(--candle-soft); }
.pay-box .till { font-size: 2.2rem; font-weight: 800; letter-spacing: .1em; color: var(--dusk); margin: .25rem 0; }
.pay-box .muted { color: var(--candle-ink); opacity: .85; }

.error-page { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 2rem; }
.error-page .code { font-size: 4.5rem; font-weight: 800; color: var(--dusk); letter-spacing: -.04em; }

/* Segmented switch (reset by email / SMS) */
.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; margin-bottom: 1.1rem; }
.seg a { flex: 1; display: flex; align-items: center; justify-content: center; gap: .45rem; padding: .55rem; border-radius: 9px; color: var(--muted); font-size: .9rem; }
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg a.active { background: var(--surface); color: var(--dusk); box-shadow: var(--shadow); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ================= Responsive ================= */
@media (max-width: 1020px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0; width: 280px; height: 100vh;
    transform: translateX(-100%); transition: transform .22s ease;
  }
  #nav-toggle:checked ~ .sidebar { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .35); }
  #nav-toggle:checked ~ .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(27, 29, 42, .45); }
  .topbar { padding: .7rem 1rem; }
  .topbar .burger { display: inline-flex; }
  .who .meta { display: none; }
  .main { padding: 1.25rem 1rem 3rem; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .member-card { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 1.5rem 1.25rem 2rem; }
  .auth-side h2 { font-size: 1.45rem; margin-top: 1.5rem; }
  .auth-side .foot { display: none; }
}
@media (max-width: 700px) {
  body.portal { padding-bottom: 76px; }
  .portal-tabs, .portal-head .logout-label { display: none; }
  .bottom-tabs {
    display: flex; position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); padding: .4rem .25rem calc(.4rem + env(safe-area-inset-bottom));
  }
  .bottom-tabs a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: .2rem;
    padding: .35rem 0; font-size: .72rem; color: var(--muted); border-radius: var(--r-sm);
  }
  .bottom-tabs a:hover { text-decoration: none; }
  .bottom-tabs a .icon { width: 22px; height: 22px; }
  .bottom-tabs a.active { color: var(--dusk); }
  .bottom-tabs a.active .icon { stroke: var(--dusk); background: var(--candle-soft); border-radius: 8px; padding: 2px; width: 30px; }
  .portal-main { padding: 1.1rem 1rem 2rem; }
  .member-card { padding: 1.35rem 1.25rem; }
  .member-card .name { font-size: 1.35rem; }
  .form-grid { grid-template-columns: 1fr; }
  dl.kv { grid-template-columns: 1fr; gap: .1rem; }
  dl.kv dd { margin-bottom: .55rem; }
  .filters input, .filters select { min-width: 0; flex: 1 1 140px; }
  .top-search { display: none; }
  .hide-sm { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .stat .value { font-size: 1.2rem; }
  .ring-card { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .hero .figures { grid-template-columns: 1fr 1fr 1fr; text-align: left; }
  .hero .figures div strong { font-size: 1rem; }
  .card { padding: 1.15rem 1.1rem; }
  .table-wrap { margin: 0 -1.1rem; padding: 0 1.1rem; }
  h1 { font-size: 1.4rem; }
}

/* ================= Profile photos ================= */
img.avatar { object-fit: cover; display: block; }
.avatar-xs { width: 30px; height: 30px; font-size: .72rem; }
.avatar-sm { width: 34px; height: 34px; font-size: .78rem; border: 2px solid rgba(255, 255, 255, .5); }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; border: 3px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .14); color: #fff; }
.avatar-xl { width: 96px; height: 96px; font-size: 1.9rem; }
.avatar-xs, .avatar-sm, .avatar-lg, .avatar-xl { border-radius: 50%; display: grid; place-items: center; font-weight: 800; flex: none; }
div.avatar-xs, div.avatar-xl { background: var(--dusk-soft); color: var(--dusk); }
div.avatar-sm { background: var(--candle); color: var(--dusk); }
a.who { color: inherit; text-decoration: none; padding: .2rem .4rem .2rem .2rem; border-radius: 99px; }
a.who:hover { background: var(--surface); text-decoration: none; }
.name-cell { display: inline-flex; align-items: center; gap: .6rem; }
.card-id { display: flex; align-items: center; gap: 1rem; }
.head-right { display: flex; align-items: center; gap: .4rem; }
.photo-edit { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; margin-bottom: .5rem; }
.photo-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.photo-actions form { margin: 0; }
.photo-actions .hint { flex-basis: 100%; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.file-btn:focus-within { outline: 3px solid rgba(224, 164, 58, .55); outline-offset: 2px; }

/* ================= Floating contact buttons ================= */
.fab-stack { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 35; display: flex; flex-direction: column; align-items: flex-end; gap: .7rem; }
.fab {
  display: inline-flex; align-items: center; gap: .55rem;
  height: 56px; min-width: 56px; padding: 0 1.1rem 0 1rem; border-radius: 99px;
  color: #fff; font-weight: 750; font-size: .92rem; text-decoration: none;
  box-shadow: 0 10px 24px -8px rgba(27, 29, 42, .45);
  transition: transform .15s, box-shadow .15s;
}
.fab:hover { transform: translateY(-2px); color: #fff; text-decoration: none; box-shadow: 0 14px 28px -8px rgba(27, 29, 42, .5); }
.fab svg { width: 24px; height: 24px; flex: none; }
.fab-call { background: var(--dusk); }
.fab-call svg { color: var(--candle); }
.fab-wa { background: #25d366; width: 48px; height: 48px; min-width: 48px; padding: 0; justify-content: center; }
.fab-call::before {
  content: ""; position: absolute; width: 56px; height: 56px; border-radius: 50%; left: 0;
  box-shadow: 0 0 0 0 rgba(224, 164, 58, .55); animation: fab-ring 2.4s ease-out 1s 3;
}
.fab-call { position: relative; }
@keyframes fab-ring { 0% { box-shadow: 0 0 0 0 rgba(224, 164, 58, .55); } 100% { box-shadow: 0 0 0 18px rgba(224, 164, 58, 0); } }
@media (max-width: 700px) {
  body.portal .fab-stack { bottom: calc(86px + env(safe-area-inset-bottom)); right: 1rem; }
  .fab-label { display: none; }
  .fab-call { padding: 0; justify-content: center; width: 56px; }
  .card-id .avatar-lg { width: 54px; height: 54px; }
}
[hidden] { display: none !important; }

/* ================= Login slideshow ================= */
.auth-side { padding: 0; }
.auth-side::after { display: none; }
.slides { position: absolute; inset: 0; }
.slide {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  opacity: 0; transition: opacity 1.4s ease;
}
.slide.is-on { opacity: 1; }
.slides::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(20, 15, 40, .88) 0%, rgba(20, 15, 40, .35) 45%, rgba(20, 15, 40, .15) 70%, rgba(20, 15, 40, .5) 100%);
}
.auth-side-inner {
  position: relative; z-index: 1; height: 100%;
  display: flex; flex-direction: column; justify-content: space-between; gap: 2rem;
  padding: 3rem;
}
.captions { display: grid; margin-top: auto; }
.slide-caption { grid-area: 1 / 1; align-self: end; opacity: 0; transform: translateY(8px); transition: opacity .9s ease, transform .9s ease; }
.slide-caption.is-on { opacity: 1; transform: none; }
.slide-caption h2 { color: #fff; font-size: 2.1rem; font-weight: 800; line-height: 1.15; max-width: 16ch; margin-bottom: .6rem; text-shadow: 0 2px 18px rgba(0, 0, 0, .35); }
.slide-caption p { color: rgba(255, 255, 255, .85); max-width: 38ch; font-size: 1.05rem; margin: 0; }
.side-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.side-foot .foot { opacity: .6; }
.slide-dots { display: flex; gap: .45rem; }
.slide-dots button {
  all: unset; cursor: pointer; width: 26px; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .3);
  transition: background .3s, width .3s;
}
.slide-dots button.is-on { width: 42px; background: var(--candle); }
.slide-dots button:focus-visible { outline: 2px solid var(--candle); outline-offset: 3px; }

/* admin: slide management */
.slide-thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; }
.slide-thumbs figure { margin: 0; }
.slide-thumbs img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--r-sm); display: block; }
.slide-thumbs figcaption { font-size: .75rem; color: var(--muted); margin-top: .3rem; line-height: 1.3; }
.slide-row { display: flex; gap: 1rem; align-items: center; padding: .9rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.slide-row:last-child { border-bottom: 0; }
.slide-row > img { width: 90px; height: 120px; object-fit: cover; border-radius: var(--r-sm); flex: none; }
.slide-fields { flex: 1; display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; margin: 0; }
.slide-fields .field { margin: 0; flex: 1 1 180px; }

@media (max-width: 1020px) {
  .auth-side { min-height: 300px; padding: 0; }
  .auth-side-inner { padding: 1.25rem 1.25rem 1.4rem; gap: 1rem; }
  .slide-caption h2 { font-size: 1.4rem; margin-top: 0; }
  .slide-caption p { font-size: .92rem; }
  .side-foot .foot { display: none; }
}
@media (max-width: 700px) {
  .slide-thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
