/* Horse Boarding CRM. Laid out like Scott Specs and the Jamesleine member dashboard: a left-hand menu,
   a search bar, Oswald headings over Lato text. A phone or tablet is always dark; a computer follows its setting.
   Everything that opens, closes or changes eases in (nothing snaps). */
:root {
  --bg: #f5f3ee; --panel: #ffffff; --ink: #1d1f1c; --muted: #646a63; --line: #dcd8ce;
  --brand: #2f5d46; --brand-ink: #ffffff; --accent: #9a6a35; --accent-soft: #f6eddd;
  --ok: #e3f1e6; --ok-ink: #1d6a35; --warn: #fbf0d9; --warn-ink: #8a5a00; --bad: #fbe8e4; --bad-ink: #a2321f;
  --radius: 10px; --ease: 240ms cubic-bezier(.2, .7, .2, 1);
  --side-w: 248px; --side-bg: #eeebe3;
  --font-body: Lato, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-head: Oswald, "Arial Narrow", Lato, -apple-system, "Segoe UI", sans-serif;
}
@media screen and (prefers-color-scheme: dark), screen and (max-width: 899px), screen and (pointer: coarse) {
  :root {
    color-scheme: dark;
    --bg: #121512; --panel: #1b1f1b; --ink: #ecede9; --muted: #a3aaa1; --line: #30362f;
    --brand: #6fb38d; --brand-ink: #0d1a12; --accent: #d9a868; --accent-soft: #2b2417;
    --ok: #18301f; --ok-ink: #8fd4a3; --warn: #33290f; --warn-ink: #f0c26b; --bad: #3a1f1a; --bad-ink: #f29d8c;
    --side-bg: #0d100d;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font-body); }
h1, h2, h3, h4, .btn, .wordmark, .stat b, .tagline { font-family: var(--font-head); letter-spacing: .01em; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0 0 .35rem; text-transform: uppercase; font-weight: 700; text-wrap: balance; }
h2 { font-size: 1.15rem; margin: 1.6rem 0 .7rem; font-weight: 600; }
h3 { font-size: .98rem; margin: 0 0 .55rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
h4 { font-size: .82rem; margin: .8rem 0 .3rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
a { color: var(--brand); text-underline-offset: 2px; transition: color var(--ease), background-color var(--ease), border-color var(--ease), opacity var(--ease); }
.muted { color: var(--muted); } .small { font-size: .84rem; } .grow { flex: 1 1 auto; }
.bad { color: var(--bad-ink); } .good { color: var(--ok-ink); }
.count { font-family: var(--font-body); font-weight: 400; font-size: .82rem; color: var(--muted); margin-left: .35rem; text-transform: none; letter-spacing: 0; }
.wordmark { font-weight: 700; font-size: 1.25rem; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); line-height: 1.05; }
.tagline { display: block; font-size: .62rem; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); }

/* ---------- shell ---------- */
body.app { display: flex; min-height: 100vh; }
.content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
main { width: 100%; max-width: 1280px; margin: 0 auto; padding: 18px 20px 56px; }
main.fade-in { animation: fade var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
main.loading { display: flex; align-items: center; justify-content: center; min-height: 60vh; }

.side { position: sticky; top: 0; align-self: flex-start; flex: none; width: var(--side-w); height: 100vh; display: flex; flex-direction: column; background: var(--side-bg); border-right: 1px solid var(--line); overflow: hidden; transition: width var(--ease), transform var(--ease), box-shadow var(--ease); z-index: 40; }
.side-head { display: flex; align-items: center; gap: 11px; padding: 16px 14px 12px; }
.me { position: relative; flex: none; display: block; border-radius: 50%; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); display: block; }
.avatar.initials { display: inline-flex; align-items: center; justify-content: center; background: var(--brand); color: var(--brand-ink); font-family: var(--font-head); font-weight: 600; font-size: .92rem; }
.me .dot { position: absolute; top: -1px; right: -1px; width: 10px; height: 10px; border-radius: 50%; background: #d7382a; border: 2px solid var(--side-bg); }
.side-brand { min-width: 0; text-decoration: none; }
.side-nav { flex: 1 1 auto; overflow-y: auto; padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; }
.side-nav hr { border: 0; border-top: 1px solid var(--line); margin: 8px 4px; }
.side-nav a, .side-nav summary { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border-radius: 8px; color: var(--ink); font-size: .93rem; text-decoration: none; cursor: pointer; list-style: none; transition: background-color var(--ease), color var(--ease); }
.side-nav summary::-webkit-details-marker { display: none; }
.side-nav svg { width: 18px; height: 18px; flex: none; color: var(--muted); transition: color var(--ease), transform var(--ease); }
.side-nav a > span, .side-nav summary > span { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-nav a:hover, .side-nav summary:hover { background: color-mix(in srgb, var(--brand) 10%, transparent); }
.side-nav a.on { background: color-mix(in srgb, var(--brand) 17%, transparent); font-weight: 700; }
.side-nav a.on svg, .side-nav summary.here svg:first-child { color: var(--brand); }
.side-nav summary svg:last-child { width: 14px; height: 14px; }
.side-nav details[open] > summary svg:last-child { transform: rotate(180deg); }
.side-group .sec-body { padding: 2px 0 4px 20px; display: flex; flex-direction: column; gap: 1px; overflow: hidden; transition: height var(--ease); }
.side-group .sec-body a { padding: 6px 10px; font-size: .89rem; }
.count-pill { background: #d7382a; color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 700; padding: 1px 7px; font-style: normal; }
.side-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid var(--line); font-size: .8rem; }
.side-foot a { color: var(--ink); }
.side-collapse { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; line-height: 1; cursor: pointer; transition: background-color var(--ease); }
body.side-mini { --side-w: 68px; }
body.side-mini .side-brand, body.side-mini .side-nav a > span, body.side-mini .side-nav summary > span, body.side-mini .side-nav summary svg:last-child,
body.side-mini .side-group .sec-body, body.side-mini .side-foot a, body.side-mini .count-pill { display: none; }
body.side-mini .side-head, body.side-mini .side-foot { justify-content: center; padding-left: 0; padding-right: 0; }
body.side-mini .side-nav a, body.side-mini .side-nav summary { justify-content: center; padding: 10px 0; }
body.side-mini .side-collapse { transform: rotate(180deg); }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.menu-btn { display: none; width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; align-items: center; justify-content: center; flex: none; }
.menu-btn svg { width: 20px; height: 20px; }
.search { position: relative; flex: 1 1 auto; max-width: 620px; }
.search-icon svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; font: inherit; font-size: 1rem; padding: 10px 14px 10px 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); transition: border-color var(--ease), box-shadow var(--ease); }
.search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .16); max-height: 60vh; overflow: auto; opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity var(--ease), transform var(--ease); }
.results.open { opacity: 1; transform: none; pointer-events: auto; }
.results a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); }
.results a:last-child { border-bottom: 0; }
.results a:hover, .results a.active { background: color-mix(in srgb, var(--brand) 9%, transparent); }
.results small { color: var(--muted); }
.results .hint { padding: 10px 14px; color: var(--muted); font-size: .88rem; }
.side-scrim { display: none; }

@media (max-width: 899px) {
  body.app { display: block; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(84vw, 300px); height: auto; transform: translateX(-104%); }
  body.side-open .side { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
  .side-scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .4); opacity: 0; pointer-events: none; transition: opacity var(--ease); z-index: 39; }
  body.side-open .side-scrim { opacity: 1; pointer-events: auto; }
  .menu-btn { display: inline-flex; }
  .side-collapse { display: none; }
  body.side-mini { --side-w: 248px; }
  body.side-mini .side-brand, body.side-mini .side-nav a > span, body.side-mini .side-nav summary > span, body.side-mini .side-foot a { display: initial; }
  .top { padding: 10px 16px; }
  main { padding: 14px 16px 48px; }
}

/* ---------- page parts ---------- */
.page-head { padding: 4px 0 10px; }
.head-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.head-row h1, .head-row h2 { margin-bottom: 0; }
.crumb { margin: 0 0 4px; color: var(--muted); font-size: .84rem; }
.crumb a { color: var(--muted); }
.lede { color: var(--muted); max-width: 78ch; margin: .25rem 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.block { margin: 22px 0; }
.empty { color: var(--muted); font-style: italic; margin: 6px 0; }
.stamp { color: var(--muted); font-size: .78rem; margin-top: 28px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: .86rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; padding: 9px 15px; border-radius: 6px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); text-decoration: none; cursor: pointer; white-space: nowrap; transition: opacity var(--ease), background-color var(--ease), color var(--ease); }
.btn svg { width: 16px; height: 16px; }
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.ghost:hover { background: color-mix(in srgb, var(--brand) 9%, transparent); opacity: 1; }
.btn.small { padding: 6px 11px; font-size: .76rem; }
.btn.danger { color: var(--bad-ink); border-color: color-mix(in srgb, var(--bad-ink) 55%, transparent); }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; text-align: left; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; flex: none; transition: background-color var(--ease), border-color var(--ease); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.on { border-color: var(--brand); color: var(--brand); }
.pill { display: inline-block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--muted) 14%, transparent); color: var(--muted); vertical-align: 2px; white-space: nowrap; }
.pill.ok { background: var(--ok); color: var(--ok-ink); } .pill.warn { background: var(--warn); color: var(--warn-ink); } .pill.bad { background: var(--bad); color: var(--bad-ink); }
.alert { border-radius: 8px; padding: 10px 12px; font-size: .92rem; margin: 0 0 12px; border: 1px solid; }
.alert.error { background: var(--bad); color: var(--bad-ink); border-color: color-mix(in srgb, var(--bad-ink) 35%, transparent); }
.alert.ok { background: var(--ok); color: var(--ok-ink); border-color: color-mix(in srgb, var(--ok-ink) 35%, transparent); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin: 14px 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 14px 0; align-items: start; }
@media (max-width: 899px) { .two-col { grid-template-columns: 1fr; } }
.facts { margin: 0; display: grid; gap: 8px; }
.facts > div { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 10px; }
.facts dt { color: var(--muted); font-size: .86rem; } .facts dd { margin: 0; overflow-wrap: anywhere; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 12px 0; }
.stat { display: flex; flex-direction: column; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 15px; color: var(--ink); text-decoration: none; transition: border-color var(--ease), transform var(--ease); }
a.stat:hover { border-color: var(--brand); }
.stat-label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat b { font-size: 1.55rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); font-size: .8rem; }

.emergency { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 4px; padding: 10px 12px; border-radius: var(--radius); background: var(--bad); }
.emergency > span { font-family: var(--font-head); text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; color: var(--bad-ink); margin-right: 4px; }
.emergency a { display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border-radius: 999px; background: var(--panel); color: var(--bad-ink); text-decoration: none; font-size: .86rem; font-weight: 700; border: 1px solid color-mix(in srgb, var(--bad-ink) 30%, transparent); }
.emergency a svg { width: 14px; height: 14px; }
.alerts, .agenda, .plain, .checks, .due, .phones { list-style: none; margin: 0; padding: 0; }
.alerts li { border-left: 3px solid var(--warn-ink); background: var(--panel); border-radius: 0 8px 8px 0; margin: 0 0 6px; }
.alerts li.bad { border-left-color: var(--bad-ink); }
.alerts a { display: block; padding: 8px 12px; color: var(--ink); text-decoration: none; }
.alerts a:hover { background: color-mix(in srgb, var(--brand) 7%, transparent); }
.agenda li a { display: flex; flex-direction: column; padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.agenda b { font-size: .84rem; color: var(--accent); }
.checks li { padding: 3px 0; } .checks li.ok { color: var(--ok-ink); } .checks li.no { color: var(--warn-ink); }
.due li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.due li:last-child { border-bottom: 0; }
.plain li { padding: 5px 0; }

/* chores */
.chores { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 4px; }
.chores li { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; transition: opacity var(--ease), background-color var(--ease); }
.chores li.done { opacity: .62; } .chores li.done span { text-decoration: line-through; }
.chores label { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.chores input, .fed input { width: 19px; height: 19px; accent-color: var(--brand); flex: none; margin-top: 2px; }
.chores small { color: var(--muted); white-space: nowrap; }
.date-pick { font-family: var(--font-head); padding: 0 6px; }

/* lists */
.list-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0 8px; }
.list-tools input[type=search] { flex: 1 1 220px; max-width: 420px; font: inherit; padding: 9px 15px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.list-tools input:focus { outline: none; border-color: var(--brand); }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; animation: fade var(--ease); }
.chips-row[hidden] { display: none; }
.chip { font: inherit; font-size: .84rem; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; transition: background-color var(--ease), border-color var(--ease), color var(--ease); }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { border-collapse: collapse; width: 100%; }
table.list th, table.list td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: .92rem; }
table.list thead th { font-family: var(--font-head); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; background: color-mix(in srgb, var(--bg) 60%, var(--panel)); }
table.list th[data-sort] { cursor: pointer; } table.list th.asc::after { content: ' ▲'; } table.list th.desc::after { content: ' ▼'; }
table.list tbody tr:last-child > * { border-bottom: 0; }
table.list tbody tr[data-href] { cursor: pointer; transition: background-color var(--ease); }
table.list tbody tr[data-href]:hover { background: color-mix(in srgb, var(--brand) 6%, transparent); }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.feed td { font-size: .86rem; } .fed label { display: flex; align-items: center; gap: 5px; white-space: nowrap; font-size: .82rem; }
table.pnl tbody th { font-weight: 400; white-space: nowrap; } table.pnl tr.sum > * { font-weight: 700; border-top: 2px solid var(--line); } table.pnl tr.net > * { background: color-mix(in srgb, var(--brand) 7%, transparent); }

/* horses */
.horse-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.horse-card { display: flex; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; color: var(--ink); text-decoration: none; transition: border-color var(--ease), transform var(--ease); }
.horse-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.horse-card .photo { flex: none; width: 66px; height: 66px; border-radius: 10px; overflow: hidden; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; }
.horse-card .photo img { width: 100%; height: 100%; object-fit: cover; }
.ph svg { width: 34px; height: 34px; color: var(--accent); }
.hc-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.hc-body b { font-family: var(--font-head); font-size: 1.08rem; font-weight: 600; }
.hc-body small { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-body .pill { align-self: flex-start; margin-top: 3px; }
.horse-head { display: flex; gap: 16px; align-items: center; }
.hero-photo { width: 96px; height: 96px; border-radius: 14px; object-fit: cover; flex: none; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; }
.hero-photo.ph svg { width: 48px; height: 48px; }
.horse-head h1 small { font-size: .9rem; text-transform: none; font-family: var(--font-body); font-weight: 400; }

/* stalls and pastures */
.stall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.stall { border-radius: var(--radius); padding: 10px 12px; border: 1px solid var(--line); background: var(--panel); min-height: 86px; display: flex; flex-direction: column; gap: 4px; transition: border-color var(--ease); }
.stall.full { border-left: 4px solid var(--brand); } .stall.open { border: 1px dashed var(--accent); background: var(--accent-soft); } .stall.off { opacity: .6; }
.stall-name { font-family: var(--font-head); font-weight: 600; color: var(--muted); text-decoration: none; font-size: .82rem; letter-spacing: .06em; }
.stall a { color: var(--ink); text-decoration: none; display: flex; flex-direction: column; }
.stall small { color: var(--muted); font-size: .8rem; }
.pasture-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.pasture p { margin: 8px 0 0; font-size: .92rem; }
.bar { height: 6px; background: var(--line); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width var(--ease); } .bar i.over { background: var(--bad-ink); }

/* calendar */
.cal { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.cal-head, .cal-body { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head b { font-family: var(--font-head); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); }
.cal-cell { min-height: 104px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell:nth-child(7n) { border-right: 0; } .cal-cell.blank { background: color-mix(in srgb, var(--bg) 60%, transparent); }
.cal-cell.today .cal-day { background: var(--brand); color: var(--brand-ink); border-radius: 999px; padding: 0 7px; }
.cal-day { font-size: .8rem; color: var(--muted); align-self: flex-start; }
.ev { display: block; font-size: .74rem; line-height: 1.25; padding: 2px 5px; border-radius: 4px; background: color-mix(in srgb, var(--brand) 13%, transparent); color: var(--ink); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev.due { background: var(--warn); color: var(--warn-ink); }
@media (max-width: 640px) { .cal-cell { min-height: 64px; padding: 3px; } .ev { font-size: .64rem; padding: 1px 3px; } }

/* playbooks */
.pb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.pb-card { display: flex; flex-direction: column; gap: 4px; padding: 13px 15px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; transition: border-color var(--ease); }
.pb-card:hover { border-color: var(--brand); }
.pb-card b { font-family: var(--font-head); font-weight: 600; font-size: 1.02rem; }
.pb-card small { color: var(--muted); font-size: .84rem; }
.pb-card[hidden], [data-g][hidden] { display: none; }
.playbook { display: grid; gap: 12px; max-width: 880px; }
.playbook .steps ol { margin: 0; padding-left: 1.4rem; display: grid; gap: 8px; font-size: 1.05rem; }
.playbook .call { border-left: 4px solid var(--bad-ink); }
.phones li { padding: 4px 0; }

/* money */
.invoice-sheet { background: #fff; color: #1d1f1c; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; max-width: 820px; margin: 16px 0; }
.invoice-sheet .wordmark { color: #2f5d46; }
.inv-top { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.inv-meta { text-align: right; } .inv-meta h2 { margin: 0 0 4px; }
.inv-lines th, .inv-lines td { padding: 8px; border-bottom: 1px solid #ddd; text-align: left; } .inv-lines tfoot th { text-align: right; }
.line-head, .line-row { display: grid; grid-template-columns: 1fr 70px 110px 38px; gap: 8px; align-items: center; margin-bottom: 6px; }
.line-head span { font-size: .76rem; color: var(--muted); text-transform: uppercase; }
.line-row input { font: inherit; padding: 8px 9px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); min-width: 0; }
.chart { width: 100%; height: auto; max-height: 260px; }
.chart text { font-size: 11px; fill: var(--muted); } .chart .axis { stroke: var(--line); }
.bar-rev { fill: var(--brand); background: var(--brand); } .bar-cost { fill: var(--accent); background: var(--accent); }
.legend { display: flex; gap: 14px; align-items: center; font-size: .84rem; color: var(--muted); margin-bottom: 6px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: -8px; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-width: 640px; }
.bars li { display: grid; grid-template-columns: 170px 1fr 32px; gap: 10px; align-items: center; font-size: .9rem; }
.bars i { height: 10px; border-radius: 99px; background: var(--brand); transition: width var(--ease); }
.planner .fields { margin-bottom: 14px; }

/* leads */
.kanban { display: grid; grid-template-columns: repeat(7, minmax(190px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.lane { background: color-mix(in srgb, var(--panel) 50%, var(--bg)); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.lane h3 { font-size: .8rem; }
.lead-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 2px; }
.lead-card small { color: var(--muted); font-size: .8rem; }
.lead-acts { margin-top: 4px; font-size: .82rem; }

/* legal and guide */
.warning-sign { border: 3px solid var(--ink); max-width: 820px; }
.sign-text { font-size: 1.05rem; line-height: 1.5; } .sign-text b { font-family: var(--font-head); font-size: 1.5rem; letter-spacing: .1em; }
ol.docs { padding-left: 1.4rem; display: grid; gap: 5px; max-width: 880px; }
.doc-text { max-width: 900px; } .doc-text h1 { font-size: 1.5rem; } .doc-text h2 { margin-top: 2rem; }
.doc-text h3 { color: var(--ink); text-transform: none; letter-spacing: 0; font-size: 1.05rem; margin-top: 1.4rem; }
.doc-text blockquote { margin: 12px 0; padding: 12px 16px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; }
.doc-text li { margin: 4px 0; } .doc-text li.sub { margin-left: 1.2rem; list-style: circle; }
.doc-text .scroll { margin: 12px 0; }
.doc-text code { font-size: .88em; background: color-mix(in srgb, var(--muted) 14%, transparent); padding: 1px 5px; border-radius: 4px; }

/* users */
.user-list { list-style: none; margin: 0; padding: 0; }
.user-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 11px 2px; border-top: 1px solid var(--line); }
.user-row:first-child { border-top: 0; }
.user-acts { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- add / edit panel ---------- */
.panel-wrap { position: fixed; inset: 0; z-index: 100; }
.panel-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .38); opacity: 0; transition: opacity var(--ease); }
.panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--panel); display: flex; flex-direction: column; transform: translateX(102%); transition: transform var(--ease); box-shadow: -10px 0 40px rgba(0, 0, 0, .2); }
.panel-wrap.open .panel-scrim { opacity: 1; } .panel-wrap.open .panel { transform: none; }
.panel header, .panel footer { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel footer { border-bottom: 0; border-top: 1px solid var(--line); padding-bottom: max(14px, env(safe-area-inset-bottom)); }
.panel header h2 { margin: 0; flex: 1; font-size: 1.15rem; }
.panel-body { flex: 1; overflow-y: auto; padding: 8px 18px 20px; }
fieldset { border: 0; padding: 0; margin: 14px 0 6px; }
legend { font-family: var(--font-head); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; color: var(--accent); padding: 0; margin-bottom: 8px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .fields { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .84rem; font-weight: 700; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field small { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea { font: inherit; font-weight: 400; font-size: 1rem; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); width: 100%; min-width: 0; transition: border-color var(--ease), box-shadow var(--ease); }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.field input:disabled { opacity: .6; }
.money-in { position: relative; display: block; }
.money-in i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); }
.money-in i + input { padding-left: 24px; }
.req { color: var(--bad-ink); }
.form-error { color: var(--bad-ink); font-weight: 700; margin: 12px 0 0; }
.dialog { position: absolute; left: 50%; top: 50%; width: min(440px, calc(100vw - 32px)); transform: translate(-50%, -46%); opacity: 0; background: var(--panel); border-radius: 14px; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); transition: transform var(--ease), opacity var(--ease); }
.panel-wrap.open .dialog { transform: translate(-50%, -50%); opacity: 1; }
.dialog h2 { margin: 0 0 8px; } .dialog footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; max-height: 50vh; overflow: auto; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: .92rem; z-index: 200; pointer-events: none; transition: opacity var(--ease), transform var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); } .toast.bad { background: var(--bad-ink); color: #fff; }

/* ---------- signed-out pages ---------- */
body.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.gate-card { width: 100%; max-width: 430px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 26px 24px 22px; }
.gate-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.gate-brand img { border-radius: 10px; }
.gate-card h1 { font-size: 1.35rem; margin-bottom: 10px; }
.gate-note { color: var(--muted); font-size: .92rem; margin: 0 0 14px; }
.gate-form { display: grid; gap: 12px; }
.gate-form label { display: flex; flex-direction: column; gap: 4px; font-size: .84rem; font-weight: 700; }
.gate-form input { font: inherit; font-weight: 400; padding: 10px 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); width: 100%; transition: border-color var(--ease), box-shadow var(--ease); }
.gate-form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.gate-form .btn { margin-top: 4px; }
.gate-alt { margin: 14px 0 0; font-size: .9rem; color: var(--muted); }
.pw { position: relative; display: block; }
.pw input { padding-right: 64px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--brand); font-family: var(--font-head); font-size: .74rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 380px) { .two { grid-template-columns: 1fr; } }

@media print {
  .side, .top, .actions, .side-scrim, .btn { display: none !important; }
  body.app { display: block; } main { padding: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; } }
