:root {
  --wall: #E6ECE3;      /* whitewashed coop green */
  --surface: #FAFBF7;
  --ink: #2B2118;       /* kraal brown */
  --muted: #6E6457;
  --line: #D3DBCF;
  --yolk: #F2A900;
  --yolk-deep: #A86F00;
  --yolk-soft: #FFF1C7;
  --shell: #F3E6CF;
  --shell-edge: #DCC7A3;
  --comb: #B3261E;
  --comb-soft: #F8E1DE;
  --leaf: #355E45;
  --display: "Bricolage Grotesque", ui-rounded, -apple-system, system-ui, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--wall); color: var(--ink); font: 16px/1.45 var(--body); }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--yolk-deep); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.1; margin: 0; }
p { margin: 0; }

#app { max-width: 560px; margin: 0 auto; padding: calc(var(--safe-t) + 12px) 18px calc(var(--safe-b) + 96px); }

/* top bar */
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 6px 2px 14px; }
.topbar h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.sub { color: var(--muted); font-size: 15px; margin-top: 2px; }
.who { border: 0; background: var(--surface); border-radius: 999px; padding: 8px 14px 8px 8px; display: inline-flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; box-shadow: inset 0 0 0 1px var(--line); white-space: nowrap; }
.who .dot { width: 26px; height: 26px; border-radius: 50%; background: var(--leaf); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.who .pending { color: var(--yolk-deep); font-weight: 700; }

/* bottom tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(6, 1fr);
  background: rgba(250, 251, 247, 0.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px 4px calc(var(--safe-b) + 6px); }
.tabs a { display: grid; justify-items: center; gap: 2px; padding: 6px 0; color: var(--muted); text-decoration: none; font-size: 11.5px; font-weight: 600; }
.tabs svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--ink); }
.tabs a[aria-current="page"] svg { stroke: var(--ink); fill: var(--yolk); }
.tabs a[data-tab="eggs"][aria-current="page"] svg, .tabs a[data-tab="money"][aria-current="page"] svg { fill: none; stroke-width: 2.4; }

/* blocks */
.block { background: var(--surface); border-radius: 22px; padding: 18px; margin-bottom: 14px; }
.block > h2 { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.block-head h2 { font-size: 20px; font-weight: 700; }
.link { background: none; border: 0; color: var(--leaf); font-weight: 650; padding: 4px 0; font-size: 15px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.empty { color: var(--muted); padding: 6px 0 2px; }

/* the egg tray (signature) */
.tray-card { background: var(--leaf); color: #fff; border-radius: 26px; padding: 18px 18px 16px; margin-bottom: 14px; }
.tray-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.tray-count { font-family: var(--display); font-weight: 800; font-size: 64px; line-height: 0.9; letter-spacing: -0.03em; }
.tray-count small { font-size: 20px; font-weight: 600; letter-spacing: 0; margin-left: 6px; opacity: 0.85; }
.tray-meta { text-align: right; font-size: 14px; opacity: 0.9; line-height: 1.35; }
.tray-meta strong { display: block; font-family: var(--display); font-size: 22px; opacity: 1; }
.tray { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; background: #E4D6BA; padding: 10px; border-radius: 16px;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.35), inset 0 -3px 0 rgba(0,0,0,0.08); }
.cup { aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 60%, #CDBB97 0 55%, #D8C8A6 70%); display: grid; place-items: center; }
.egg { width: 64%; height: 80%; border-radius: 50% 50% 48% 48% / 60% 60% 42% 42%; background: radial-gradient(circle at 35% 30%, #fff 0 8%, #F6ECDA 30%, #E9D3AE 100%); box-shadow: 0 2px 0 rgba(0,0,0,0.12); }
.egg.draft { background: radial-gradient(circle at 35% 30%, #fff8d9 0 8%, #FFD45C 40%, #F2A900 100%); animation: pop 220ms ease-out; }
@keyframes pop { from { transform: scale(0.4); } to { transform: scale(1); } }
.tray-extra { margin-top: 8px; font-size: 14px; opacity: 0.9; }
.tray-controls { display: grid; grid-template-columns: 56px 1fr 1fr; gap: 10px; margin-top: 14px; }
.tray-controls button { border: 0; border-radius: 16px; min-height: 54px; font-weight: 700; font-size: 18px; }
.btn-ghost-light { background: rgba(255,255,255,0.14); color: #fff; }
.btn-yolk { background: var(--yolk); color: var(--ink); }
.tray-save { margin-top: 10px; width: 100%; border: 0; border-radius: 16px; min-height: 54px; font-weight: 750; font-size: 17px; background: #fff; color: var(--leaf); }
.tray-save[disabled] { opacity: 0.45; }
@media (prefers-reduced-motion: reduce) { .egg.draft { animation: none; } .panel { transition: none !important; } }

/* figures row */
.figs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.fig { background: var(--surface); border-radius: 18px; padding: 12px 12px 10px; }
.fig b { display: block; font-family: var(--display); font-size: 24px; font-weight: 800; line-height: 1.1; }
.fig span { font-size: 13px; color: var(--muted); }

/* alerts */
.alert { border-radius: 18px; padding: 14px 16px; margin-bottom: 14px; background: var(--comb-soft); border-left: 6px solid var(--comb); }
.alert h3 { font-size: 18px; color: var(--comb); margin-bottom: 4px; }
.alert .row-actions { margin-top: 10px; }
.alert.hold { background: var(--yolk-soft); border-left-color: var(--yolk-deep); }
.alert.hold h3 { color: var(--yolk-deep); }

/* actions */
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.action { border: 0; background: var(--surface); border-radius: 18px; padding: 14px; text-align: left; font-weight: 650; display: flex; align-items: center; gap: 10px; min-height: 60px; }
.action i { width: 34px; height: 34px; border-radius: 11px; background: var(--yolk-soft); display: grid; place-items: center; font-style: normal; font-size: 18px; flex: none; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list li button.rowbtn { all: unset; display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; cursor: pointer; }
.list .t { font-weight: 600; }
.list .d { font-size: 14px; color: var(--muted); }
.list .v { font-family: var(--display); font-weight: 700; font-size: 18px; white-space: nowrap; text-align: right; }
.list .v.neg { color: var(--comb); }
.list .v.pos { color: var(--leaf); }
.day-head { font-size: 14px; font-weight: 700; color: var(--muted); padding: 14px 0 2px; }

/* segmented */
.seg { display: flex; background: var(--line); border-radius: 14px; padding: 3px; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: none; border-radius: 11px; padding: 9px 4px; font-weight: 650; font-size: 14.5px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(43,33,24,0.12); }

/* month switch */
.month { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.month h2 { font-size: 22px; }
.month button { border: 0; background: var(--surface); width: 42px; height: 42px; border-radius: 50%; font-size: 20px; }
.sum { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; }
.sum div b { display: block; font-family: var(--display); font-size: 26px; font-weight: 800; line-height: 1.1; }
.sum div span { font-size: 13.5px; color: var(--muted); }

/* chart */
.chart { width: 100%; height: 150px; display: block; }
.chart .bar { fill: var(--yolk); }
.chart .bar.today { fill: var(--leaf); }
.chart .axis { stroke: var(--line); }
.chart text { font: 11px var(--body); fill: var(--muted); }

/* hatch timeline */
.batch { padding: 14px 0; border-top: 1px solid var(--line); }
.batch:first-of-type { border-top: 0; padding-top: 4px; }
.batch h3 { font-size: 19px; }
.track { position: relative; height: 10px; background: var(--line); border-radius: 99px; margin: 26px 0 26px; }
.track .fill { position: absolute; inset: 0 auto 0 0; background: var(--yolk); border-radius: 99px; }
.track .mark { position: absolute; top: -5px; width: 2px; height: 20px; background: var(--ink); opacity: 0.35; }
.track .mark span { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); font-size: 11.5px; white-space: nowrap; color: var(--muted); }
.track .mark.done { opacity: 0.9; }
.track .mark.end span { left: auto; right: 4px; transform: none; }
.track .mark.top span { top: -20px; }
.next { font-weight: 650; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 0; background: var(--wall); border-radius: 999px; padding: 9px 14px; font-weight: 600; font-size: 14.5px; }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; }
.rate { display: inline-block; min-width: 46px; text-align: right; }

/* sheet */
.sheet { position: fixed; inset: 0; z-index: 50; }
.scrim { position: absolute; inset: 0; background: rgba(43,33,24,0.38); }
.panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow: auto; background: var(--surface); border-radius: 26px 26px 0 0;
  padding: 8px 18px calc(var(--safe-b) + 18px); transform: translateY(100%); transition: transform 240ms cubic-bezier(.2,.8,.2,1); max-width: 560px; margin: 0 auto; }
.sheet.open .panel { transform: none; }
.grip { width: 44px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 12px; }
.panel h2 { font-size: 24px; font-weight: 800; margin-bottom: 14px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 14px; font-weight: 650; color: var(--muted); }
.field input, .field select, .field textarea { width: 100%; border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 13px 14px; font-size: 17px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--yolk-deep); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stepper { display: grid; grid-template-columns: 52px 1fr 52px; gap: 8px; align-items: center; }
.stepper button { height: 52px; border: 0; border-radius: 14px; background: var(--wall); font-size: 22px; font-weight: 700; }
.stepper input { text-align: center; font-family: var(--display); font-weight: 700; font-size: 22px; }
.total-line { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 2px 16px; }
.total-line b { font-family: var(--display); font-size: 30px; }
.btn { width: 100%; border: 0; border-radius: 16px; min-height: 54px; font-weight: 750; font-size: 17px; background: var(--yolk); color: var(--ink); }
.btn.secondary { background: var(--wall); }
.btn.danger { background: none; color: var(--comb); min-height: 46px; margin-top: 6px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.row-actions .chip { background: #fff; }
.hint { font-size: 13.5px; color: var(--muted); margin-top: -6px; margin-bottom: 14px; }

/* user picker */
.pick { display: grid; gap: 10px; }
.pick button { border: 0; border-radius: 18px; padding: 18px; font-size: 20px; font-weight: 700; background: var(--wall); text-align: left; display: flex; align-items: center; gap: 12px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 86px); transform: translate(-50%, 20px); opacity: 0; transition: all 200ms ease; background: var(--ink); color: #fff;
  padding: 11px 18px; border-radius: 999px; font-weight: 600; font-size: 15px; z-index: 60; pointer-events: none; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; margin: -4px 0 14px; }
.check input { width: 22px; height: 22px; accent-color: var(--leaf); }
.list li > .chip { flex: none; margin-left: 10px; }
.ptable { width: 100%; border-collapse: collapse; font-size: 15px; }
.ptable th { text-align: left; font-weight: 500; padding: 8px 0; }
.ptable td { text-align: right; padding: 8px 0 8px 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ptable thead td { font-size: 13px; color: var(--muted); font-weight: 600; }
.ptable tbody tr + tr { border-top: 1px solid var(--line); }
.ptable tr.tot th, .ptable tr.tot td { font-weight: 800; font-family: var(--display); font-size: 17px; }
.chart text { font-size: 10px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.gear[hidden] { display: none; }
.gear { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(43,33,24,0.08); }
.gear svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sub-h { font-size: 15px; font-weight: 700; margin: 0 0 8px; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); }
.list li > span { min-width: 0; overflow-wrap: anywhere; }
