/* Steady Steps client portal — brand: cream paper, logo green and teal, sage leaves */

@font-face { font-family: 'Lora'; font-style: normal; font-weight: 400; font-display: swap; src: url('../assets/fonts/lora-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Lora'; font-style: italic; font-weight: 400; font-display: swap; src: url('../assets/fonts/lora-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Lora'; font-style: normal; font-weight: 500; font-display: swap; src: url('../assets/fonts/lora-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Lora'; font-style: normal; font-weight: 600; font-display: swap; src: url('../assets/fonts/lora-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('../assets/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('../assets/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('../assets/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('../assets/fonts/inter-latin-700-normal.woff2') format('woff2'); }

:root {
  --bg: #F7F4EC;
  --bg-2: #F1EDE2;
  --paper: #FFFDF8;
  --line: #E4DFD2;
  --line-2: #D6D0C0;
  --ink: #1E2B22;
  --ink-2: #445448;
  --ink-3: #6B786E;
  --green: #23592C;
  --green-deep: #173F23;
  --green-hover: #1C4A25;
  --teal: #1D5560;
  --sage-50: #EEF3EA;
  --sage-100: #E0EADB;
  --sage-200: #C9DAC3;
  --sage-400: #93B190;
  --sage-600: #5F8165;
  --ok: #24693A;      --ok-bg: #E3F1E6;
  --amber: #8A5A0B;   --amber-bg: #FBEFD6;
  --red: #A3261E;     --red-bg: #FBE6E3;
  --teal-ink: #19505A; --teal-bg: #E2EFF0;
  --neutral-ink: #4F5B53; --neutral-bg: #ECEAE2;
  --shadow: 0 1px 2px rgba(30, 43, 34, .05), 0 6px 20px rgba(30, 43, 34, .05);
  --radius: 16px;
  --radius-sm: 10px;
  --serif: 'Lora', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --focus: 0 0 0 3px rgba(29, 85, 96, .35);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121A15; --bg-2: #18221C; --paper: #1A241E; --line: #2B3830; --line-2: #36463C;
    --ink: #E9EEE7; --ink-2: #C4CFC5; --ink-3: #93A196;
    --green: #8CC59A; --green-deep: #A9D6B4; --green-hover: #A2D3AE; --teal: #84C3CC;
    --sage-50: #1E2A22; --sage-100: #233128; --sage-200: #2E4034; --sage-400: #5E7F66; --sage-600: #8CB596;
    --ok: #92D3A4; --ok-bg: #1F3526; --amber: #F0C36E; --amber-bg: #3A2F17; --red: #F3A49B; --red-bg: #3D1F1C;
    --teal-ink: #9CD3DB; --teal-bg: #1A3338; --neutral-ink: #C4CFC5; --neutral-bg: #26302A;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121A15; --bg-2: #18221C; --paper: #1A241E; --line: #2B3830; --line-2: #36463C;
  --ink: #E9EEE7; --ink-2: #C4CFC5; --ink-3: #93A196;
  --green: #8CC59A; --green-deep: #A9D6B4; --green-hover: #A2D3AE; --teal: #84C3CC;
  --sage-50: #1E2A22; --sage-100: #233128; --sage-200: #2E4034; --sage-400: #5E7F66; --sage-600: #8CB596;
  --ok: #92D3A4; --ok-bg: #1F3526; --amber: #F0C36E; --amber-bg: #3A2F17; --red: #F3A49B; --red-bg: #3D1F1C;
  --teal-ink: #9CD3DB; --teal-bg: #1A3338; --neutral-ink: #C4CFC5; --neutral-bg: #26302A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16.5px/1.6 var(--sans); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; color: var(--green-deep); line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: clamp(1.55rem, 1.2rem + 1.2vw, 2rem); }
h2 { font-size: 1.2rem; }
p { margin: 0 0 .5em; }
a { color: var(--teal); text-underline-offset: 3px; }
a:hover { color: var(--green); }
img { max-width: 100%; }
code { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: .92em; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
h1:focus { outline: none; box-shadow: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: .88rem; }
.strong { font-weight: 600; }
.center { text-align: center; }
.text-red { color: var(--red); }
.text-amber { color: var(--amber); }
.prose { white-space: pre-line; color: var(--ink-2); }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.noscript { padding: 2rem; text-align: center; }
.icon { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.2em; }
.ic-inline { margin-right: .35em; color: var(--ink-3); }
.ic-green { color: var(--ok); margin-right: .4em; }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  min-height: 44px; padding: .55em 1.1em; border-radius: 999px; border: 1px solid transparent;
  font: 600 .95rem/1.2 var(--sans); cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, color .15s;
}
.btn-sm { min-height: 36px; padding: .35em .85em; font-size: .86rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-hover); color: #fff; }
:root[data-theme="dark"] .btn-primary, :root[data-theme="dark"] .btn-primary:hover { color: #0E1A12; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary, :root:not([data-theme="light"]) .btn-primary:hover { color: #0E1A12; } }
.btn-secondary { background: var(--paper); color: var(--green); border-color: var(--sage-200); }
.btn-secondary:hover { background: var(--sage-50); border-color: var(--sage-400); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--sage-50); color: var(--green); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-bg); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.is-busy { cursor: progress; }
.linklike { background: none; border: 0; color: var(--teal); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
.more { display: inline-flex; align-items: center; gap: .25em; margin-top: .6rem; font-weight: 600; font-size: .9rem; text-decoration: none; color: var(--teal); }
.more:hover { text-decoration: underline; }

.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; }
.field label { font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.field .hint { font-size: .82rem; color: var(--ink-3); margin: 0; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
  width: 100%; min-height: 44px; padding: .6em .8em; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--paper); color: var(--ink); font: 400 1rem/1.4 var(--sans);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: var(--focus); }
input[type="file"] { font: inherit; font-size: .9rem; }
.field.check { flex-direction: row; align-items: center; gap: .6rem; }
.field.check input { width: 20px; height: 20px; accent-color: var(--green); }
.field.check label { font-weight: 500; }
.code-input { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; font-size: 1.1rem; }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: .3em; padding: .15em .65em; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; line-height: 1.6; }
.pill .icon { width: 1em; height: 1em; }
.pill-green { background: var(--ok-bg); color: var(--ok); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-red { background: var(--red-bg); color: var(--red); }
.pill-teal { background: var(--teal-bg); color: var(--teal-ink); }
.pill-neutral { background: var(--neutral-bg); color: var(--neutral-ink); }

/* ---------- layout ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in { max-width: 1240px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: inherit; }
.brand img { height: 32px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; gap: 1px; }
.brand-name { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; color: var(--green-deep); }
.brand-sub { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.topbar-right { display: flex; align-items: center; gap: .5rem; }
.case-switch { min-height: 36px; width: auto; padding: .3em .6em; font-size: .9rem; }
.role-tag { display: inline-flex; align-items: center; gap: .3em; font-size: .8rem; font-weight: 600; color: var(--teal-ink); background: var(--teal-bg); padding: .2em .7em; border-radius: 999px; }

.layout { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 1.5rem 1rem 3rem; display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 1.75rem; align-items: start; }
.main { min-width: 0; }
.main-wide { width: 100%; max-width: 1240px; margin: 0 auto; padding: 1.5rem 1rem 3rem; flex: 1; }
.side-col { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 76px; }
.sidenav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.layout > .sidenav { position: sticky; top: 76px; }
.sidenav a {
  display: flex; align-items: center; gap: .65rem; padding: .6rem .85rem; border-radius: 12px;
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .95rem;
}
.sidenav a:hover { background: var(--sage-50); color: var(--green); }
.sidenav a.on { background: var(--sage-100); color: var(--green-deep); font-weight: 600; }
.sidenav a .icon { color: var(--sage-600); }
.sidenav a.on .icon { color: var(--green); }
.nav-count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--teal); color: var(--paper); font-size: .75rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

.stack { display: flex; flex-direction: column; gap: 1.1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.row-end { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }
.row-gap { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.35rem; box-shadow: var(--shadow); }
.card > h2:first-child { margin-bottom: .6rem; }
details.card > summary { cursor: pointer; font-weight: 600; color: var(--green-deep); list-style-position: inside; }
details.card[open] > summary { margin-bottom: .8rem; }

.section-head { display: flex; gap: .9rem; align-items: flex-start; }
.section-head h1 { margin-bottom: .15em; }
.section-head .lede { color: var(--ink-3); margin: 0; max-width: 62ch; }
.section-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--sage-100); color: var(--green); display: grid; place-items: center; flex: none; }
.section-icon .icon { width: 24px; height: 24px; }

.loading { display: flex; align-items: center; justify-content: center; gap: .7rem; padding: 4rem 1rem; color: var(--ink-3); }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--sage-200); border-top-color: var(--green); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { text-align: center; padding: 2.2rem 1rem; color: var(--ink-3); background: var(--paper); border: 1px dashed var(--line-2); border-radius: var(--radius); }
.empty .icon { width: 30px; height: 30px; color: var(--sage-400); margin-bottom: .4rem; }

/* ---------- decorations ---------- */
.sprig { pointer-events: none; }
.sprig-stem { fill: none; stroke: var(--sage-400); stroke-width: 1.6; stroke-linecap: round; }
.sprig-leaf { fill: var(--sage-200); }
.hills { position: fixed; left: 0; right: 0; bottom: 0; width: 100%; height: 26vh; z-index: 0; }
.hill-back { fill: var(--sage-100); }
.hill-front { fill: var(--sage-200); opacity: .7; }

/* ---------- family: home ---------- */
.hero { position: relative; overflow: hidden; border-radius: var(--radius); padding: 1.6rem 1.5rem 1.4rem; background: linear-gradient(135deg, var(--sage-100), var(--sage-50) 60%, var(--paper)); border: 1px solid var(--sage-200); }
.hero h1 { margin-bottom: .1em; font-size: clamp(1.7rem, 1.3rem + 1.4vw, 2.3rem); }
.eyebrow { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--sage-600); font-weight: 600; margin-bottom: .35rem; }
.hero-sub { color: var(--ink-2); font-weight: 500; margin: 0; }
.hero-tag { font-family: var(--serif); font-style: italic; color: var(--green); margin: .6rem 0 0; }
.hero-sprig { position: absolute; width: 190px; height: 95px; opacity: .85; right: 22px; bottom: 10px; }

.now-card { border: 1.5px solid var(--sage-200); background: linear-gradient(180deg, var(--paper), var(--sage-50)); }
.now-head { display: flex; align-items: center; gap: .9rem; margin-bottom: .8rem; }
.now-head h2 { margin: 0; font-size: 1.35rem; }
.now-head { flex-wrap: wrap; }
.now-head > div { flex: 1 1 210px; min-width: 0; }
.now-photo { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 3px solid var(--paper); box-shadow: 0 0 0 1.5px var(--sage-200); }
.live { display: inline-flex; align-items: center; gap: .45em; font-size: .8rem; font-weight: 600; color: var(--ok); background: var(--ok-bg); padding: .25em .75em; border-radius: 999px; white-space: nowrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; box-shadow: 0 0 0 0 rgba(36, 105, 58, .5); animation: pulse 2.2s ease-out infinite; margin-right: .1em; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(36, 105, 58, .45); } 70% { box-shadow: 0 0 0 8px rgba(36, 105, 58, 0); } 100% { box-shadow: 0 0 0 0 rgba(36, 105, 58, 0); } }
.now-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .75rem; }
.now-item { display: flex; gap: .8rem; padding: .85rem 1rem; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; }
.now-bullet { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); margin-top: .5em; flex: none; }
.now-ongoing .now-bullet { background: var(--sage-400); }
.now-ongoing { background: transparent; border-style: dashed; }
.now-title { font-weight: 600; margin: 0; }
.now-detail { color: var(--ink-2); margin: .15rem 0 0; font-size: .95rem; }
.now-meta { color: var(--ink-3); font-size: .82rem; margin: .25rem 0 0; }
.now-strip { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.now-strip p { margin: 0; color: var(--ink-2); }

.alert-card { border: 1.5px solid color-mix(in srgb, var(--red) 35%, transparent); background: var(--red-bg); }
.alert-head { display: flex; align-items: center; gap: .55rem; color: var(--red); }
.alert-head h2 { margin: 0; color: var(--red); }
.late-list { margin: .3rem 0 0; padding-left: 1.2rem; }
.late-list li { margin: .25rem 0; }
.late-list a { color: var(--ink); font-weight: 600; }
.need-card { border-left: 4px solid var(--teal); }

.mini-dates, .mini-wait, .feed, .plain-list, .kd-list, .doc-list, .email-list, .edit-list, .rules-list { list-style: none; margin: 0; padding: 0; }
.mini-dates li { display: flex; gap: .8rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.mini-dates li:last-child, .mini-wait li:last-child { border-bottom: 0; }
.mini-dates p, .mini-wait p { margin: 0; }
.mini-wait li { padding: .5rem 0; border-bottom: 1px solid var(--line); }
.feed li { display: flex; gap: .7rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed li > .icon { color: var(--sage-600); margin-top: .25em; }
.feed a { color: var(--ink); text-decoration: none; font-weight: 500; }
.feed a:hover { color: var(--teal); text-decoration: underline; }
.feed p { margin: 0; }
.last-msg { background: var(--sage-50); border-radius: 12px; padding: .8rem 1rem; }
.plain-list li { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; padding: .4rem 0; }

.date-tile { flex: none; width: 64px; text-align: center; border-radius: 12px; background: var(--sage-100); color: var(--green-deep); padding: .35rem 0; display: flex; flex-direction: column; line-height: 1.1; }
.dt-day { font-family: var(--serif); font-weight: 600; font-size: 1.5rem; }
.dt-mon { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.dt-yr { font-size: .7rem; color: var(--ink-3); }
.small-tile { width: 48px; padding: .25rem 0; }
.small-tile .dt-day { font-size: 1.15rem; }

/* ---------- timeline ---------- */
.chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: .45em; padding: .4em .9em; border-radius: 999px; background: var(--paper); border: 1px solid var(--line-2); text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: .9rem; min-height: 38px; }
.chip.on { background: var(--green); border-color: var(--green); color: var(--paper); }
.count { display: inline-flex; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bg-2); color: var(--ink-2); font-size: .75rem; font-weight: 700; align-items: center; justify-content: center; margin-left: .3em; }
.chip.on .count { background: rgba(255, 255, 255, .25); color: inherit; }
.timeline { list-style: none; margin: 0; padding: 1.25rem 1.35rem; position: relative; }
.tl-month { font-family: var(--serif); font-weight: 600; color: var(--sage-600); margin: .4rem 0 .6rem; padding-left: 2rem; }
.tl-item { position: relative; padding: 0 0 1.2rem 2rem; }
.tl-item::before { content: ''; position: absolute; left: 7px; top: 14px; bottom: -4px; width: 2px; background: var(--line-2); }
.tl-item:last-child::before { display: none; }
.tl-dot { position: absolute; left: 0; top: 6px; width: 16px; height: 16px; border-radius: 50%; border: 3px solid var(--paper); box-shadow: 0 0 0 1.5px var(--line-2); background: var(--sage-400); }
.tl-done .tl-dot { background: var(--ok); }
.tl-waiting .tl-dot { background: #D69A26; }
.tl-late .tl-dot { background: var(--red); }
.tl-top { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.tl-date { font-size: .85rem; color: var(--ink-3); font-weight: 500; }
.tl-title { font-weight: 600; margin: .2rem 0 0; }
.tl-detail { color: var(--ink-2); margin: .15rem 0 0; }

/* ---------- key dates ---------- */
.kd { display: flex; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.kd:last-child { border-bottom: 0; }
.kd-body { flex: 1; min-width: 0; }
.kd-top { display: flex; justify-content: space-between; gap: .7rem; flex-wrap: wrap; align-items: flex-start; }
.kd-title { font-weight: 600; margin: 0 0 .2rem; }
.kd-overdue .date-tile, .kd-missed .date-tile { background: var(--red-bg); color: var(--red); }
.kd-met .date-tile { background: var(--ok-bg); color: var(--ok); }
.kd-notes { color: var(--ink-2); }

/* ---------- work board ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; align-items: start; }
.col { background: var(--bg-2); border-radius: var(--radius); padding: .85rem; border-top: 4px solid var(--line-2); }
.col h2 { font-size: 1rem; display: flex; align-items: center; justify-content: space-between; }
.col-teal { border-top-color: var(--teal); }
.col-green { border-top-color: var(--ok); }
.col-amber { border-top-color: #D69A26; }
.col-empty { padding: .4rem .2rem; margin: 0; }
.task { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: .75rem .85rem; margin-bottom: .6rem; box-shadow: var(--shadow); }
.task:last-child { margin-bottom: 0; }
.task-title { font-weight: 600; margin: 0 0 .2rem; }
.task-detail { font-size: .9rem; color: var(--ink-2); margin: 0 0 .3rem; }

/* ---------- waiting for ---------- */
.wait-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: .9rem; }
.wait { background: var(--paper); border: 1px solid var(--line); border-left: 5px solid #D69A26; border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.wait-overdue { border-left-color: var(--red); }
.wait-resolved { border-left-color: var(--ok); }
.wait-top { display: flex; justify-content: space-between; gap: .8rem; margin-bottom: .5rem; }
.wait-party { font-weight: 700; margin: 0; }
.wait-item { margin: 0; color: var(--ink-2); }
.wait-days { text-align: center; line-height: 1; color: var(--amber); flex: none; }
.wait-overdue .wait-days { color: var(--red); }
.wait-days .big { display: block; font-family: var(--serif); font-size: 1.9rem; font-weight: 600; }
.wait-days span:last-child { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }

/* ---------- emails ---------- */
.email-list { display: flex; flex-direction: column; gap: .9rem; }
.email-meta { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .9rem; margin-bottom: .55rem; }
.email-date { font-weight: 600; color: var(--green-deep); }
.subject-row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-bottom: .55rem; }
.subject { display: inline-block; padding: .45em .75em; background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; color: var(--ink); white-space: pre-wrap; word-break: break-word; flex: 1; min-width: 0; }
.meaning { color: var(--ink-2); }

/* ---------- documents ---------- */
.doc { display: flex; align-items: center; gap: .9rem; padding: .75rem 0; border-bottom: 1px solid var(--line); }
.doc:last-child { border-bottom: 0; }
.doc-icon { width: 42px; height: 42px; border-radius: 10px; background: var(--sage-100); color: var(--green); display: grid; place-items: center; flex: none; }
.doc-body { flex: 1; min-width: 0; }
.doc-body p { margin: 0; }
.doc-title { font-weight: 600; overflow-wrap: anywhere; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 1.4rem 1rem; border: 2px dashed var(--sage-400); border-radius: var(--radius); background: var(--sage-50); text-align: center; cursor: pointer; margin-bottom: .5rem; }
.dropzone .icon { width: 28px; height: 28px; color: var(--green); }
.dropzone.over { background: var(--sage-100); border-color: var(--green); }
.upload h2 { margin-bottom: .7rem; }

/* ---------- people ---------- */
.advocate { display: flex; gap: 1.3rem; align-items: center; flex-wrap: wrap; }
.adv-photo { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; border: 4px solid var(--paper); box-shadow: 0 0 0 2px var(--sage-200); }
.adv-links { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem; }
.person p { margin: .1rem 0; }
.person-name { font-weight: 700; font-size: 1.02rem; }
.person-role { color: var(--teal); font-weight: 500; }

/* ---------- messages ---------- */
.thread { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .8rem; max-height: 60vh; overflow-y: auto; padding-right: .3rem; }
.msg { display: flex; gap: .6rem; align-items: flex-end; max-width: 85%; }
.msg-me { align-self: flex-end; flex-direction: row-reverse; }
.msg-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex: none; }
.bubble { background: var(--sage-50); border: 1px solid var(--sage-100); border-radius: 16px 16px 16px 4px; padding: .65rem .9rem; }
.msg-me .bubble { background: var(--teal-bg); border-color: transparent; border-radius: 16px 16px 4px 16px; }
.msg-who { font-size: .8rem; font-weight: 600; margin: 0 0 .15rem; }
.msg-body { white-space: pre-wrap; margin: 0; overflow-wrap: anywhere; }
.msg-read { font-size: .75rem; color: var(--ink-3); margin: .2rem 0 0; display: flex; align-items: center; gap: .2rem; justify-content: flex-end; }
.composer { border-top: 1px solid var(--line); padding-top: 1rem; }

/* ---------- billing ---------- */
.agreement { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.agreement p { margin: 0; }
.outstanding { margin: 0; font-size: 1.05rem; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 600; padding: .5rem .6rem; border-bottom: 1px solid var(--line-2); }
.table td { padding: .65rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.pay-note { margin-top: .8rem; padding: .7rem .9rem; background: var(--sage-50); border-radius: 10px; white-space: pre-line; }

/* ---------- people's own footer ---------- */
.site-footer { text-align: center; padding: 2rem 1rem 2.5rem; border-top: 1px solid var(--line); background: var(--bg-2); position: relative; }
.site-footer p { margin: .2rem 0; }
.foot-sprig { width: 120px; height: 60px; }
.foot-tag { font-family: var(--serif); font-style: italic; color: var(--green); font-size: 1.05rem; }

/* ---------- preview bar ---------- */
.preview-bar { background: var(--teal); color: var(--paper); padding: .55rem 1rem; display: flex; gap: .6rem; align-items: center; justify-content: center; font-size: .9rem; text-align: center; }

/* ---------- admin ---------- */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .8rem; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; display: flex; flex-direction: column; }
.stat-n { font-family: var(--serif); font-size: 1.8rem; font-weight: 600; color: var(--green-deep); line-height: 1.1; }
.stat-l { font-size: .82rem; color: var(--ink-3); font-weight: 500; }
.stat-amber .stat-n { color: var(--amber); }
.stat-red .stat-n { color: var(--red); }
.stat-teal .stat-n { color: var(--teal); }
.case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: .9rem; }
.case-card { text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: .5rem; transition: border-color .15s, transform .15s; }
.case-card:hover { border-color: var(--sage-400); color: inherit; transform: translateY(-1px); }
.case-card.needs { border-left: 5px solid #D69A26; }
.case-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.case-card-top p { margin: 0; }
.case-name { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; color: var(--green-deep); }
.badges { display: flex; flex-wrap: wrap; gap: .35rem; }
.next-date { margin: 0; }
.rules summary { display: flex; align-items: center; }
.rules-list { counter-reset: r; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.4rem; }
.rules-list li { counter-increment: r; padding-left: 2.1rem; position: relative; }
.rules-list li::before { content: counter(r); position: absolute; left: 0; top: 0; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--sage-100); color: var(--green); font-weight: 700; font-size: .85rem; display: grid; place-items: center; }
.rules-list p { margin: .1rem 0 0; }

.case-bar { background: var(--sage-50); border-bottom: 1px solid var(--line); }
.case-bar-in { max-width: 1240px; margin: 0 auto; padding: .5rem 1rem; display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.case-bar-title { flex: 1; font-size: 1.05rem; }
.checks { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.checks-title { font-family: var(--serif); font-weight: 600; color: var(--green-deep); margin-bottom: .5rem; }
.checks ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .45rem; }
.checks li { display: flex; gap: .45rem; align-items: flex-start; font-size: .86rem; }
.checks li .icon { margin-top: .15em; }
.checks li.ok .icon { color: var(--ok); }
.checks li.todo .icon { color: var(--amber); }
.checks li.ok a { color: var(--ink-2); text-decoration: none; }
.checks li.todo a { color: var(--ink); font-weight: 600; }

.section-head.slim { display: block; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
.span-2 { grid-column: 1 / -1; }
.edit-list { display: flex; flex-direction: column; }
.edit-row { display: flex; justify-content: space-between; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.edit-row:last-child { border-bottom: 0; }
.edit-row.is-hidden .edit-main { opacity: .6; }
.edit-main { flex: 1 1 320px; min-width: 0; }
.edit-main p { margin: .2rem 0 0; }
.edit-actions { display: flex; gap: .3rem; flex-wrap: wrap; align-items: flex-start; }
.edit-row > form { flex: 1 1 100%; }
.edit-form { background: var(--sage-50); border-radius: 12px; padding: 1rem; }
.now-admin .plain-list li { gap: .6rem; }
.warn-line { display: flex; gap: .5rem; align-items: center; color: var(--amber); font-weight: 600; }
.inline-add { display: flex; gap: .6rem; align-items: flex-end; margin-top: .8rem; flex-wrap: wrap; }
.inline-add .field { flex: 1 1 280px; margin-bottom: 0; }
.invite-ready { border: 1.5px solid var(--sage-400); }
.invite-text { white-space: pre-wrap; background: var(--bg-2); border-radius: 10px; padding: .9rem; font-family: var(--sans); font-size: .92rem; margin: .6rem 0 0; overflow-wrap: anywhere; }
.invite-status { display: flex; gap: .5rem; align-items: center; margin: .4rem 0 0; padding: .6rem .8rem; border-radius: var(--radius-sm); background: var(--amber-bg); color: var(--amber); font-weight: 600; }
.invite-status.sent { background: var(--ok-bg); color: var(--ok); }
.invite-status svg { flex: none; width: 18px; height: 18px; }
.send-option { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.send-option h3 { margin: 0 0 .3rem; font-size: 1.02rem; }
.send-option > p { margin: 0 0 .7rem; color: var(--ink-2); }
.mark-sent:has(> [hidden]) { display: none; }
.mark-sent { margin-top: .6rem; }
.invite-preview { margin-top: .8rem; }
.invite-preview summary { cursor: pointer; color: var(--teal); font-weight: 600; font-size: .92rem; }

/* ---------- sign-in pages ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem 6rem; position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% 30%, var(--paper), var(--bg) 70%); }
.auth-card { position: relative; z-index: 1; width: 100%; max-width: 440px; background: var(--paper); border: 1px solid var(--line); border-radius: 22px; padding: 2rem 1.8rem 1.6rem; box-shadow: 0 10px 40px rgba(30, 43, 34, .09); overflow: hidden; }
.auth-card h1 { text-align: center; font-size: 1.5rem; margin-top: .6rem; }
.auth-logo { display: block; margin: 0 auto; width: 170px; height: auto; }
.auth-tag { text-align: center; font-family: var(--serif); font-style: italic; color: var(--green); margin: .5rem 0 0; font-size: 1.05rem; }
.auth-sub { text-align: center; color: var(--ink-3); margin-bottom: 1.2rem; }
.auth-sprig { position: absolute; width: 110px; height: 55px; opacity: .8; }
.auth-sprig-l { left: -12px; top: 14px; transform: scaleX(-1) rotate(-10deg); }
.auth-sprig-r { right: -12px; top: 14px; transform: rotate(-10deg); }
.auth-foot { position: relative; z-index: 1; margin-top: 1.2rem; color: var(--ink-2); }
.auth form { margin-top: .6rem; }
.notice { display: flex; gap: .7rem; padding: .9rem 1rem; border-radius: 12px; background: var(--sage-50); border: 1px solid var(--sage-200); margin-top: .6rem; }
.notice .icon { color: var(--green); margin-top: .2em; }
.notice p { margin: 0 0 .3rem; }
.steps { padding-left: 1.2rem; color: var(--ink-2); }
.steps li { margin-bottom: .5rem; }
.qr { display: flex; justify-content: center; padding: .6rem; background: #fff; border-radius: 12px; margin: .4rem 0 .8rem; border: 1px solid var(--line); }
.secret { word-break: break-all; background: var(--bg-2); padding: .1em .4em; border-radius: 6px; }

/* ---------- preview controls (example data only) ---------- */
.demo-bar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: center; gap: .5rem; flex-wrap: wrap; padding: .45rem 1rem; background: var(--green-deep); color: var(--paper); font-size: .85rem; }
.demo-btn { min-height: 32px; padding: .2em .9em; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .45); background: transparent; color: inherit; font: 600 .85rem var(--sans); cursor: pointer; }
.demo-btn.on { background: var(--paper); color: var(--green-deep); border-color: var(--paper); }
body:has(.demo-bar) .topbar { top: 41px; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 1.4rem; transform: translate(-50%, 140%); z-index: 100; display: flex; gap: .55rem; align-items: center; max-width: min(560px, calc(100vw - 2rem)); padding: .8rem 1.1rem; border-radius: 14px; background: var(--green-deep); color: var(--paper); box-shadow: 0 10px 30px rgba(0, 0, 0, .2); transition: transform .25s ease; font-weight: 500; }
.toast.show { transform: translate(-50%, 0); }
.toast-error { background: var(--red); }
:root[data-theme="dark"] .toast { color: #0E1A12; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { color: #0E1A12; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 1rem; padding-top: .8rem; }
  .layout > .sidenav, .side-col { position: static; }
  .sidenav { margin: 0 -1rem; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); background: var(--paper); }
  .sidenav::-webkit-scrollbar { display: none; }
  .sidenav ul { flex-direction: row; padding: .5rem 1rem; gap: .3rem; width: max-content; }
  .sidenav a { white-space: nowrap; padding: .5rem .8rem; font-size: .9rem; }
  .layout > .sidenav { position: sticky; top: 57px; z-index: 15; }
  .checks { order: 2; }
  .grid-2, .rules-list { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .board, .form-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 1rem; }
  .hero { padding: 1.3rem 1.1rem; }
  .hero-sprig { display: none; }
  .now-head { flex-wrap: wrap; }
  .case-grid { grid-template-columns: 1fr; }
  .msg { max-width: 95%; }
  .table thead { display: none; }
  .table tr { display: block; padding: .6rem 0; border-bottom: 1px solid var(--line); }
  .table td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .2rem 0; }
  .table td[data-label]::before { content: attr(data-label); color: var(--ink-3); font-size: .8rem; }
  .topbar .btn-ghost.btn-sm { padding: .35em .6em; }
  .auth-card { padding: 1.6rem 1.2rem 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .topbar, .sidenav, .side-col, .site-footer, .preview-bar, .case-bar, .composer, .upload, .btn { display: none !important; }
  .layout { display: block; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- child photo (avatar, child bar, picker, crop dialog) ---------- */
.avatar { --size: 40px; flex: none; display: inline-grid; place-items: center; width: var(--size); height: var(--size); border-radius: 50%; overflow: hidden; background: var(--sage-100); color: var(--green-deep); border: 2px solid var(--paper); box-shadow: 0 0 0 1px var(--sage-200); font-family: var(--serif); font-weight: 600; line-height: 1; user-select: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-initials { font-size: calc(var(--size) * .4); letter-spacing: .02em; }
.avatar-sm { --size: 28px; }
.avatar-md { --size: 40px; }
.avatar-lg { --size: 56px; }
.avatar-xl { --size: 128px; }
.avatar-btn { position: relative; flex: none; padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; line-height: 0; }
.avatar-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.avatar-badge { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: var(--paper); border: 2px solid var(--paper); }
.avatar-badge svg { width: 10px; height: 10px; }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 2px var(--sage-400); }

.child-bar { background: var(--sage-50); border-bottom: 1px solid var(--line); }
.child-bar-in { max-width: 1240px; margin: 0 auto; padding: .55rem 1rem; display: flex; align-items: center; gap: .75rem; min-width: 0; }
.child-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.child-name strong { font-family: var(--serif); font-size: 1.15rem; color: var(--green-deep); }
.child-name .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.child-photo-link { margin-left: auto; white-space: nowrap; }

.child-picker { position: relative; min-width: 0; }
.child-picker > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .55rem .25rem .4rem; margin-left: -.4rem; border-radius: 10px; }
.child-picker > summary::-webkit-details-marker { display: none; }
.child-picker > summary:hover { background: var(--sage-100); }
.child-picker > summary:focus-visible { outline: none; box-shadow: var(--focus); }
.child-picker > summary .icon { transition: transform .15s; }
.child-picker[open] > summary .icon { transform: rotate(180deg); }
.child-menu { position: absolute; z-index: 30; top: calc(100% + 6px); left: -.4rem; min-width: 240px; max-width: calc(100vw - 2rem); background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: .35rem; margin: 0; list-style: none; }
.child-menu a { display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; border-radius: 10px; text-decoration: none; color: var(--ink); }
.child-menu a:hover, .child-menu a:focus-visible { background: var(--sage-50); outline: none; }
.child-menu a[aria-current] { background: var(--sage-100); font-weight: 600; }
.child-menu .small { display: block; color: var(--ink-3); font-weight: 400; }

.case-bar-title { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.case-card-top .avatar { margin-right: .1rem; }
.case-card-who { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.photo-row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

.photo-dialog { padding: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); color: var(--ink); width: min(420px, calc(100vw - 1.5rem)); max-height: calc(100dvh - 1.5rem); overflow: auto; box-shadow: 0 20px 60px rgba(30, 43, 34, .25); }
.photo-dialog::backdrop { background: rgba(23, 33, 26, .55); }
.photo-dlg { padding: 1.1rem 1.2rem 1.2rem; }
.photo-dlg-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.photo-dlg-head h2 { margin: 0; font-size: 1.2rem; }
.photo-note { margin: .3rem 0 1rem; }
.photo-current { display: grid; place-items: center; padding: .5rem 0 1rem; }
.photo-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-top: .6rem; }
.crop-stage { position: relative; width: min(300px, 100%); aspect-ratio: 1; max-width: 100%; margin: 0 auto; overflow: hidden; border-radius: 16px; background: var(--bg-2); touch-action: none; cursor: grab; }
.crop-stage:active { cursor: grabbing; }
.crop-stage:focus-visible { outline: none; box-shadow: var(--focus); }
.crop-img { position: absolute; left: 0; top: 0; max-width: none; pointer-events: none; user-select: none; -webkit-user-drag: none; transform-origin: 0 0; }
.crop-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(247, 244, 236, .72); outline: 2px solid rgba(255, 255, 255, .9); outline-offset: -2px; pointer-events: none; }
.crop-zoom { display: flex; align-items: center; gap: .7rem; width: min(300px, 100%); margin: .8rem auto 0; }
.crop-zoom input { flex: 1; accent-color: var(--green); min-height: 0; padding: 0; border: 0; background: none; }
.crop-hint { margin: .4rem 0 0; }

@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .crop-ring { box-shadow: 0 0 0 999px rgba(18, 26, 21, .72); } }
:root[data-theme="dark"] .crop-ring { box-shadow: 0 0 0 999px rgba(18, 26, 21, .72); }

@media (max-width: 640px) {
  .child-bar-in { padding: .45rem 1rem; gap: .6rem; }
  .child-bar .avatar { --size: 34px; }
  .child-name strong { font-size: 1.05rem; }
  .child-name .small { display: none; }
  .child-photo-link .label { display: none; }
  .child-bar .avatar-badge { display: none; }
  .case-bar .avatar { --size: 30px; }
}
