/* LUB Shakthi — chapter module.
 * Sidebar shell, warm hero band, white data cards, hand-rolled SVG charts.
 */

:root {
    --brand:        #F97316;
    --brand-light:  #FB923C;
    --brand-deep:   #EA580C;
    --brand-50:     #FFF7ED;
    --brand-100:    #FFEDD5;
    --brand-200:    #FED7AA;

    --shell:        #1A1D27;
    --shell-hover:  rgba(255,255,255,.06);
    --shell-text:   rgba(255,255,255,.62);

    --green:   #16A34A;  --green-bg:  #DCFCE7;
    --amber:   #D97706;  --amber-bg:  #FEF3C7;
    --violet:  #7C3AED;  --violet-bg: #EDE9FE;
    --blue:    #2563EB;  --blue-bg:   #DBEAFE;
    --red:     #DC2626;  --red-bg:    #FEE2E2;

    --ink:     #111827;
    --ink-2:   #4B5563;
    --ink-3:   #9CA3AF;
    --line:    #EEF0F4;
    --line-2:  #E5E7EB;
    --bg:      #F7F8FA;
    --card:    #FFFFFF;

    --r:    12px;
    --r-lg: 16px;
    --r-xl: 20px;

    --shadow:   0 1px 2px rgba(17,24,39,.04), 0 4px 16px rgba(17,24,39,.05);
    --shadow-2: 0 8px 28px rgba(17,24,39,.10);

    --sans:  "Plus Jakarta Sans", "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --tamil: "Noto Sans Tamil", var(--sans);

    --sidebar-w: 250px;
    --sidebar-w-collapsed: 76px;
    --topbar-h:  76px;
}

/* Collapsed rail. The width lives in one custom property that both the rail
 * and the content margin read, so they can never disagree.
 *
 * Deliberately NOT transitioned: animating the width while the children swap
 * between labelled rows and icons leaves the element stuck at its old width.
 * Instant is also simply faster to use. */
html.nav-collapsed { --sidebar-w: var(--sidebar-w-collapsed); }

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-deep); text-decoration: none; }

/* An author `display` beats the browser's own rule for [hidden], so anything
 * laid out as flex or grid ignores the attribute unless this says otherwise.
 * Every JS show/hide in the app sets `hidden`, so it has to hold. */
[hidden] { display: none !important; }

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-size: 20px; line-height: 1; user-select: none;
}
.material-symbols-outlined.fill { font-variation-settings: 'FILL' 1; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 200; background: var(--shell); color: #fff; padding: 10px 16px; border-radius: var(--r); }

/* ═══════════════════════════════════════════════════════ shell */

.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w); flex: none; background: var(--shell); color: #fff;
    display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 40;
    transition: transform .25s ease;
    /* The whole rail scrolls on a short screen — scrolling only the nav made
     * it shrink under the promo card and grow a scrollbar on tall ones too. */
    overflow-y: auto; overscroll-behavior: contain;
}

.side-brand {
    display: flex; align-items: center; gap: 12px; padding: 20px 20px 22px;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.side-brand .mark {
    width: 44px; height: 44px; border-radius: 12px; flex: none;
    background: linear-gradient(135deg, var(--brand-light), var(--brand));
    display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px;
    letter-spacing: .02em; box-shadow: 0 4px 12px rgba(249,115,22,.35);
}
.side-brand .txt strong { display: block; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.side-brand .txt small { display: block; font-size: 11.5px; color: var(--shell-text); }

.side-nav { padding: 16px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1 0 auto; }
.side-nav a {
    display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px;
    color: var(--shell-text); font-size: 14.5px; font-weight: 500; min-height: 46px;
    transition: background .15s, color .15s; white-space: nowrap; overflow: hidden;
}
.side-nav a .material-symbols-outlined { flex: none; }
.side-nav a:hover { background: var(--shell-hover); color: #fff; }
.side-nav a.on {
    background: linear-gradient(135deg, var(--brand-light), var(--brand));
    color: #fff; font-weight: 600; box-shadow: 0 4px 14px rgba(249,115,22,.32);
}
.side-nav .sep { height: 1px; background: rgba(255,255,255,.08); margin: 12px 14px; }

.side-promo {
    margin: 12px; border-radius: var(--r-lg); overflow: hidden; position: relative;
    background: linear-gradient(160deg, #FFB877, #FF8A3D 55%, #F97316);
    padding: 18px 16px 0; color: #4A2409; flex: none;
}
.side-promo h3 { margin: 0 0 6px; font-size: 15.5px; font-weight: 800; line-height: 1.25; letter-spacing: -.01em; }
.side-promo p { margin: 0 0 12px; font-size: 12px; line-height: 1.45; color: #6B3410; }
.side-promo .go {
    display: inline-flex; align-items: center; gap: 5px; background: rgba(255,255,255,.92);
    color: #9A3412; font-size: 12px; font-weight: 700; padding: 7px 13px; border-radius: 999px;
}
.side-promo .go:hover { background: #fff; }
.side-promo svg { display: block; width: 100%; height: auto; margin-top: 6px; }

/* ─────────────────────────────────────────────────────── collapsed rail */

html.nav-collapsed .side-brand { padding: 20px 0 22px; justify-content: center; }
html.nav-collapsed .side-brand .txt { display: none; }

html.nav-collapsed .side-nav { padding: 16px 10px; }
html.nav-collapsed .side-nav a { justify-content: center; padding: 11px 0; gap: 0; }
html.nav-collapsed .nav-label { display: none; }
html.nav-collapsed .side-nav .sep { margin: 12px 8px; }

/* The promo is a paragraph of prose and an illustration; neither survives
   being squeezed to 76px, so it stands down until the rail reopens. */
html.nav-collapsed .side-promo { display: none; }

/* Labels are gone, so each item carries a title attribute. Native tooltips
   paint outside the element, so the rail keeps its own vertical scrolling. */

/* ═══════════════════════════════════════════════════════ main */

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }

.topbar {
    height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 0 26px; position: sticky; top: 0; z-index: 30;
}
/* The bar is a fixed height, so the greeting must never wrap — a long name
 * on a narrow screen otherwise grows to three lines and pushes the buttons
 * out of the bar. */
.topbar .greet {
    font-size: 17px; font-weight: 600; letter-spacing: -.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.topbar .greet b { font-weight: 800; }

.icon-btn {
    width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line-2);
    background: #fff; color: var(--ink-2); display: grid; place-items: center;
    cursor: pointer; position: relative; flex: none; transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--bg); border-color: var(--ink-3); }
.icon-btn .dot {
    position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px;
    border-radius: 999px; background: var(--brand); color: #fff; font-size: 10.5px; font-weight: 700;
    display: grid; place-items: center; border: 2px solid #fff;
}

.topbar-right { display: flex; align-items: center; gap: 14px; flex: none; }
.btn-start { min-height: 42px; padding: 10px 16px; font-size: 13.5px; }
.userchip { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 42px; height: 42px; border-radius: 999px; flex: none; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--brand-light), var(--brand)); color: #fff;
    font-weight: 700; font-size: 14px;
}
.avatar.sm { width: 34px; height: 34px; font-size: 12px; }
.userchip .t { line-height: 1.25; }
.userchip .t strong { display: block; font-size: 14px; font-weight: 700; }
.userchip .t small { display: block; font-size: 11.5px; color: var(--ink-3); }

.btn-out {
    display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-2);
    background: #fff; color: var(--ink-2); font: inherit; font-size: 13.5px; font-weight: 600;
    padding: 10px 15px; border-radius: 12px; cursor: pointer; min-height: 42px;
}
.btn-out:hover { background: var(--bg); }

.page { padding: 22px 26px 60px; flex: 1; }

/* ═══════════════════════════════════════════════════════ hero */

.hero {
    position: relative; overflow: hidden; border-radius: var(--r-xl);
    background: linear-gradient(105deg, #FFF6EC 0%, #FFEFE0 45%, #FFE6D0 100%);
    padding: 30px 32px; margin-bottom: 20px; min-height: 168px;
    display: flex; align-items: center;
}
.hero-in { position: relative; z-index: 2; max-width: 660px; }
.hero h1 { margin: 0 0 6px; font-size: 30px; font-weight: 800; letter-spacing: -.025em; }
.hero p { margin: 0 0 18px; color: #7C5230; font-size: 14.5px; max-width: 42ch; }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-art {
    position: absolute; right: 0; bottom: 0; top: 0; width: 56%; z-index: 1;
    pointer-events: none; display: flex; align-items: flex-end; justify-content: flex-end;
}
.hero-art svg { width: 100%; height: auto; display: block; }

/* ═══════════════════════════════════════════════════════ buttons */

.btn, .btn-2 {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 11px 18px; border-radius: 12px; border: 1px solid transparent;
    font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: transform .12s, box-shadow .15s, background .15s;
}
.btn { background: linear-gradient(135deg, var(--brand-light), var(--brand)); color: #fff; box-shadow: 0 4px 14px rgba(249,115,22,.3); }
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(249,115,22,.38); }
.btn-2 { background: #fff; color: var(--ink); border-color: var(--line-2); }
.btn-2:hover { background: var(--bg); transform: translateY(-1px); }
.btn-sm { min-height: 36px; padding: 7px 14px; font-size: 13px; border-radius: 10px; }

/* A disabled control has to look disabled, or it invites a click that does
 * nothing and reads as the app being broken. */
.btn:disabled, .btn-2:disabled, button:disabled {
    opacity: .45; cursor: not-allowed; box-shadow: none;
}
.btn:disabled:hover, .btn-2:disabled:hover, button:disabled:hover {
    transform: none; box-shadow: none;
}
.btn-danger { background: #fff; color: var(--red); border: 1px solid var(--red-bg); }
.btn-danger:hover { background: var(--red-bg); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

:focus-visible { outline: 3px solid var(--brand-light); outline-offset: 2px; }

/* ═══════════════════════════════════════════════════════ cards */

.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 20px; box-shadow: var(--shadow);
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.card-title .material-symbols-outlined { font-size: 19px; color: var(--brand); }
.card-title .sub { color: var(--ink-3); font-weight: 500; font-size: 13px; }
.card-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.card-foot a { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 700; color: var(--brand-deep); }
.card-foot a:hover { gap: 9px; }
.card-foot a .material-symbols-outlined { font-size: 17px; transition: transform .15s; }

.card.tight { padding: 0; overflow: hidden; }
.card.tight > .card-head { padding: 20px 20px 0; margin-bottom: 14px; }

/* Detail pages: a wide main column with a narrower rail beside it. */
.cols { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; align-items: start; }
.cols > div > .card:first-child { margin-top: 0; }

.grid { display: grid; gap: 18px; }

/* A `1fr` track is `minmax(auto, 1fr)`, so it refuses to shrink below its
 * content's min-content width and the row bursts out of the page. Letting grid
 * children shrink is what keeps these layouts inside the viewport. */
.grid > *, .statwrap > *, .cols > * { min-width: 0; }

.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-fin { grid-template-columns: 1fr 1fr 1.35fr; }
.g-att { grid-template-columns: 1.25fr 1fr 1fr; }

/* ═══════════════════════════════════════════════════════ stat cards */

.statwrap {
    background: #fff; border: 1px solid var(--line); border-radius: var(--r-xl);
    padding: 10px; margin-bottom: 20px; box-shadow: var(--shadow);
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.stat {
    border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 16px 8px;
    background: #fff; transition: box-shadow .18s, transform .18s; position: relative; overflow: hidden;
}
.stat:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.stat-top { display: flex; align-items: flex-start; gap: 13px; }
.stat .ico { width: 46px; height: 46px; border-radius: 13px; flex: none; display: grid; place-items: center; }
.stat .ico .material-symbols-outlined { font-size: 23px; }
.stat .n { font-size: 27px; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); margin-top: 3px; }
.stat .s { font-size: 12px; color: var(--ink-3); }
.stat .go {
    margin-left: auto; width: 30px; height: 30px; border-radius: 999px; flex: none;
    display: grid; place-items: center; color: var(--brand); background: var(--brand-100);
    transition: transform .15s;
}
.stat:hover .go { transform: translateX(3px); }
.stat .spark { margin-top: 10px; }

.ico-orange { background: var(--brand-100); color: var(--brand); }
.ico-amber  { background: var(--amber-bg);  color: var(--amber); }
.ico-violet { background: var(--violet-bg); color: var(--violet); }
.ico-green  { background: var(--green-bg);  color: var(--green); }
.ico-blue   { background: var(--blue-bg);   color: var(--blue); }
.ico-red    { background: var(--red-bg);    color: var(--red); }

/* ═══════════════════════════════════════════════════════ charts */

.donut-row { display: flex; align-items: center; gap: 20px; }
.donut { position: relative; flex: none; }
.donut-mid {
    position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1;
}
.donut-mid .n { font-size: 24px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.donut-mid .l { font-size: 10.5px; color: var(--ink-3); font-weight: 600; }

.legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.legend-row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend-row .sw { width: 9px; height: 9px; border-radius: 999px; flex: none; }
.legend-row .nm { flex: 1; min-width: 0; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-row .vl { font-weight: 700; font-variant-numeric: tabular-nums; }
.legend-row .pc { color: var(--ink-3); font-size: 12px; min-width: 42px; text-align: right; }

.fin-figures { display: flex; flex-direction: column; gap: 12px; }

/* Income / expenses / balance side by side above the chart. */
.fin-figures-row { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.fin-figures-row > div {
    flex: 1 1 90px; min-width: 0; background: #FAFBFC; border: 1px solid var(--line);
    border-radius: var(--r); padding: 10px 12px;
}
.fin-figures-row .k {
    display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
    text-transform: uppercase; color: var(--ink-3); margin-bottom: 2px;
}
.fin-figures-row .v { display: block; font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fin-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.fin-row .k { font-size: 13.5px; color: var(--ink-2); }
.fin-row .v { font-weight: 800; font-variant-numeric: tabular-nums; font-size: 15px; }
.fin-row.total { border-top: 1px dashed var(--line-2); padding-top: 11px; }
.fin-row.total .v { font-size: 17px; }
.v.in { color: var(--green); }
.v.out { color: var(--red); }

.chart-legend { display: flex; gap: 16px; justify-content: flex-end; font-size: 12px; color: var(--ink-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

.bars-head { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 6px; }
.bars-head .n { font-size: 30px; font-weight: 800; letter-spacing: -.02em; line-height: 1; }
.bars-head .l { font-size: 12.5px; color: var(--ink-3); padding-bottom: 3px; }

select.mini {
    font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
    border: 1px solid var(--line-2); border-radius: 9px; padding: 6px 10px; background: #fff; cursor: pointer;
}

/* ═══════════════════════════════════════════════════════ attention list */

.att { display: flex; flex-direction: column; }
.att-row { display: flex; align-items: center; gap: 13px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.att-row:last-child { border-bottom: 0; }
.att-row .ico { width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center; }
.att-row .grow { flex: 1; min-width: 0; }
.att-row .t { font-size: 13.5px; font-weight: 700; }
.att-row .d { font-size: 12.5px; color: var(--ink-3); }

/* ═══════════════════════════════════════════════════════ tables & bits */

.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
    text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
    color: var(--ink-3); padding: 11px 14px; border-bottom: 1px solid var(--line); background: #FAFBFC;
}
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: #FCFCFD; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl a { font-weight: 600; color: var(--ink); }
.tbl a:hover { color: var(--brand-deep); }
/* A table that fills its card belongs in `.card.tight`, which has no padding
 * of its own — the outer cells provide the inset instead. Pulling padding back
 * with negative margins dragged the table outside the clip and sheared the
 * first column off, so it is not done at all. */
.tbl-scroll { overflow-x: auto; }
.card.tight .tbl th:first-child, .card.tight .tbl td:first-child { padding-left: 20px; }
.card.tight .tbl th:last-child, .card.tight .tbl td:last-child { padding-right: 20px; }

/* Key/value tables on detail pages. Two columns will not fit a phone, and
 * scrolling a label/value pair sideways is useless — so they stack instead. */
.tbl-kv th { width: 38%; }
@media (max-width: 700px) {
    .tbl-kv, .tbl-kv tbody, .tbl-kv tr, .tbl-kv th, .tbl-kv td { display: block; width: auto; }
    .tbl-kv tr { padding: 11px 0; border-bottom: 1px solid var(--line); }
    .tbl-kv tr:last-child { border-bottom: 0; }
    .tbl-kv th { padding: 0 0 3px; border: 0; background: none; }
    .tbl-kv td { padding: 0; border: 0; }
}

.who-cell { display: flex; align-items: center; gap: 10px; }
.who-cell small { display: block; color: var(--ink-3); font-size: 12px; font-weight: 400; }

.chip {
    display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700; background: #F3F4F6; color: var(--ink-2); white-space: nowrap;
}
.chip .material-symbols-outlined { font-size: 14px; }
.chip.ok { background: var(--green-bg); color: var(--green); }
.chip.warn { background: var(--amber-bg); color: var(--amber); }
.chip.bad { background: var(--red-bg); color: var(--red); }
.chip.info { background: var(--blue-bg); color: var(--blue); }
.chip.brand { background: var(--brand-100); color: var(--brand-deep); }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0 0 3px; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.page-head .sub { margin: 0; color: var(--ink-3); font-size: 13.5px; }

/* Section headings inside cards. Without this they fall back to the browser
 * default — roughly double the size, with margins that break every card. */
.card h2, .page h2 {
    font-size: 15px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 14px; line-height: 1.3;
}
.card h3, .page h3 {
    font-size: 13.5px; font-weight: 700; margin: 0 0 10px; color: var(--ink-2);
}
/* A heading immediately followed by explanatory text owns the gap itself. */
.card h2 + .sub { margin-top: -8px; margin-bottom: 14px; }

.crumbs { font-size: 12.5px; color: var(--ink-3); margin-bottom: 12px; }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--brand-deep); }

.empty { color: var(--ink-3); font-size: 13.5px; text-align: center; padding: 30px 16px; background: #FAFBFC; border-radius: var(--r); }

.flash { display: flex; align-items: flex-start; gap: 10px; padding: 13px 16px; border-radius: var(--r); margin-bottom: 18px; font-size: 13.5px; }
.flash.ok { background: var(--green-bg); color: #14532D; }
.flash.bad { background: var(--red-bg); color: #7F1D1D; }

/* forms */
.field { margin-bottom: 15px; }
.field > label { display: block; margin-bottom: 6px; }
.field .en { font-size: 12.5px; font-weight: 700; display: block; color: var(--ink); }
.field .ta { font-family: var(--tamil); font-size: 11px; font-weight: 400; color: var(--ink-3); display: block; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date],
input[type=datetime-local], input[type=password], select, textarea {
    width: 100%; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: var(--r);
    font: inherit; font-size: 14px; background: #fff; color: var(--ink); min-height: 44px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); }

/* Must come after the base input rules above — same specificity, so source
 * order decides, and a disabled field that still looks editable is a lie. */
input:disabled, select:disabled, textarea:disabled {
    background: #F3F4F6; color: var(--ink-3); cursor: not-allowed;
}
.hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.err { font-size: 12px; color: var(--red); margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }

/* Repeating rows on the minutes form. These live in CSS rather than inline
 * styles so the narrow-screen rule below can actually override them — an
 * inline grid-template-columns beats any media query. */
.row-point    { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 0 14px; }
.row-decision { display: grid; grid-template-columns: minmax(0, 1fr) 190px 160px; gap: 0 14px; }
.row-guest    { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }

@media (max-width: 820px) {
    .row-point, .row-decision, .row-guest { grid-template-columns: 1fr; }
}

/* Filter row: inputs share the width, the buttons sit on the same baseline
 * rather than dropping to a row of their own. */
.filterbar { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.filterbar .field { margin-bottom: 0; flex: 1 1 190px; min-width: 170px; }
.filterbar .actions { flex: none; }
@media (max-width: 640px) {
    .filterbar .field { flex-basis: 100%; }
    .filterbar .actions { width: 100%; }
    .filterbar .actions > * { flex: 1; }
}

.rows { display: flex; flex-direction: column; }
.row-item { display: flex; align-items: flex-start; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.row-item:last-child { border-bottom: 0; }
.row-item .grow { flex: 1; min-width: 0; }
.row-item .t { font-weight: 600; font-size: 13.5px; }
.row-item .d { font-size: 12.5px; color: var(--ink-3); }
/* Row actions sit in their own forms, so they need to be laid out as a set
 * rather than inheriting the row's flex spacing one form at a time. */
.row-acts { display: flex; align-items: center; gap: 6px; flex: none; }
.row-acts form { display: inline-flex; margin: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.tile { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow); color: inherit; transition: transform .15s, box-shadow .15s; }
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.tile .t { font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.tile .ta { font-family: var(--tamil); font-size: 11.5px; color: var(--ink-3); }
.tile .m { font-size: 12.5px; color: var(--ink-3); margin-top: 8px; }

/* A sector tile carries its own edit affordance, so the whole tile can no
 * longer be one anchor — the link covers the body and the pencil sits above. */
.tile-sector { position: relative; padding: 0; }
.tile-sector .tile-link { display: block; padding: 18px 46px 18px 18px; color: inherit; }
.tile-top { display: flex; align-items: flex-start; gap: 12px; }
.tile-ico {
    width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center;
    background: var(--brand-100); color: var(--brand);
}
.tile-ico .material-symbols-outlined { font-size: 21px; }
.tile-chips { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

.tile-edit, .tile-tag { position: absolute; top: 14px; right: 14px; }
.tile-edit {
    width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
    border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
    transition: background .15s, color .15s, border-color .15s;
}
.tile-edit:hover { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-deep); }
.tile-edit .material-symbols-outlined { font-size: 17px; }

.tile-tag {
    font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    color: var(--ink-3); background: var(--bg); border: 1px solid var(--line-2);
    border-radius: 999px; padding: 3px 8px;
}

.tile-sector.is-retired { opacity: .62; }
.tile-sector.is-retired:hover { opacity: 1; }

.money { font-variant-numeric: tabular-nums; font-weight: 700; }
.money.in { color: var(--green); }
.money.out { color: var(--red); }

/* pipeline */
.pipe-step { display: flex; gap: 14px; }
.pipe-rail { display: flex; flex-direction: column; align-items: center; flex: none; }
.pipe-dot { width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center; background: #fff; border: 2px solid var(--line-2); color: var(--ink-3); }
.pipe-step.done .pipe-dot { background: var(--green); border-color: var(--green); color: #fff; }
.pipe-step.now .pipe-dot { background: var(--brand); border-color: var(--brand); color: #fff; animation: pulse 2s ease-out infinite; }
.pipe-line { width: 2px; flex: 1; background: var(--line-2); min-height: 16px; }
.pipe-step.done .pipe-line { background: var(--green); }
.pipe-body { padding-bottom: 16px; }
.pipe-body .t { font-weight: 700; font-size: 13.5px; }
.pipe-body .d { font-size: 12px; color: var(--ink-3); }
.pipe-step:last-child .pipe-line { display: none; }

@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(249,115,22,.5); }
    70%  { box-shadow: 0 0 0 9px rgba(249,115,22,0); }
    100% { box-shadow: 0 0 0 0 rgba(249,115,22,0); }
}

/* ladder */
.ladder { display: flex; gap: 4px; margin: 10px 0 6px; }
.ladder span { flex: 1; height: 6px; border-radius: 999px; background: var(--line-2); transform-origin: left; }
.ladder span.done { background: var(--green); }
.ladder span.now { background: var(--brand); }
.ladder-labels { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--ink-3); }

/* ═══════════════════════════════════════════════════════ pagination */

.pager {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px; margin: -6px 0 20px;
}
.pager-count { font-size: 12.5px; color: var(--ink-3); }
.pager-count strong { color: var(--ink-2); font-weight: 600; }
.pager-links { display: flex; align-items: center; gap: 6px; }

.pager-btn {
    min-width: 34px; height: 34px; padding: 0 10px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-radius: 10px; background: #fff;
    font-size: 13px; font-weight: 600; color: var(--ink-2);
    text-decoration: none; transition: background .15s, border-color .15s, color .15s;
}
.pager-btn:hover { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-deep); }
.pager-btn .material-symbols-outlined { font-size: 19px; }

.pager-btn.is-on {
    background: var(--brand); border-color: var(--brand); color: #fff;
}
.pager-btn.is-off { color: var(--ink-3); background: var(--bg); cursor: default; opacity: .7; }
.pager-btn.is-off:hover { background: var(--bg); border-color: var(--line); color: var(--ink-3); }

.pager-gap { padding: 0 2px; color: var(--ink-3); font-size: 13px; }

/* ═══════════════════════════════════════════════════════ animation */

.rise { opacity: 0; transform: translateY(14px); animation: rise .5s cubic-bezier(.22,1,.36,1) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* Paths carry pathLength="1", so the dash maths is the same whatever the
 * actual geometry — no guessing at how long the line is. */
.draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.seg { transform-origin: center; animation: seg .9s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes seg { to { stroke-dashoffset: var(--to); } }

.bar { transform: scaleY(0); transform-origin: bottom; animation: bar .7s cubic-bezier(.22,1,.36,1) forwards; }
@keyframes bar { to { transform: scaleY(1); } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
    .rise { opacity: 1; transform: none; }
    .bar { transform: none; }
    .draw { stroke-dashoffset: 0; }
}

/* ═══════════════════════════════════════════════════════ responsive */

.scrim { display: none; }

@media (max-width: 1340px) {
    /* The finance card needs a chart's worth of width; below this it takes a
     * full row of its own and the two donuts share the one above. */
    .g-fin, .g-att { grid-template-columns: 1fr 1fr; }
    .g-fin > :last-child, .g-att > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 780px) {
    .fin-split { grid-template-columns: 1fr !important; }
}
@media (max-width: 1080px) {
    .statwrap { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1100px) {
    .cols { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    /* Collapsing is a wide-screen idea. The drawer always slides in at full
     * width, whatever the rail was doing on the desktop this user last used. */
    html.nav-collapsed { --sidebar-w: 250px; }
    html.nav-collapsed .side-brand { padding: 20px 20px 22px; justify-content: flex-start; }
    html.nav-collapsed .side-brand .txt { display: block; }
    html.nav-collapsed .nav-label { display: inline; }
    html.nav-collapsed .side-promo { display: block; }
    html.nav-collapsed .side-nav { padding: 16px 12px; }
    html.nav-collapsed .side-nav a { justify-content: flex-start; padding: 11px 14px; gap: 12px; }

    .sidebar { transform: translateX(-100%); }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(17,24,39,.45); z-index: 35; }
    .main { margin-left: 0; }
    .g-3, .g-2, .g-fin, .g-att { grid-template-columns: 1fr; }
    .g-fin > :last-child, .g-att > :first-child { grid-column: auto; }
    .hero-art { display: none; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    /* Keep the action, drop its label — the icon carries it on a phone. */
    .btn-start .lbl { display: none; }
    .btn-start { padding: 10px 12px; }
}
@media (max-width: 640px) {
    .page { padding: 16px 14px 48px; }
    .topbar { padding: 0 14px; }
    .topbar .greet { font-size: 15px; }
    .userchip .t { display: none; }

    /* The office header, cut down to what a phone can hold.
     *
     * It was carrying six controls across 393px — a menu button, the
     * portal switcher, a start-meeting button, a bell, an avatar and a
     * full "Sign out" — and the switcher had already collapsed to a single
     * stray letter. Two of those are reachable from inside the drawer, and
     * signing out does not need its own word on a phone. */
    .topbar-right { gap: 8px; }
    .topbar-right .switcher { display: none; }
    .btn-out {
        width: 38px; height: 38px; padding: 0; border-radius: 50%;
        display: grid; place-items: center;
    }
    .btn-out .material-symbols-outlined { font-size: 19px; }
    /* Keeps the label for a screen reader while the glyph does the work. */
    .btn-out { font-size: 0; }
    .btn-out .material-symbols-outlined { font-size: 19px; }
    .statwrap { grid-template-columns: 1fr; }
    .hero { padding: 22px; }
    .hero h1 { font-size: 24px; }
    .donut-row { flex-direction: column; align-items: stretch; }
    .donut { align-self: center; }
}

/* ═══════════════════════════════════════════════════ member area
 *
 * A separate shell from the chapter module. Office bearers work at a desk
 * with a sidebar; members are on a phone, so navigation is a tab bar pinned
 * to the thumb and the content is a single column.
 */

.member-body { background: var(--bg); }

/* The header's height, the tab bar's height, and how much of the tab bar sits
 * *below* the header as a second sticky row. The reels stage and the rails
 * beside the feed both size themselves from these, so moving the tabs up into
 * the bar on a wide screen cannot leave either one the wrong height.
 *
 * --mtabs-h is the chrome *above* the content that is not the bar itself, and
 * --mbot-h the chrome *below* it: the tab bar is pinned to the bottom of a
 * phone and folded into the header everywhere else, so exactly one of the two
 * is ever non-zero. A page that fills the window subtracts both. */
:root { --mtop-h: 62px; --mnav-h: 52px; --mtabs-h: 52px; --mbot-h: 0px; }
@media (min-width: 760px) and (max-width: 1099px) { :root { --mnav-h: 50px; --mtabs-h: 50px; --mbot-h: 0px; } }
@media (min-width: 1100px) { :root { --mtop-h: 58px; --mnav-h: 0px; --mbot-h: 0px; } }

/* --- header --- */

/* Above the tab bar, and therefore above it in paint order too. The bell and
 * account sheets hang out of this element; while it sat at 30 and the tab bar
 * at 40, every dropdown was drawn *behind* the row of tabs. */
/* The rule under the bar is an inset shadow, not a border, so the bar is
   exactly --mtop-h tall. As a border it added a pixel that nothing else knew
   about, and every page sized from the viewport — the chat, the reels —
   overflowed by one and grew a scrollbar. */
.mtop {
    background: #fff; box-shadow: inset 0 -1px 0 var(--line);
    position: sticky; top: 0; z-index: 50;
}
.mtop-in {
    max-width: 760px; margin: 0 auto; padding: 0 18px;
    display: flex; align-items: center; flex-wrap: wrap; gap: 0 12px;
}
/* The brand and the search share the slack; the tabs and your own controls
   are each sized by their contents. */
.mtop-l {
    display: flex; align-items: stretch; gap: 10px;
    flex: 1; min-width: 0; height: var(--mtop-h);
}
.mbrand, .mtop-l > .gsearch { display: flex; align-items: center; }
.mbrand { display: flex; align-items: center; gap: 11px; color: inherit; min-width: 0; }
.mbrand-mark {
    width: 38px; height: 38px; border-radius: 12px; flex: none; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--brand), var(--brand-light)); color: #fff;
}
.mbrand-mark .material-symbols-outlined { font-size: 21px; }
.mbrand-txt { min-width: 0; line-height: 1.2; }
.mbrand-txt strong {
    display: block; font-size: 15px; font-weight: 800; letter-spacing: -.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mbrand-txt small {
    display: block; font-size: 11.5px; color: var(--ink-3);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* The controls are stretched to the full height of the bar rather than
   centred inside it. They each hang a sheet off their own bottom edge, and
   while they were only as tall as their icon those sheets opened ten pixels
   up inside the bar and painted over it. */
.mtop-right {
    display: flex; align-items: stretch; gap: 6px;
    flex: none; margin-left: auto; height: var(--mtop-h);
}
.mtop-right > .bell, .mtop-right > .me { display: flex; align-items: center; }
.mtop-right form { margin: 0; }

/* --- tab bar --- */

/* A second row of the header, not a bar floating over the content.
 *
 * It used to be `position: fixed` at the bottom of the screen, under the
 * thumb — the right place for a tab bar, and the wrong thing here. A fixed
 * element is out of flow, so it took its width from the viewport rather
 * than from the page, and every screen that sized itself from the window
 * had to subtract a height it could not see. It now sits in the header,
 * where it is simply part of the page.
 */
.mnav {
    position: static; z-index: 40;
    order: 3; box-sizing: border-box;
    /* Bleeds past the bar's own side padding so the row of tabs reaches
       the edges of the screen rather than floating inside a gutter. */
    width: calc(100% + 36px); margin: 0 -18px;
    background: #fff;
    box-shadow: inset 0 1px 0 var(--line);
}
.mnav-in { max-width: 760px; margin: 0 auto; display: flex; }
.mnav-item {
    flex: 1; min-width: 0; position: relative; height: var(--mnav-h);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    padding: 5px 2px; color: var(--ink-3); font-size: 9.5px; font-weight: 600;
    border-bottom: 2px solid transparent; transition: color .15s, border-color .15s;
}
.mnav-item .material-symbols-outlined { font-size: 21px; }
.mnav-item .ta { display: none; }
/* Seven of these on a 393px phone: the labels have to be allowed to give
   way rather than forcing the row wider than the screen. */
.mnav-label { max-width: 100%; min-width: 0; }
.mnav-label .en {
    display: block; max-width: 100%;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mnav-item:hover { color: var(--ink-2); }
.mnav-item.is-on { color: var(--brand-deep); border-bottom-color: var(--brand); }
.mnav-item.is-on .material-symbols-outlined { font-variation-settings: 'FILL' 1; }

.mnav-dot {
    position: absolute; top: 5px; left: 50%; margin-left: 5px;
    min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
    background: var(--brand); color: #fff; font-size: 10px; font-weight: 700;
    display: grid; place-items: center; border: 2px solid #fff;
}

/* --- content --- */

.mwrap { max-width: 760px; margin: 0 auto; padding: 20px 18px 96px; }

/* --- tablet: the tabs become a second row of the header ---
 *
 * They used to be their own sticky strip pinned under the bar, which worked
 * until a dropdown opened: two sticky elements, two stacking contexts, and
 * the menu went behind the tabs. One sticky header with two rows inside it
 * has no such seam. The tab bar is a flex item here, ordered last, so it
 * wraps onto its own line. */
@media (min-width: 760px) and (max-width: 1099px) {
    .mtop-in { max-width: 1100px; padding: 0 16px; }

    /* Static on every width now — see the base rule. Only the sizing and
       the bleed to the bar's edges differ here. */
    .mnav {
        box-sizing: border-box;
        width: calc(100% + 32px); margin: 0 -16px; padding: 0 16px;
        background: 0;
    }
    .mnav-in { max-width: none; }
    .mnav-item {
        flex-direction: row; gap: 8px; height: var(--mnav-h); padding: 0 10px;
        font-size: 13px; border-top: 0; border-bottom: 2px solid transparent;
    }
    .mnav-item.is-on { border-bottom-color: var(--brand); }
    .mnav-dot { position: static; margin-left: 2px; border: 0; }
    .mwrap { padding-bottom: 48px; }
}

/* --- desktop: the tabs move up into the bar ---
 *
 * Three zones across the bar — who we are and what you are looking for on
 * the left, the sections in the middle, your own things on the right — and
 * the bar is now as wide as the three columns beneath it instead of a 760px
 * strip floating over them.
 *
 * This is the ordinary arrangement for an application of this shape, and a
 * layout is not anybody's property. Nothing here is borrowed artwork: the
 * mark, the wordmark, the saffron and the icon set are LUB's own. */
@media (min-width: 1100px) {
    .mtop-in {
        display: grid; align-items: center; gap: 16px;
        /* The search gets the room, and the brand gives it up.
         *
         * The left column was sharing 250px between a wordmark and a search
         * box, so the box was narrower than its own placeholder — "Search
         * members, produ…" reads as a field that does not work. The mark and
         * the wordmark are a known, fixed width; the box takes what is left,
         * and the column asks for enough that there is some left to take. */
        grid-template-columns: minmax(380px, 1.25fr) auto minmax(220px, 1fr);
        max-width: 1420px; padding: 0 20px; height: var(--mtop-h);
    }
    .mtop-l { height: auto; gap: 14px; }
    .mbrand { flex: none; max-width: none; }
    .mtop-right { justify-content: flex-end; gap: 4px; }
    /* The chapter name is on the card in the left rail; here it only crowds
       the search box. */
    .mbrand-txt small { display: none; }

    .mnav {
        position: static; width: auto; z-index: auto;
        background: 0; border: 0; padding: 0;
        /* `order: 3` is set on the base rule so the tab bar wraps onto its
           own second row while `.mtop-in` is a wrapping flex container. Here
           it is a grid, and `order` still applies to grid items — it was
           placing the tabs in the *last* column and pushing your own controls
           into the middle. Reset, so the three columns follow the document:
           brand and search, tabs, your controls. */
        order: 0;
        margin: 0;
    }
    .mnav-in { max-width: none; gap: 2px; justify-content: center; }
    .mnav-item {
        flex: none; width: 64px; height: 44px; border-radius: 10px;
        padding: 0; gap: 0; border: 0;
        transition: background .15s, color .15s;
    }
    .mnav-item .material-symbols-outlined { font-size: 25px; }
    .mnav-label { display: none; }
    .mnav-item:hover { background: var(--bg); color: var(--ink-2); }
    .mnav-item.is-on { color: var(--brand); }
    /* The marker sits on the bar's bottom edge rather than the button's.
       That is what makes it read as "you are in this section" instead of as
       a selected button. */
    .mnav-item.is-on::after {
        content: ''; position: absolute; left: 10px; right: 10px;
        bottom: calc((var(--mtop-h) - 44px) / -2);
        height: 3px; border-radius: 3px 3px 0 0; background: var(--brand);
    }
    .mnav-dot { top: 2px; left: auto; right: 11px; margin-left: 0; }
    .mwrap { padding-bottom: 48px; }
}

/* ── the membership number ───────────────────────────────────────────────
 *
 * Tabular, boxed and quotable, because it is the one string a member reads
 * out over the phone to the chapter office — and the thing that says this
 * is a member of the association rather than a listing in a directory.
 * Shared: it appears on the profile, in both directory views, on the
 * membership card and on the page where an account is first claimed.
 */
.memno {
    display: inline-block; flex: none;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
    background: #fff; border: 1px solid var(--brand-200); color: var(--brand-deep);
    border-radius: 6px; padding: 3px 7px; white-space: nowrap;
}

/* On a profile it sits under the name, with how long it runs beside it. */
.person-memno {
    display: flex; align-items: center; justify-content: center; gap: 9px;
    margin: 10px 0 0; flex-wrap: wrap;
}
.person-memno .memno { font-size: 13px; padding: 5px 11px; }
.memno-till { font-size: 11.5px; color: var(--ink-3); }
.memno-till.is-lapsed { color: var(--red); font-weight: 600; }