/* The Forge — one design system for the member app and the public site.
   Warm, built, trade-appropriate. Nothing here is decorative for its own sake. */

/* Palette taken from the official My Local Pros shield:
   #509640 (upper shield) and #7CC242 (lower shield), sampled from the logo file.
   --brand-* are the real names. The --ember-* aliases below are the original
   token names, kept so existing .ember class rules keep working; they now carry
   MLP green, not orange. */
:root {
    --ink: #14170f;
    --charcoal: #1e2418;
    --slate: #3f473a;
    --muted: #6f7a68;
    --line: #dde2d8;
    --paper: #f8faf6;
    --card: #ffffff;

    --brand: #509640;
    --brand-dark: #3a7030;
    --brand-light: #7cc242;
    --brand-soft: #eef7e8;

    --ember: var(--brand);
    --ember-dark: var(--brand-dark);
    --ember-soft: var(--brand-soft);
    --anvil: #37424c;
    --gold: #b8862b;
    /* Good is a deeper green than the brand so "in good standing" never reads
       as just "branded". Warn and bad stay amber/red — they must not be green. */
    --good: #2f7d51;
    --good-soft: #eaf5ee;
    --warn: #b0761c;
    --warn-soft: #fdf3e2;
    --bad: #ad3a26;
    --bad-soft: #fbecea;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(23, 19, 15, .06), 0 8px 24px -12px rgba(23, 19, 15, .18);
    --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
    color: var(--ink);
    background: var(--paper);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.02em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; }
a { color: var(--ember-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
small { font-size: .82rem; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 1.25rem; }
.wrap-narrow { max-width: 760px; margin: 0 auto; padding: 0 1.25rem; }

/* ------------------------------------------------------------- navigation */

.topbar {
    background: var(--ink);
    color: #f4efe9;
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 3px solid var(--ember);
}
.topbar .wrap { display: flex; align-items: center; gap: 1.5rem; height: 58px; }
.brand {
    font-weight: 800;
    letter-spacing: -.03em;
    font-size: 1.15rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.brand:hover { text-decoration: none; }
.brand .spark { color: var(--ember); }
.brand small { display: block; font-weight: 600; font-size: .69rem; letter-spacing: .1em;
    text-transform: uppercase; color: #b3bfa9; margin-top: -3px; }
.navlinks { display: flex; gap: .25rem; margin-left: auto; align-items: center; flex-wrap: wrap; }
.navlinks a {
    color: #cdc4ba;
    padding: .4rem .7rem;
    border-radius: 7px;
    font-size: .9rem;
    font-weight: 500;
}
.navlinks a:hover { background: rgba(255, 255, 255, .09); color: #fff; text-decoration: none; }
.navlinks a.on { background: var(--ember); color: #fff; }

.subnav {
    background: var(--charcoal);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.subnav .wrap { display: flex; gap: .2rem; overflow-x: auto; padding-top: .35rem; padding-bottom: .35rem; }
.subnav a { color: #b3a79b; font-size: .85rem; padding: .3rem .65rem; border-radius: 6px; white-space: nowrap; }
.subnav a.on { background: rgba(209, 84, 31, .22); color: #fbc9ab; }
.subnav a:hover { text-decoration: none; color: #fff; }

/* ------------------------------------------------------------------ cards */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.15rem;
    box-shadow: var(--shadow);
}
.card + .card { margin-top: 1rem; }
.card-head { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .85rem; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .spacer { margin-left: auto; }

/* Grid and flex children default to min-width:auto, which lets a wide table
   push the whole page sideways instead of scrolling inside its own container.
   This is the single most common cause of horizontal scroll on a phone. */
.grid > *, .split > *, .stack > * { min-width: 0; }
.table-wrap { max-width: 100%; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

.section { padding: 1.75rem 0; }
.stack > * + * { margin-top: .75rem; }

/* ------------------------------------------------------------------ stats */

.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.stat .n { font-size: 1.75rem; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; }
.stat .k { font-size: .74rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 650; }
.stat .sub { font-size: .8rem; color: var(--muted); }
.stat.accent { background: var(--ember-soft); border-color: #f3d3bf; }
.stat.accent .n { color: var(--ember-dark); }

.gauge { display: flex; align-items: center; gap: 1rem; }
.gauge .ring {
    --value: 0;
    width: 92px; height: 92px; border-radius: 50%; flex: none;
    background: conic-gradient(var(--ember) calc(var(--value) * 1%), #ece5dc 0);
    display: grid; place-items: center;
    position: relative;
}
.gauge .ring::after {
    content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--card);
}
.gauge .ring b { position: relative; z-index: 1; font-size: 1.5rem; letter-spacing: -.04em; }

.bar { height: 7px; background: #ece5dc; border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ember); border-radius: 99px; }
.bar.good > span { background: var(--good); }
.bar.team > span { background: var(--anvil); }

/* ----------------------------------------------------------------- pills */

.pill {
    display: inline-flex; align-items: center; gap: .3rem;
    font-size: .74rem; font-weight: 650; padding: .18rem .55rem; border-radius: 99px;
    background: #f0eae2; color: var(--slate); white-space: nowrap;
    border: 1px solid transparent;
}
.pill.good { background: var(--good-soft); color: var(--good); border-color: #c6e3d1; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: #f0dcb4; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: #f0cdc6; }
.pill.ember { background: var(--ember-soft); color: var(--ember-dark); border-color: #f3d3bf; }
.pill.ink { background: var(--ink); color: #fff; }
.pill.lg { font-size: .85rem; padding: .3rem .75rem; }

.tag { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 650; }

/* ---------------------------------------------------------------- buttons */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    font: inherit; font-weight: 620; font-size: .9rem;
    padding: .5rem .95rem; border-radius: 8px;
    border: 1px solid var(--line); background: var(--card); color: var(--ink);
    cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--muted); text-decoration: none; }
.btn.primary { background: var(--ember); border-color: var(--ember); color: #fff; }
.btn.primary:hover { background: var(--ember-dark); border-color: var(--ember-dark); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.good { background: var(--good); border-color: var(--good); color: #fff; }
.btn.bad { background: var(--card); border-color: #e2b6ad; color: var(--bad); }
.btn.sm { font-size: .8rem; padding: .3rem .6rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btnrow { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ----------------------------------------------------------------- forms */

label { display: block; font-size: .82rem; font-weight: 650; margin-bottom: .25rem; color: var(--slate); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=tel],
input[type=number], input[type=url], input[type=time], select, textarea {
    width: 100%; font: inherit; font-size: .92rem;
    padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 8px;
    background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(209, 84, 31, .28); outline-offset: 1px; border-color: var(--ember);
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.field { margin-bottom: .85rem; }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.inline-form { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; flex: 1 1 180px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin: 0 0 1rem; }
legend { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 0 .4rem; }

/* ----------------------------------------------------------------- tables */

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
    color: var(--muted); font-weight: 700; padding: .45rem .6rem; border-bottom: 1px solid var(--line); }
td { padding: .6rem; border-bottom: 1px solid #f0ebe4; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* ------------------------------------------------------------------ lists */

.rows > * { padding: .7rem 0; border-bottom: 1px solid #f0ebe4; }
.rows > *:last-child { border-bottom: 0; }
.row-flex { display: flex; gap: .75rem; align-items: center; }
.row-flex .grow { flex: 1; min-width: 0; }

.avatar {
    width: 38px; height: 38px; border-radius: 9px; flex: none;
    display: grid; place-items: center; font-size: 1.1rem;
    background: var(--ember-soft); border: 1px solid #f0d7c6;
}
.avatar.lg { width: 64px; height: 64px; font-size: 1.9rem; border-radius: 12px; }
.avatar.xl { width: 92px; height: 92px; font-size: 2.8rem; border-radius: 16px; }

.empty { color: var(--muted); font-size: .9rem; padding: 1rem 0; text-align: center; }

/* ------------------------------------------------------------- commitment */

.commitment { border-left: 3px solid var(--ember); padding-left: .8rem; }
.commitment.kept { border-left-color: var(--good); }
.commitment.missed { border-left-color: var(--bad); }
.commitment.overdue { border-left-color: var(--warn); background: var(--warn-soft); }
.commitment .action { font-weight: 600; }

/* -------------------------------------------------------------- flash msgs */

.flashes { margin: 1rem 0 0; }
.flash {
    padding: .65rem .9rem; border-radius: 8px; font-size: .9rem; font-weight: 550;
    border: 1px solid; margin-bottom: .5rem;
}
.flash.ok { background: var(--good-soft); border-color: #c6e3d1; color: var(--good); }
.flash.win { background: var(--ember-soft); border-color: #f3d3bf; color: var(--ember-dark); }
.flash.warn { background: var(--warn-soft); border-color: #f0dcb4; color: var(--warn); }
.flash.error { background: var(--bad-soft); border-color: #f0cdc6; color: var(--bad); }

/* ------------------------------------------------------------- public site */

.hero {
    background: linear-gradient(160deg, var(--ink) 0%, #2e2419 60%, #3a2a1a 100%);
    color: #f6f1eb; padding: 4rem 0 3.5rem; position: relative; overflow: hidden;
}
.hero::after {
    content: ""; position: absolute; right: -120px; top: -80px; width: 420px; height: 420px;
    background: radial-gradient(circle, rgba(209, 84, 31, .35), transparent 65%);
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); max-width: 16ch; }
.hero p { font-size: 1.1rem; color: #d3c8bc; max-width: 54ch; }
.hero .wrap { position: relative; z-index: 1; }

.eyebrow {
    text-transform: uppercase; letter-spacing: .16em; font-size: .74rem; font-weight: 700;
    color: var(--ember); margin-bottom: .6rem;
}

.tier { display: flex; gap: 1rem; align-items: flex-start; }
.tier .n {
    font-size: 1.6rem; font-weight: 800; color: var(--ember); line-height: 1;
    font-variant-numeric: tabular-nums; flex: none; width: 2rem;
}

.procard {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1rem; display: flex; flex-direction: column; gap: .55rem; box-shadow: var(--shadow);
}
.procard:hover { border-color: var(--ember); }
.badges { display: flex; flex-wrap: wrap; gap: .3rem; }

.credbar {
    background: var(--ink); color: #ede6de; border-radius: var(--radius);
    padding: 1rem 1.15rem; display: flex; gap: 1.5rem; flex-wrap: wrap;
}
.credbar .n { font-size: 1.3rem; font-weight: 750; color: #fff; line-height: 1.15; }
.credbar .k { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: #a2968a; font-weight: 650; }

.steps { counter-reset: step; }
.steps li {
    counter-increment: step; list-style: none; position: relative; padding-left: 2.6rem;
    margin-bottom: 1.1rem;
}
.steps li::before {
    content: counter(step); position: absolute; left: 0; top: 0;
    width: 1.85rem; height: 1.85rem; border-radius: 50%;
    background: var(--ember-soft); color: var(--ember-dark);
    display: grid; place-items: center; font-weight: 750; font-size: .85rem;
    border: 1px solid #f0d7c6;
}
.steps li.done::before { content: "✓"; background: var(--good); color: #fff; border-color: var(--good); }
.steps li.now::before { background: var(--ember); color: #fff; border-color: var(--ember); }

footer.site {
    background: var(--ink); color: #9b9086; padding: 2.5rem 0; margin-top: 3rem; font-size: .88rem;
}
footer.site a { color: #cdc4ba; }
footer.site h4 { color: #fff; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; }

/* ------------------------------------------------------------ display mode */

body.display { background: var(--ink); color: #f4efe9; }
body.display .wrap { max-width: 1400px; }
body.display h1 { font-size: 3rem; }
body.display .card { background: #201a15; border-color: #3a3128; color: #f4efe9; box-shadow: none; }
body.display .stat { background: #201a15; border-color: #3a3128; }
body.display .tag, body.display .stat .k { color: #9b9086; }
body.display table td { border-color: #33291f; }
body.display th { color: #9b9086; border-color: #3a3128; }

.mono { font-family: var(--mono); font-size: .85em; }
.muted { color: var(--muted); }
.strike { text-decoration: line-through; opacity: .55; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.mt1 { margin-top: 1rem; } .mb1 { margin-bottom: 1rem; }
.mt2 { margin-top: 2rem; }
.hr { height: 1px; background: var(--line); margin: 1.25rem 0; border: 0; }

@media (max-width: 640px) {
    .topbar .wrap { height: auto; padding-top: .5rem; padding-bottom: .5rem; flex-wrap: wrap; }
    .navlinks { margin-left: 0; width: 100%; }
    h1 { font-size: 1.6rem; }
    .hero { padding: 2.5rem 0; }
}

/* ==========================================================================
   THE PHONE APP
   Members open this on a phone, one-handed, usually standing in a van.
   Everything below is thumb-first: bottom navigation, big targets, cards
   instead of tables, and 16px inputs so iOS doesn't zoom on focus.
   ========================================================================== */

body.app {
    background: var(--paper);
    /* room for the fixed tab bar, plus the iPhone home indicator */
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

.appbar {
    position: sticky; top: 0; z-index: 30;
    background: var(--ink); color: #f4efe9;
    border-bottom: 3px solid var(--ember);
    padding-top: env(safe-area-inset-top, 0px);
}
.appbar-inner {
    display: flex; align-items: center; gap: .75rem;
    max-width: 1120px; margin: 0 auto; padding: .6rem 1rem;
    min-height: 52px;
}
.applogo { display: flex; align-items: center; flex: none; }
.applogo img { display: block; height: 32px; width: auto; }

.appbar .who { line-height: 1.15; min-width: 0; }
.appbar .who strong { font-size: .98rem; display: block; color: #fff; }
.appbar .who small { color: #b3bfa9; font-size: .74rem; }
.appbar .grow { flex: 1; min-width: 0; }
.appbar a { color: #cdc4ba; }

.streak {
    display: inline-flex; align-items: center; gap: .25rem;
    background: rgba(209, 84, 31, .2); color: #fbc9ab;
    border: 1px solid rgba(209, 84, 31, .45);
    padding: .22rem .55rem; border-radius: 99px;
    font-size: .78rem; font-weight: 700; white-space: nowrap;
}

/* -------------------------------------------------------------- tab bar */

.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    display: grid; grid-template-columns: repeat(4, 1fr);
    background: rgba(255, 255, 255, .97);
    backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -2px 16px rgba(23, 19, 15, .07);
}
.tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; padding: .5rem .2rem .55rem;
    min-height: 56px;                     /* comfortably tappable */
    color: var(--muted); text-decoration: none;
    font-size: .72rem; font-weight: 650; letter-spacing: .01em;
    position: relative;
}
.tabbar a .ico { font-size: 1.25rem; line-height: 1; }
.tabbar a.on { color: var(--ember-dark); }
.tabbar a.on::before {
    content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 3px;
    background: var(--ember); border-radius: 0 0 3px 3px;
}
.tabbar a .dot {
    position: absolute; top: .42rem; right: 50%; margin-right: -1.1rem;
    width: 8px; height: 8px; border-radius: 50%; background: var(--ember);
    border: 2px solid #fff;
}
.tabbar a:active { background: var(--ember-soft); }

/* ------------------------------------------------------------ app pages */

/* The app's content well. Older, denser screens (workshop, leader tools) sit
   directly in here; the phone-first screens nest a narrower .screen inside. */
.appmain { max-width: 1120px; margin: 0 auto; padding: 1rem 1rem 2rem; }
.appmain > .screen { max-width: 760px; margin: 0 auto; padding: 0; }

.screen { max-width: 760px; margin: 0 auto; padding: 1rem 1rem 2rem; }
.screen.wide, .appmain > .screen.wide { max-width: 1120px; }
.screen > h1 { font-size: 1.5rem; margin-bottom: .15rem; }
.screen > .lede { color: var(--muted); font-size: .92rem; margin-bottom: 1rem; }

/* A card that is the whole tap target. */
.tapcard {
    display: block; background: var(--card); border: 1px solid var(--line);
    border-left: 4px solid var(--line);
    border-radius: var(--radius); padding: .85rem 1rem;
    color: inherit; text-decoration: none; box-shadow: var(--shadow);
}
.tapcard:hover, .tapcard:active { text-decoration: none; border-color: var(--muted); }
.tapcard + .tapcard { margin-top: .6rem; }
.tapcard.ember { border-left-color: var(--ember); }
.tapcard.warn  { border-left-color: var(--warn); }
.tapcard.bad   { border-left-color: var(--bad); }
.tapcard.good  { border-left-color: var(--good); }
.tapcard h3 { font-size: 1rem; margin-bottom: .15rem; }
.tapcard p { font-size: .875rem; color: var(--slate); margin: 0; }
.tapcard .go {
    font-size: .8rem; font-weight: 700; color: var(--ember-dark); margin-top: .45rem;
    display: inline-block;
}

/* Four-up number strip that stays readable at 360px. */
.pulse { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.pulse .cell {
    background: var(--card); border: 1px solid var(--line); border-radius: 9px;
    padding: .55rem .4rem; text-align: center;
}
.pulse .cell .n { font-size: 1.15rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.pulse .cell .k {
    /* Not smaller than 11px — these get read in a van, in daylight. */
    font-size: .69rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); font-weight: 700; margin-top: .1rem; line-height: 1.2;
}
.pulse .cell.good .n { color: var(--good); }
.pulse .cell.warn .n { color: var(--warn); }
.pulse .cell.bad  .n { color: var(--bad); }

/* Goal progress with a pace marker — the bit that says "behind", not just "40%". */
.track { position: relative; height: 10px; background: #ece5dc; border-radius: 99px; overflow: visible; }
.track > .fill { height: 100%; border-radius: 99px; background: var(--ember); }
.track > .fill.good { background: var(--good); }
.track > .fill.warn { background: var(--warn); }
.track > .pace {
    position: absolute; top: -4px; width: 2px; height: 18px;
    background: var(--anvil); border-radius: 2px; opacity: .65;
}
.track > .pace::after {
    content: "today"; position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
    font-size: .58rem; color: var(--muted); font-weight: 700; white-space: nowrap;
}
.trackwrap { padding-bottom: 1rem; }

/* Big friendly choice buttons for the check-in. */
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
.choices label {
    display: flex; align-items: center; justify-content: center; gap: .35rem;
    border: 1.5px solid var(--line); border-radius: 10px;
    padding: .8rem .5rem; font-size: .9rem; font-weight: 620;
    cursor: pointer; text-align: center; background: var(--card); margin: 0;
    min-height: 52px;
}
.choices input { position: absolute; opacity: 0; pointer-events: none; }
.choices label:has(input:checked) {
    border-color: var(--ember); background: var(--ember-soft); color: var(--ember-dark);
}
.choices.five { grid-template-columns: repeat(5, 1fr); }
.choices.five label { padding: .7rem .2rem; font-size: 1.15rem; }

.stepnum {
    display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem;
    border-radius: 50%; background: var(--ink); color: #fff;
    font-size: .8rem; font-weight: 750; margin-right: .45rem; flex: none;
}

/* Rows that read like a list on a phone and a table on a desktop. */
.people { display: grid; gap: .5rem; }
.person {
    display: flex; align-items: center; gap: .7rem;
    background: var(--card); border: 1px solid var(--line);
    border-radius: 10px; padding: .6rem .7rem; color: inherit; text-decoration: none;
}
.person:hover { text-decoration: none; border-color: var(--muted); }
.person .grow { flex: 1; min-width: 0; }
.person strong { font-size: .92rem; }
.person small { color: var(--muted); font-size: .78rem; }

.sheet {
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow);
}
.sheet + .sheet { margin-top: .75rem; }
.sheet h2 { font-size: 1.05rem; }
.sheet h3 { font-size: .95rem; }

.sticky-save {
    position: sticky; bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    padding: .6rem 0; background: linear-gradient(transparent, var(--paper) 35%);
    z-index: 20;
}

.chip-row {
    display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .3rem;
    -webkit-overflow-scrolling: touch; max-width: 100%;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip-row > * {
    flex: none;
    /* Chips are tap targets, not decoration — keep them thumb-sized. */
    min-height: 38px; padding: .5rem .8rem; font-size: .8rem; line-height: 1.25;
    white-space: normal; max-width: 15rem; text-align: left;
}

.quiet-link { color: var(--muted); font-size: .82rem; }

.pill.brand { background: var(--brand-soft); color: var(--brand-dark); border-color: #cfe6c2; }

/* ---------------------------------------------------------- chapter chat */

.chatscreen { padding-bottom: 0; }

.chathead {
    position: sticky; top: 0; z-index: 15;
    background: var(--paper); padding: .2rem 0 .6rem;
    border-bottom: 1px solid var(--line); margin-bottom: .8rem;
}
.chathead h1 { font-size: 1.25rem; }

.thread { display: flex; flex-direction: column; gap: .55rem; padding-bottom: 5.5rem; }

.msg { display: flex; gap: .5rem; align-items: flex-end; max-width: 92%; }
.msg.mine { align-self: flex-end; flex-direction: row-reverse; }

.bubble {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 14px 14px 14px 4px; padding: .55rem .75rem;
    box-shadow: 0 1px 2px rgba(20, 23, 15, .05); min-width: 0;
}
.msg.mine .bubble {
    background: var(--brand-soft); border-color: #cfe6c2;
    border-radius: 14px 14px 4px 14px;
}
.bubble .who { font-size: .76rem; font-weight: 700; color: var(--brand-dark); margin-bottom: .1rem; }
.bubble .body { font-size: .95rem; line-height: 1.45; overflow-wrap: anywhere; }
.bubble .meta {
    display: flex; align-items: center; gap: .5rem; margin-top: .25rem;
    font-size: .7rem; color: var(--muted);
}
.reactbtn {
    background: none; border: 1px solid var(--line); border-radius: 99px;
    font: inherit; font-size: .72rem; padding: .12rem .45rem; cursor: pointer;
    color: var(--muted); min-height: 26px;
}
.reactbtn:hover { border-color: var(--brand); color: var(--brand-dark); }

.composer {
    position: fixed; left: 0; right: 0;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    display: flex; gap: .4rem; align-items: center;
    padding: .5rem .8rem calc(.5rem + env(safe-area-inset-bottom, 0px) * 0);
    background: rgba(255, 255, 255, .97);
    backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--line); z-index: 40;
}
.composer input[type=text] { flex: 1; min-height: 42px; border-radius: 99px; }
.composer select {
    width: auto; flex: none; min-height: 42px; border-radius: 99px;
    font-size: .82rem; padding: .3rem .5rem; max-width: 6.6rem;
}
.composer .btn { min-height: 42px; min-width: 46px; border-radius: 99px; font-size: 1.1rem; }

@media (min-width: 900px) {
    .composer { position: sticky; bottom: 0; margin: 0 -1rem; border-radius: 0; }
    .thread { padding-bottom: 1rem; }
}

/* Phone tuning */
@media (max-width: 560px) {
    .screen { padding: .85rem .8rem 1.5rem; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .split { grid-template-columns: 1fr; }
    .pulse { grid-template-columns: repeat(2, 1fr); }
    .choices { grid-template-columns: 1fr 1fr; }
    /* 16px stops iOS zooming the whole page when a field is focused */
    input[type=text], input[type=email], input[type=password], input[type=date],
    input[type=tel], input[type=number], input[type=url], input[type=time],
    select, textarea { font-size: 16px; }
    .btn { padding: .65rem 1rem; min-height: 44px; }
    .btn.sm { min-height: 36px; }
    h1 { font-size: 1.45rem; }
    .card, .sheet { padding: .9rem; }
}

/* Desktop: swap the tab bar for a normal top nav. */
@media (min-width: 900px) {
    .tabbar { display: none; }
    body.app { padding-bottom: 0; }
    .appbar-inner { min-height: 58px; }
    .deskonly { display: flex !important; }
}
@media (max-width: 899px) {
    .deskonly { display: none !important; }
}

/* ------------------------------------------------- chapter switcher
   Belonging to more than one chapter (nine businesses do) means the app must
   always say which one you're looking at. A <details> keeps it working with
   no JavaScript. */
.chapterpick { min-width: 0; position: relative; }
.chapterpick > summary {
    list-style: none; cursor: pointer; line-height: 1.15;
    padding: .1rem .4rem .1rem 0;
}
.chapterpick > summary::-webkit-details-marker { display: none; }
.chapterpick > summary strong {
    font-size: .98rem; display: block; color: #fff;
}
.chapterpick > summary strong::after { content: " ▾"; opacity: .55; font-size: .8em; }
.chapterpick > summary small { color: #b3bfa9; font-size: .74rem; }
.chapterpick > summary .tag { color: var(--brand-light); }
.chapterlist {
    position: absolute; z-index: 60; top: 100%; left: 0; min-width: 190px;
    background: #fff; border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,.22); padding: .35rem; margin-top: .4rem;
    display: flex; flex-direction: column; gap: .15rem;
}
.chapterlist button {
    text-align: left; background: none; border: 0; border-radius: 8px;
    padding: .6rem .7rem; font: inherit; font-size: .95rem; color: var(--ink);
    cursor: pointer; min-height: 44px;
}
.chapterlist button:hover { background: var(--brand-soft); }
.chapterlist button.on { background: var(--brand); color: #fff; font-weight: 650; }

/* --------------------------------------------------- meeting schedule */
.datechip {
    flex: 0 0 auto; width: 48px; text-align: center; border-radius: 10px;
    background: var(--brand-soft); border: 1px solid #cfe6c2; padding: .3rem 0;
    line-height: 1.05;
}
.datechip .d { display: block; font-size: 1.25rem; font-weight: 750; color: var(--brand-dark); }
.datechip .mo { display: block; font-size: .62rem; letter-spacing: .08em; color: var(--muted); }

a.card.tappable { text-decoration: none; color: inherit; display: flex; gap: .8rem; align-items: center; }
a.card.tappable:hover { border-color: var(--brand); }

.card.accent { border-left: 4px solid var(--brand); }
.card.alert { border-left: 4px solid var(--bad); }

ol.rotation { margin: 0; padding-left: 1.4rem; }
ol.rotation li { padding: .45rem 0; border-bottom: 1px solid var(--line); }
ol.rotation li:last-child { border-bottom: 0; }
ol.rotation li.me { font-weight: 650; }
ol.rotation li.skipped { opacity: .5; }
/* On a phone a company name plus four controls will not fit on one line, so the
   controls drop underneath rather than pushing the row off the screen. */
ol.rotation.editable li { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
ol.rotation.editable li > .grow { min-width: 0; flex: 1 1 100%; }
.inline-actions { display: flex; gap: .25rem; flex-shrink: 0; flex-wrap: wrap; }
@media (min-width: 620px) {
    ol.rotation.editable li > .grow { flex: 1 1 auto; }
}
.btn.xs { padding: .3rem .5rem; font-size: .78rem; min-height: 34px; }
.btn.danger { color: var(--bad); border-color: #f0cdc6; }
.row-flex.tight { padding: .35rem 0; border-bottom: 1px solid var(--line); }
.emoji { flex: 0 0 auto; font-size: 1.15rem; }

/* ---------------------------------------------- attendance
   Everyone is here by default, so the switch starts on and you turn people off.
   Marking sixteen people present was the wrong default work. */
/* Compact: a seventeen-person register should fit on one screen, not scroll
   for a minute. Names sit at body size, trade drops to a caption. */
.attendance-sheet .att-row {
    display: flex; align-items: center; gap: .5rem;
    padding: .3rem 0; border-bottom: 1px solid var(--line);
}
.attendance-sheet .att-row strong { font-size: .92rem; font-weight: 620; line-height: 1.25; }
.attendance-sheet .att-row .excused-note { font-size: .72rem; line-height: 1.2; }
.attendance-sheet .att-row:last-child { border-bottom: 0; }
.attendance-sheet .att-row.absent { opacity: .5; }
.attendance-sheet .att-row.absent strong { text-decoration: line-through; }
.attendance-sheet .att-row.failed { outline: 2px solid var(--bad); border-radius: 8px; }

.attendance-sheet button.emoji {
    background: none; border: 0; padding: 0; font-size: 1.05rem; line-height: 1;
    cursor: pointer; border-radius: 8px; min-width: 28px; min-height: 34px;
}
.attendance-sheet button.emoji[disabled] { cursor: default; }
.att-row.excused button.emoji { background: var(--brand-soft); outline: 1px solid #cfe6c2; }
.att-row .excused-note { font-size: .74rem; }

/* The switch itself: 52x32 with a 44px tap area, so a thumb can't miss it. */
.attendance-sheet button.toggle {
    flex: 0 0 auto; margin-left: auto; width: 46px; height: 28px; border-radius: 99px; cursor: pointer;
    border: 1px solid var(--line); background: #e6e1da; padding: 0; position: relative;
    transition: background .13s ease, border-color .13s ease;
}
.attendance-sheet button.toggle::after {
    content: ""; position: absolute; inset: -6px;      /* invisible 44px target */
}
.attendance-sheet button.toggle .knob {
    position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
    border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.28);
    transition: transform .13s ease;
}
.attendance-sheet button.toggle[aria-pressed="true"] {
    background: var(--good); border-color: var(--good);
}
.attendance-sheet button.toggle[aria-pressed="true"] .knob { transform: translateX(18px); }
.attendance-sheet button.toggle[disabled] { opacity: .4; cursor: default; }

/* -------------------------------------------------- notes and write-up */
.notelist .row-flex { padding: .5rem 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.notelist .row-flex:last-child { border-bottom: 0; }
.summary .prose { font-size: .95rem; }
.summary .prose h3 {
    font-size: .82rem; text-transform: uppercase; letter-spacing: .07em;
    color: var(--brand-dark); margin: 1rem 0 .35rem;
}
.summary .prose h3:first-child { margin-top: .2rem; }
.summary .prose ul { margin: 0 0 .5rem; padding-left: 1.1rem; }
.summary .prose li { margin-bottom: .3rem; }
.summary .prose p { margin: 0 0 .5rem; }
.summary .prose hr { border: 0; border-top: 1px solid var(--line); margin: .8rem 0; }
.warn-line { color: var(--warn); margin: .3rem 0; }

/* ------------------------------------------- collapsible meeting sections
   One meeting is one page. Sections fold so the page stays scannable on a
   phone instead of becoming a mile of form. */
details.section-block { padding: 0; margin-bottom: .75rem; }
details.section-block > summary {
    display: flex; align-items: center; gap: .6rem; cursor: pointer;
    padding: .9rem 1rem; list-style: none; min-height: 56px;
}
details.section-block > summary::-webkit-details-marker { display: none; }
details.section-block > summary::after {
    content: "⌄"; font-size: 1.1rem; color: var(--muted); line-height: 1;
    transition: transform .15s ease; flex: 0 0 auto;
}
details.section-block[open] > summary::after { transform: rotate(180deg); }
details.section-block[open] > summary { border-bottom: 1px solid var(--line); }
details.section-block > summary strong { font-size: 1rem; }
details.section-block > *:not(summary) { padding-left: 1rem; padding-right: 1rem; }
details.section-block > *:not(summary):last-child { padding-bottom: 1rem; }

.backlink {
    display: inline-block; margin-bottom: .5rem; color: var(--muted);
    text-decoration: none; font-size: .88rem; font-weight: 650; min-height: 32px;
}
.backlink:hover { color: var(--brand-dark); }

a.sheet.tappable { display: flex; gap: .8rem; align-items: center;
                   color: inherit; text-decoration: none; }
a.sheet.tappable:hover { border-color: var(--brand); }
.sheet.accent { border-left: 4px solid var(--brand); }
.sheet.alert { border-left: 4px solid var(--bad); }
.sheet .big { font-size: 1.25rem; display: block; }
.datechip.quiet { background: #f4f1ec; border-color: var(--line); }
.datechip.quiet .d { color: var(--muted); }
.chev { color: var(--muted); flex: 0 0 auto; }

/* --------------------------------------------- sign-in links (accounts)
   The link is long and gets copied into a text message, so it needs to be
   selectable, monospaced, and impossible to mistake for editable content. */
.invite-box {
    background: var(--brand-soft); border: 1px solid #cfe6c2;
    border-radius: 10px; padding: .6rem .7rem; margin-top: .6rem;
}
.invite-box input[readonly] {
    font-family: var(--mono); font-size: 13px; background: #fff;
    padding: .5rem .6rem; min-height: 42px;
}
.invite-box .row-flex { gap: .4rem; }
.mono { font-family: var(--mono); }

/* ------------------------------------------------------- view-as-member
   A preview you can't tell you're inside is worse than none: you'd think the
   chapter tools had disappeared. So it announces itself on every screen. */
.modebar {
    position: sticky; top: 0; z-index: 45;
    display: flex; align-items: center; gap: .6rem;
    background: var(--warn-soft); border-bottom: 1px solid #f0dcb4;
    color: var(--warn); font-size: .82rem; font-weight: 650;
    padding: .5rem .9rem;
}
.modebar .btn { background: #fff; }

.modeswitch { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.modeswitch form { display: contents; }
.modeswitch button {
    width: 100%; text-align: left; cursor: pointer; font: inherit;
    padding: .7rem .8rem; min-height: 60px;
    border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.modeswitch button strong { display: block; font-size: .95rem; }
.modeswitch button small { color: var(--muted); font-size: .76rem; }
.modeswitch button.on {
    border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand);
}
.modeswitch button.on small { color: var(--brand-dark); }
