/* Ferma - styles. Phone first; the computer layout starts at 900px. */
:root {
  color-scheme: light;
  --bg: #f4f2ea;
  --card: #ffffff;
  --ink: #1b231e;
  --ink2: #56605a;
  --ink3: #838b85;
  --line: #e6e2d6;
  --pri: #2e6f40;
  --pri-d: #245732;
  --pri-soft: #e4efe6;
  --good: #1c7c36;
  --danger: #c5362c;
  --c-milk: #2a78d6;
  --c-sick: #e34948;
  --c-breed: #c9408a;
  --c-birth: #6250d6;
  --c-vet: #12897b;
  --c-note: #7d8590;
  --c-bull: #8a5a3c;
  --c-feed: #c98500;
  --c-res: #4f9a1a;
  --c-egg: #e0782f;
  --c-dairy: #8e5bd0;
  --c-inc: #2a78d6;
  --c-exp: #eb6834;
  --due-bg: #fde8f2;
  --due-line: #e58abb;
  --radius: 16px;
  --tabs-h: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --shadow: 0 1px 2px rgba(30, 40, 30, .06), 0 2px 8px rgba(30, 40, 30, .05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.has-sheet { overflow: hidden; }
h1, h2, h3, p, dl, dd { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
a { color: var(--pri); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--pri) 55%, white); outline-offset: 2px; }

.ic { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Shell ---------- */
#side { display: none; }
#top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
#title { font-size: 26px; font-weight: 750; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view { padding: 4px 16px calc(var(--tabs-h) + var(--safe-b) + 28px); max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
body.has-fab #view { padding-bottom: calc(var(--tabs-h) + var(--safe-b) + 96px); }

#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: var(--card); border-top: 1px solid var(--line);
}
#tabs button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12.5px; font-weight: 600; color: var(--ink3); }
#tabs button .ic { width: 26px; height: 26px; }
#tabs button.on { color: var(--pri); }
#tabs button.on .ic { stroke-width: 2.4; }
[data-nav].dot::after { content: ""; position: absolute; top: 9px; left: calc(50% + 9px); width: 10px; height: 10px; border-radius: 50%; background: var(--c-exp); border: 2px solid var(--card); }

.fab {
  position: fixed; right: 16px; bottom: calc(var(--tabs-h) + var(--safe-b) + 16px); z-index: 25;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 56px; padding: 0 22px 0 18px; border-radius: 28px;
  background: var(--pri); color: #fff; font-weight: 700; font-size: 17px;
  box-shadow: 0 6px 18px rgba(46, 111, 64, .38);
}
.fab:active { background: var(--pri-d); transform: scale(.98); }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + var(--safe-b) + 84px); z-index: 90;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  background: #1f2a23; color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 16px;
  width: max-content; max-width: min(92vw, 460px); text-align: center; transition: opacity .18s, transform .18s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#tip { position: fixed; z-index: 95; display: none; background: #1f2a23; color: #fff; font-size: 14px; line-height: 1.35; padding: 8px 11px; border-radius: 10px; white-space: pre-line; pointer-events: none; max-width: 240px; }
#tip.show { display: block; }

/* ---------- Common pieces ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card-title { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.card-title .ic { color: var(--pri); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head .card-title { margin: 0; }
.muted { color: var(--ink2); }
.small { font-size: 15px; }
.pad { padding: 6px 2px; }
p.small .ic, p.pad .ic { width: 18px; height: 18px; vertical-align: -3px; }
.red-t { color: var(--danger); }
.blue-t { color: #1c5cab; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 18px; border-radius: 14px;
  background: var(--card); border: 1.5px solid var(--line); font-weight: 650; color: var(--ink);
}
.btn:active { background: #f1efe7; }
.btn.primary { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn.primary:active { background: var(--pri-d); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-ghost { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, white); }
.btn.small { min-height: 40px; padding: 0 12px; font-size: 15px; border-radius: 12px; }
.btn.small .ic { width: 19px; height: 19px; }
.btn.big { min-height: 60px; font-size: 20px; width: 100%; }
.btn.grow { flex: 1; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { padding: 0 12px; }
.btn-col { display: flex; flex-direction: column; gap: 10px; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; color: var(--ink); flex: none; }
.iconbtn:active { background: rgba(0, 0, 0, .07); }
.iconbtn.add { color: var(--pri); background: var(--pri-soft); width: 38px; height: 38px; margin-left: auto; }

.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 13.5px; font-weight: 650; background: var(--pri); color: #fff; white-space: nowrap; }
.badge.soft { background: var(--pri-soft); color: var(--pri-d); }
.badge.gray { background: #ecebe6; color: var(--ink2); }
.badge.pink { background: #fbe1ee; color: #96215f; }
.badge.red { background: #fde3e1; color: #a3231b; }
.badge.blue { background: #e0edfb; color: #184f95; }
.badge.warn { background: #fdecc8; color: #7a4d00; }

.rows { display: flex; flex-direction: column; margin: 0 -8px; }
.row { display: flex; align-items: center; gap: 12px; width: calc(100%); min-height: 60px; padding: 8px; border-radius: 12px; }
.row.done { opacity: .62; }
.row + .row { box-shadow: 0 -1px 0 var(--line); border-top-left-radius: 0; border-top-right-radius: 0; }
.row:active { background: #f4f2ea; }
.row-ic, .avatar { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 42px; height: 42px; border-radius: 12px; color: var(--c); background: color-mix(in srgb, var(--c) 13%, white); }
.avatar { border-radius: 50%; }
.avatar.big { width: 64px; height: 64px; }
.avatar.big .ic { width: 36px; height: 36px; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-main b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; }
.row-main small { color: var(--ink2); font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; }
.row-main small.strong { color: var(--ink); font-weight: 600; }
.row-end { font-weight: 700; white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; font-variant-numeric: tabular-nums; }
.row-end.good { color: var(--good); }
.row-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row-chev { color: var(--ink3); width: 20px; height: 20px; }
.row-sub { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.rows-sep { padding: 12px 8px 4px; font-size: 14px; font-weight: 700; color: var(--ink2); text-transform: uppercase; letter-spacing: .04em; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stats.three > :nth-child(3) { grid-column: 1 / -1; }
.stat { position: relative; background: var(--card); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat small { color: var(--ink2); font-size: 14px; font-weight: 600; }
.stat b { font-size: 22px; font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; line-height: 1.2; }
.stat b em { font-style: normal; font-size: 15px; font-weight: 600; color: var(--ink2); }
.stat-edit { position: absolute; top: 10px; right: 10px; color: var(--ink3); }
.stat-edit .ic { width: 18px; height: 18px; }
.stat.todo b { color: var(--pri); font-size: 18px; }
.stat.red b { color: var(--danger); }
.stat.blue b { color: #1c5cab; }
.stat.profit { background: #e6f3e8; } .stat.profit b { color: #17642c; }
.stat.loss { background: #fde8e6; } .stat.loss b { color: #a3231b; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; padding: 48px 20px; color: var(--ink2); }
.empty > .ic { width: 64px; height: 64px; stroke-width: 1.4; color: var(--pri); }
.empty p { max-width: 34ch; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.pnav { display: flex; align-items: center; gap: 2px; min-width: 0; }
.pnav b { font-size: 18px; font-weight: 700; padding: 0 4px; min-width: 9.5ch; text-align: center; }
.pnav .iconbtn { background: var(--card); box-shadow: var(--shadow); }
.pnav .btn.small { margin-left: 8px; }

.seg { display: inline-flex; background: #e9e6db; border-radius: 13px; padding: 3px; gap: 2px; max-width: 100%; }
.seg button { flex: 1; min-height: 40px; padding: 4px 14px; border-radius: 10px; font-weight: 650; font-size: 15.5px; color: var(--ink2); text-align: center; line-height: 1.15; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 13px; border-radius: 999px; background: transparent; border: 1.5px solid var(--line); font-size: 15px; font-weight: 600; color: var(--ink3); white-space: nowrap; }
.chip i { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--c); }
.chip.on { background: var(--card); color: var(--ink); border-color: transparent; box-shadow: var(--shadow); }
.chip.on i { background: var(--c); }

.two-col { display: grid; gap: 14px; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 10px; row-gap: 4px; font-size: 15.5px; }
.hbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar b { font-variant-numeric: tabular-nums; }
.hbar b { grid-row: 1; grid-column: 2; }
.hbar-track { grid-row: 2; grid-column: 1 / -1; height: 8px; border-radius: 4px; background: #efede5; overflow: hidden; }
.hbar-track i { display: block; height: 100%; border-radius: 4px; background: var(--c-milk); min-width: 0; }

.facts { display: flex; flex-direction: column; }
.facts > div { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; }
.facts > div + div { border-top: 1px solid var(--line); }
.facts dt { color: var(--ink2); }
.facts dd { text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.facts + .btn { margin-top: 12px; width: 100%; }

.hero { display: flex; align-items: center; gap: 14px; }
.hero-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.hero-main h2 { font-size: 24px; overflow-wrap: anywhere; }
.hero .row-badges { flex-direction: row; flex-wrap: wrap; align-items: center; }

.notice { display: flex; gap: 12px; align-items: flex-start; }
.notice > .ic { margin-top: 2px; }
.notice > div { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.notice.pink { background: var(--due-bg); } .notice.pink > .ic { color: var(--c-breed); }
.notice.red { background: #fdeceb; } .notice.red > .ic { color: var(--c-sick); }
.notice-border { outline: 2px solid #f0c060; }
.hintcard { display: flex; gap: 12px; background: var(--pri-soft); }
.hintcard > .ic { color: var(--pri); margin-top: 2px; }
.hintcard > div { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

.qa-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); gap: 10px; }
.qa { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 14px; font-weight: 650; text-align: center; line-height: 1.2; }
.qa span { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; color: var(--c); background: color-mix(in srgb, var(--c) 13%, white); }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 10px; background: var(--card); border-radius: 20px; box-shadow: var(--shadow); font-size: 18px; }
.tile-ic { display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px; border-radius: 50%; background: var(--pri-soft); color: var(--pri); }
.tile-ic .ic { width: 34px; height: 34px; }
.tile .badge { position: absolute; top: 10px; right: 10px; }

.balance { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.balance > div { display: flex; flex-direction: column; }
.balance small { font-weight: 650; color: var(--ink2); }
.balance b { font-size: 32px; font-weight: 780; letter-spacing: -.02em; line-height: 1.15; }
.balance em { font-style: normal; color: var(--ink2); font-size: 15px; }
.balance.red { background: #fdeceb; } .balance.red b { color: #a3231b; }
.balance.blue { background: #e6f0fc; } .balance.blue b { color: #184f95; }
.balance.ok b { color: var(--good); } .balance.ok b .ic { width: 34px; height: 34px; stroke-width: 3; }

.meter { display: flex; gap: 2px; height: 12px; border-radius: 6px; background: #e9e6db; overflow: hidden; }
.meter i { display: block; height: 100%; }
.m-sold { background: var(--c-milk); }
.m-kept { background: var(--c-feed); }
.m-left { background: #d9d5c8; }
.meter-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 15px; color: var(--ink2); }
.meter-legend span { display: inline-flex; align-items: center; gap: 6px; }
.meter-legend i { width: 12px; height: 12px; border-radius: 3px; }
.meter-legend b { color: var(--ink); }

/* ---------- Calendar ---------- */
.cal-layout { display: grid; gap: 14px; }
.cal-card { padding: 10px 8px 12px; }
.cal-head { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 13.5px; font-weight: 700; color: var(--ink2); padding-bottom: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-cell { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 54px; padding: 5px 2px 8px; border-radius: 12px; min-width: 0; }
.cal-cell.out { opacity: .38; }
.cal-num { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; font-weight: 650; font-variant-numeric: tabular-nums; }
.cal-cell.today .cal-num { background: var(--pri); color: #fff; }
.cal-cell.sel { background: var(--pri-soft); box-shadow: inset 0 0 0 2px var(--pri); }
.cal-cell.due { background: var(--due-bg); }
.cal-cell.due.sel { box-shadow: inset 0 0 0 2px var(--c-breed); }
.cal-cell.due::after { content: ""; position: absolute; left: 4px; right: 4px; bottom: 3px; height: 3px; border-radius: 2px; background: var(--due-line); }
.cal-marks { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; min-height: 8px; max-width: 100%; }
.mk { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.mk .ic, .mk em { display: none; }
.cal-legend { display: flex; align-items: center; gap: 8px; padding: 10px 8px 0; font-size: 14px; color: var(--ink2); }
.cal-legend i { width: 26px; height: 12px; border-radius: 4px; background: var(--due-bg); border-bottom: 3px solid var(--due-line); }
.day-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.day-head small { color: var(--pri); font-weight: 700; font-size: 14px; }
.day-head h3 { font-size: 19px; }
.week { display: grid; gap: 10px; }
.week-day { padding: 10px 14px; }
.week-day.today { box-shadow: inset 0 0 0 2px var(--pri), var(--shadow); }
.week-head { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.week-head b { font-size: 18px; }
.due-strip { display: flex; align-items: center; gap: 8px; margin: 4px 8px; padding: 7px 10px; border-radius: 10px; background: var(--due-bg); border-bottom: 3px solid var(--due-line); font-size: 14.5px; font-weight: 600; color: #7d2a55; min-width: 0; }
.due-strip .ic { width: 18px; height: 18px; color: var(--c-breed); }
.due-strip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Milk ---------- */
.milk-nums { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.milk-nums div { display: flex; flex-direction: column; }
.milk-nums small { color: var(--ink2); font-weight: 600; font-size: 15px; }
.milk-nums b { font-size: 34px; font-weight: 780; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.shelf { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 5px; margin: 14px 0 12px; padding: 14px 12px 10px; border-radius: 14px; background: linear-gradient(#e8f1fb, #dce9f8); border-bottom: 6px solid #b9a37f; min-height: 86px; }
.bottle { width: 26px; height: 58px; }
.b-glass { fill: rgba(255, 255, 255, .45); }
.b-milk { fill: #ffffff; }
.b-line { fill: none; stroke: #3d6ea5; stroke-width: 2.4; stroke-linejoin: round; }
.b-cap { fill: var(--c-milk); }
.shelf-more { align-self: center; margin-left: 6px; font-size: 20px; font-weight: 750; color: #2d5d93; }
.milk-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink2); }
.milk-foot b { color: var(--ink); }

/* ---------- Chart ---------- */
.chart { --axis-w: 38px; }
.chart-legend { display: flex; gap: 16px; margin-bottom: 8px; font-size: 14.5px; color: var(--ink2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 12px; height: 12px; border-radius: 3px; }
.chart-plot { position: relative; height: 170px; margin: 8px 0 0 var(--axis-w); }
.chart-grid { position: absolute; inset: 0; }
.chart-tick { position: absolute; left: 0; right: 0; border-top: 1px solid #ece9df; }
.chart-tick:first-child { border-top-color: #cfcbbd; }
.chart-tick span { position: absolute; right: 100%; top: -9px; margin-right: 6px; font-size: 12.5px; color: var(--ink3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-cols { position: absolute; inset: 0; display: flex; }
.chart-col { flex: 1; min-width: 0; display: flex; justify-content: center; align-items: flex-end; border-radius: 6px 6px 0 0; outline-offset: -2px; }
.chart-col:hover, .chart-col:focus-visible { background: rgba(0, 0, 0, .045); }
.chart-bars { display: flex; align-items: flex-end; justify-content: center; gap: 2px; width: 100%; height: 100%; padding: 0 12%; }
.chart-bars i { display: block; flex: 1; max-width: 24px; min-width: 2px; border-radius: 4px 4px 0 0; }
.chart-x { display: flex; margin-left: var(--axis-w); padding-top: 5px; }
.chart-x span { flex: 1; min-width: 0; text-align: center; font-size: 12.5px; color: var(--ink3); white-space: nowrap; }
.chart-col.hl { background: rgba(42, 120, 214, .08); }

/* ---------- Sheets and forms ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20, 28, 22, .5); opacity: 0; transition: opacity .2s; }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 94dvh; display: flex; flex-direction: column; background: var(--bg); border-radius: 22px 22px 0 0; transform: translateY(100%); transition: transform .22s cubic-bezier(.2, .8, .3, 1); box-shadow: 0 -8px 30px rgba(0, 0, 0, .2); }
.sheet-wrap.open .sheet { transform: none; }
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.noanim .sheet, .sheet-wrap.noanim .sheet-backdrop { transition: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 12px 8px 20px; }
.sheet-head h2 { font-size: 22px; font-weight: 750; }
.sheet-body { overflow-y: auto; padding: 4px 20px calc(20px + var(--safe-b)); overscroll-behavior: contain; }

.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.flabel { font-weight: 650; font-size: 16px; }
.req { color: var(--danger); }
.fhint { font-size: 14.5px; color: var(--ink2); }
.inp { width: 100%; min-height: 54px; padding: 12px 14px; border-radius: 14px; border: 1.5px solid #d4d0c2; background: var(--card); font-size: 18px; appearance: none; -webkit-appearance: none; }
.inp:focus { outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pri) 22%, transparent); }
select.inp { padding-right: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2356605a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 22px; }
textarea.inp { min-height: 72px; resize: vertical; }
input[type="date"].inp { min-width: 0; }
.newperson { margin-top: 8px; }
.inp-wrap { position: relative; }
.inp-wrap .inp { padding-right: 64px; font-variant-numeric: tabular-nums; }
.suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink2); font-weight: 650; pointer-events: none; }
.field.err .inp, .field.err .seg { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(197, 54, 44, .18); }
.field.err .flabel { color: var(--danger); }
.field .seg { display: flex; }
.field .seg button { min-height: 48px; font-size: 16.5px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 58px; height: 54px; flex: none; border-radius: 14px; background: var(--card); border: 1.5px solid #d4d0c2; font-size: 28px; font-weight: 600; text-align: center; color: var(--pri); line-height: 1; }
.stepper button:active { background: var(--pri-soft); }
.stepper .inp { text-align: center; font-size: 22px; font-weight: 700; min-width: 0; flex: 1; }
.stepper-unit { font-weight: 650; color: var(--ink2); padding: 0 4px; }
.toggle { display: flex; align-items: center; gap: 12px; min-height: 48px; font-weight: 650; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle-ui { position: relative; flex: none; width: 54px; height: 32px; border-radius: 16px; background: #cfcbbd; transition: background .15s; }
.toggle-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.toggle input:checked + .toggle-ui { background: var(--pri); }
.toggle input:checked + .toggle-ui::after { transform: translateX(22px); }
.toggle input:focus-visible + .toggle-ui { outline: 3px solid color-mix(in srgb, var(--pri) 55%, white); outline-offset: 2px; }
.finfo:empty { display: none; }
.field:has(> .finfo:empty) { display: none; }
.pill-info { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: #e3eefb; color: #184f95; font-weight: 650; font-size: 15.5px; }
.pill-info .ic { width: 20px; height: 20px; }
.pill-info.bad { background: #fbe5e3; color: #a3271f; }
.duebox { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 14px; background: var(--due-bg); border: 1.5px solid var(--due-line); }
.duebox .ic { color: var(--c-breed); width: 30px; height: 30px; }
.duebox div { display: flex; flex-direction: column; }
.duebox small { color: #7d2a55; font-size: 14.5px; }
.duebox b { font-size: 20px; }
.totalbox { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 14px; border-radius: 14px; background: var(--pri-soft); }
.totalbox b { font-size: 24px; font-weight: 780; font-variant-numeric: tabular-nums; }
.calcbox { display: flex; flex-direction: column; border-radius: 14px; background: var(--card); border: 1.5px solid var(--line); padding: 4px 14px; }
.calcbox > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; }
.calcbox > div + div { border-top: 1px solid var(--line); }
.calcbox span { color: var(--ink2); }
.calcbox .strong b { font-size: 24px; font-weight: 780; color: var(--pri-d); }
.form-actions { display: flex; gap: 10px; padding-top: 6px; position: sticky; bottom: calc(-20px - var(--safe-b)); background: linear-gradient(transparent, var(--bg) 26%); padding-bottom: calc(20px + var(--safe-b)); margin-bottom: calc(-20px - var(--safe-b)); }
.form-actions:empty { display: none; }
.form-actions .btn { min-height: 56px; font-size: 18px; }

.chooser { display: flex; flex-direction: column; gap: 10px; }
.choice { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 12px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); min-height: 72px; }
.choice:active { background: #f1efe7; }
.choice-ic { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 50px; height: 50px; border-radius: 50%; color: var(--c); background: color-mix(in srgb, var(--c) 14%, white); }
.choice-ic .ic { width: 28px; height: 28px; }
.choice-txt { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.choice-txt b { font-size: 18px; }
.choice-txt small { color: var(--ink2); font-size: 14.5px; }
.choice > .ic { color: var(--ink3); }

.confirm-wrap { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(20, 28, 22, .55); }
.confirm { width: 100%; max-width: 400px; background: var(--card); border-radius: 20px; padding: 22px; display: flex; flex-direction: column; gap: 18px; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); }
.confirm p { font-size: 18px; font-weight: 600; }
.confirm-btns { display: flex; gap: 10px; }
.confirm-btns .btn { flex: 1; }

.welcome { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.welcome-box { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.welcome-box h1 { font-size: 36px; }
.welcome-box p { color: var(--ink2); margin-bottom: 8px; }
.welcome-box img { border-radius: 22px; }

/* ---------- Computer layout ---------- */
@media (min-width: 900px) {
  #app { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
  #side { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; padding: 20px 14px; background: var(--card); border-right: 1px solid var(--line); overflow-y: auto; }
  .brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
  .brand img { border-radius: 12px; }
  .brand div { display: flex; flex-direction: column; line-height: 1.2; }
  .brand b { font-size: 22px; }
  .brand small { color: var(--ink2); font-size: 14px; }
  #side-nav { display: flex; flex-direction: column; gap: 4px; }
  #side-nav button { position: relative; display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 14px; border-radius: 12px; font-weight: 650; color: var(--ink2); }
  #side-nav button:hover { background: #f4f2ea; }
  #side-nav button.on { background: var(--pri-soft); color: var(--pri-d); }
  #side-nav [data-nav].dot::after { top: 19px; left: auto; right: 14px; }
  #tabs { display: none; }
  #top { padding: 22px 32px 12px; }
  #title { font-size: 30px; }
  #view, body.has-fab #view { padding: 4px 32px 110px; margin: 0; }
  .mobile-only { display: none !important; }
  .fab { right: 32px; bottom: 28px; }
  #toast { bottom: 36px; }
  .btn:hover { border-color: #cdc9bb; }
  .btn.primary:hover, .fab:hover { background: var(--pri-d); border-color: var(--pri-d); }
  .row:hover, .choice:hover { background: #f7f5ee; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .stats.three { grid-template-columns: repeat(3, 1fr); }
  .stats.three > :nth-child(3) { grid-column: auto; }
  .stats .stat b { font-size: 26px; }
  .two-col { grid-template-columns: 1fr 1fr; align-items: start; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .hero, .notice, .balance, .qa-grid, .btn-row { max-width: 720px; }
  .btn-col { flex-direction: row; flex-wrap: wrap; }

  .cal-layout { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .cal-card { padding: 14px; }
  .cal-grid { gap: 5px; }
  .cal-cell { align-items: stretch; min-height: 98px; padding: 6px; border: 1px solid var(--line); }
  .cal-cell:hover { border-color: var(--pri); }
  .cal-num { width: 28px; height: 28px; font-size: 15.5px; }
  .cal-marks { flex-direction: column; flex-wrap: nowrap; justify-content: flex-start; gap: 3px; }
  .mk { display: flex; align-items: center; gap: 4px; width: auto; height: auto; padding: 2px 5px; border-radius: 6px; background: color-mix(in srgb, var(--c) 14%, white); min-width: 0; }
  .mk .ic { display: block; width: 13px; height: 13px; color: var(--c); stroke-width: 2.4; }
  .mk em { display: block; font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); align-items: start; }
  .week-day { padding: 8px 10px; min-height: 180px; }
  .week .row { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: start; min-height: 0; gap: 2px 8px; }
  .week .row-ic { width: 30px; height: 30px; border-radius: 9px; grid-row: 1 / span 2; }
  .week .row-ic .ic { width: 18px; height: 18px; }
  .week .row-chev { display: none; }
  .week .row-main { grid-column: 2; }
  .week .row-main b, .week .row-main small { font-size: 14px; white-space: normal; overflow-wrap: anywhere; }
  .week .row-end { grid-column: 2; align-items: flex-start; font-size: 14.5px; }
  .week .week-head .badge { display: none; }
  .week .week-head b { font-size: 16px; white-space: nowrap; }
  .week .due-strip { margin: 4px 0; }

  .sheet-wrap { align-items: center; padding: 24px; }
  .sheet { border-radius: 22px; max-height: 90vh; transform: translateY(24px); opacity: 0; transition: transform .18s, opacity .18s; }
  .sheet-wrap.open .sheet { opacity: 1; }
  .bottle { width: 30px; height: 67px; }
  .chart-plot { height: 210px; }
}

@media (max-width: 380px) {
  body { font-size: 16px; }
  #view { padding-left: 12px; padding-right: 12px; }
  .stat b { font-size: 20px; }
  .seg button { padding: 4px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
.btn.wide { width: 100%; justify-content: center; }
.res-sum { margin: -4px 0 6px; }

/* ---------- Chat tab (js/chat.js) ---------- */
:root { --chatbar-h: 76px; }
body.chat-on #view { padding-bottom: calc(var(--tabs-h) + var(--safe-b) + var(--chatbar-h) + 24px); }
.chat { display: flex; flex-direction: column; gap: 10px; }
.chat-status { display: flex; align-items: center; justify-content: space-between; margin-top: -6px; }
.chat-status .iconbtn { color: var(--ink3); }
.chat-log { display: flex; flex-direction: column; gap: 10px; }

.chat-hello { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 28px 8px 8px; }
.chat-hello-ic { display: inline-flex; align-items: center; justify-content: center; width: 84px; height: 84px; border-radius: 50%; background: var(--pri-soft); color: var(--pri); }
.chat-hello-ic .ic { width: 42px; height: 42px; }
.chat-hello h2 { font-size: 24px; font-weight: 750; }
.chat-hello p { color: var(--ink2); max-width: 420px; }
.chat-examples { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 420px; margin-top: 8px; }
.chat-examples .chip { justify-content: center; white-space: normal; min-height: 48px; color: var(--ink); background: var(--card); border-color: transparent; box-shadow: var(--shadow); font-size: 16px; }

.msg { max-width: min(86%, 560px); padding: 11px 15px; border-radius: 20px; line-height: 1.4; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--pri); color: #fff; border-bottom-right-radius: 6px; }
.msg.me.voice { display: inline-flex; gap: 8px; align-items: flex-start; }
.msg.me.voice .ic { width: 20px; height: 20px; margin-top: 1px; }
.msg.bot { align-self: flex-start; display: flex; gap: 6px; align-items: flex-start; background: var(--card); box-shadow: var(--shadow); border-bottom-left-radius: 6px; }
.msg.bot .speak { width: 36px; height: 36px; margin: -6px -8px -6px 0; color: var(--pri); }
.msg.err { align-self: flex-start; display: flex; gap: 10px; background: #fde3e1; color: #7d1d16; border-bottom-left-radius: 6px; }
.msg.err > div { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.msg.err code { font-size: 12.5px; opacity: .8; word-break: break-all; }
.msg.waiting { display: inline-flex; gap: 5px; padding: 16px 18px; }
.msg.waiting i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink3); animation: chat-dot 1s infinite ease-in-out; }
.msg.waiting i:nth-child(2) { animation-delay: .15s; }
.msg.waiting i:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

.confirm-card { align-self: flex-start; width: min(100%, 560px); background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; border-left: 5px solid var(--pri); display: flex; flex-direction: column; gap: 10px; }
.confirm-card h3 { font-size: 16px; font-weight: 700; color: var(--ink2); }
.confirm-card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.confirm-card li { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 600; }
.confirm-card li.warn { color: #7a4d00; }
.act-ic { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 40px; height: 40px; border-radius: 50%; color: var(--c); background: color-mix(in srgb, var(--c) 14%, white); }
.act-ic .ic { width: 22px; height: 22px; }
.confirm-card .unclear { display: flex; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #fdecc8; color: #5c3a00; }
.confirm-card .unclear p { font-size: 16px; }
.confirm-card .confirm-btns { display: flex; gap: 10px; }
.confirm-card .confirm-btns .btn.primary { font-size: 18px; min-height: 56px; }
.confirm-card.saved { border-left-color: var(--good); }
.confirm-card.saved h3 { color: var(--good); }
.confirm-card.cancelled { border-left-color: var(--line); opacity: .65; }
.confirm-card.info { border-left-color: #e0a800; }
details.raw { align-self: stretch; font-size: 13px; color: var(--ink2); }
details.raw pre { white-space: pre-wrap; word-break: break-all; background: #ecebe6; padding: 10px; border-radius: 10px; margin: 6px 0 0; max-height: 280px; overflow: auto; }

.chat-bar {
  position: fixed; left: 0; right: 0; z-index: 26;
  bottom: calc(var(--tabs-h) + var(--safe-b));
  display: flex; align-items: flex-end; gap: 10px;
  padding: 10px 12px; background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--line);
}
.chat-bar .inp { flex: 1; min-height: 56px; max-height: 140px; resize: none; border-radius: 28px; padding: 15px 18px; line-height: 1.35; }
.mic-btn { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 56px; height: 56px; border-radius: 50%; background: var(--pri); color: #fff; box-shadow: 0 4px 14px rgba(46, 111, 64, .35); }
.mic-btn .ic { width: 28px; height: 28px; }
.mic-btn:active { background: var(--pri-d); transform: scale(.96); }
.mic-btn:disabled { opacity: .45; }
.mic-btn.on { background: var(--danger); box-shadow: 0 0 0 0 rgba(197, 54, 44, .5); animation: chat-pulse 1.4s infinite; }
@keyframes chat-pulse { 0% { box-shadow: 0 0 0 0 rgba(197, 54, 44, .45); } 70% { box-shadow: 0 0 0 16px rgba(197, 54, 44, 0); } 100% { box-shadow: 0 0 0 0 rgba(197, 54, 44, 0); } }
.chat-bar.recording { align-items: center; }
body.chat-on #toast { bottom: calc(var(--tabs-h) + var(--safe-b) + var(--chatbar-h) + 16px); }
.rec-info { flex: 1; display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 18px; }
.rec-info b { margin-left: auto; font-variant-numeric: tabular-nums; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: chat-dot 1s infinite; }

@media (min-width: 900px) {
  body.chat-on #view { padding-bottom: calc(var(--chatbar-h) + 32px); }
  .chat-bar { left: 250px; bottom: 0; padding: 12px 32px; }
  .chat-input-row, .chat-sugs { max-width: 1044px; }
  body.chat-on #toast { bottom: calc(var(--chatbar-h) + 24px); }
}

/* ---------- Today / home (js/today.js) ---------- */
.today-date { color: var(--ink2); font-size: 17px; font-weight: 600; margin-top: -8px; }
.talk-cta { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--radius); background: var(--pri); color: #fff; box-shadow: 0 6px 18px rgba(46, 111, 64, .3); }
.talk-cta > span:not(.talk-cta-ic) { flex: 1; display: flex; flex-direction: column; }
.talk-cta b { font-size: 20px; font-weight: 750; }
.talk-cta small { font-size: 15px; opacity: .85; }
.talk-cta-ic { display: inline-flex; align-items: center; justify-content: center; width: 54px; height: 54px; border-radius: 50%; background: rgba(255, 255, 255, .18); flex: none; }
.talk-cta-ic .ic { width: 30px; height: 30px; }
.talk-cta:active { background: var(--pri-d); }
.big-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.big-act { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-height: 120px; padding: 16px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.big-act b { font-size: 20px; font-weight: 750; }
.big-act small { margin-top: -6px; color: var(--ink2); font-size: 15px; font-weight: 600; }
.big-act-ic { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%; color: var(--c); background: color-mix(in srgb, var(--c) 14%, white); }
.big-act-ic .ic { width: 28px; height: 28px; }
.big-act:active { background: #f1efe7; transform: scale(.98); }
.link-btn { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 6px 4px; color: var(--pri-d); font-weight: 650; margin-top: -4px; }
.link-btn .ic { width: 20px; height: 20px; }
.all-good { display: flex; align-items: center; gap: 10px; color: var(--good); font-weight: 650; padding: 4px 0; }
@media (min-width: 900px) {
  .big-acts { grid-template-columns: repeat(4, 1fr); max-width: 980px; }
  .talk-cta { max-width: 980px; }
}

/* ---------- Short forms: "More details" fold (ui.js openForm) ---------- */
.more-toggle { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 50px; padding: 0 4px; color: var(--pri-d); font-weight: 650; border-top: 1px solid var(--line); }
.more-toggle small { flex: 1; text-align: right; color: var(--ink3); font-weight: 600; font-size: 15px; }
.more-toggle .ic { width: 20px; height: 20px; transition: transform .15s; }
.more-toggle[aria-expanded="true"] .ic { transform: rotate(90deg); }
.form-more { display: flex; flex-direction: column; gap: inherit; }

/* ---------- Produce tab (js/produce.js) ---------- */
.prod-tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.prod-tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 78px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); font-weight: 650; font-size: 15px; color: var(--ink2); border: 2px solid transparent; }
.prod-tabs button .ic { width: 28px; height: 28px; color: var(--c); }
.prod-tabs button.on { border-color: var(--c); color: var(--ink); background: color-mix(in srgb, var(--c) 8%, white); }
.produce-body { display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 900px) { .prod-tabs { max-width: 640px; } }

/* ---------- Talk in the middle of the phone tab bar ---------- */
#tabs button.tab-talk { color: var(--pri-d); }
#tabs button.tab-talk .ic { box-sizing: content-box; width: 30px; height: 30px; padding: 13px; margin-top: -30px; border-radius: 50%; background: var(--pri); color: #fff; border: 4px solid var(--card); box-shadow: 0 4px 14px rgba(46, 111, 64, .35); }
#tabs button.tab-talk.on .ic { background: var(--pri-d); stroke-width: 2.2; }

/* ---------- Chat suggestions ---------- */
.chat-sug-title { margin-top: 8px; font-weight: 650; color: var(--ink2) !important; }
.chat-examples .chip { justify-content: flex-start; text-align: left; padding: 10px 16px; }
.chat-bar:not(.recording) { flex-direction: column; align-items: stretch; gap: 8px; }
.chat-input-row { display: flex; align-items: flex-end; gap: 10px; width: 100%; }
.chat-sugs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px 2px; }
.chat-sugs::-webkit-scrollbar { display: none; }
.chat-sugs .chip { flex: none; color: var(--ink); background: var(--card); border-color: var(--line); font-size: 15px; }
@media (min-width: 900px) { .chat-sugs { margin: 0; padding: 0 0 2px; } }

/* phones: on the Talk screen the middle tab is the mic, so the composer's own mic is not needed */
@media (max-width: 899px) {
  body.chat-on .chat-bar [data-act="chat.rec"] { display: none; }
  body.chat-rec #tabs button.tab-talk .ic { background: var(--danger); animation: chat-pulse 1.4s infinite; }
}

/* ---------- Chat: editable card, day separators ---------- */
button.msg.me { text-align: left; cursor: pointer; }
button.msg.me:active { background: var(--pri-d); }
.confirm-card li { display: block; }
.confirm-card li > .act-ic { vertical-align: middle; }
.confirm-card li:not(:has(.act-line)) { display: flex; align-items: center; gap: 12px; }
.act-line { display: flex; align-items: center; gap: 12px; width: 100%; padding: 4px 6px; margin: -4px -6px; border-radius: 12px; font-size: 18px; font-weight: 600; text-align: left; color: inherit; }
.act-line:active { background: #f1efe7; }
.act-txt { flex: 1; }
.act-edit { width: 20px; height: 20px; color: var(--ink3); }
.confirm-card.replaced { border-left-color: var(--line); opacity: .55; }
.confirm-card.replaced li { text-decoration: line-through; }
.chat-day { display: flex; justify-content: center; margin: 6px 0 2px; }
.chat-day span { font-size: 13px; font-weight: 650; color: var(--ink2); background: #ecebe6; padding: 3px 12px; border-radius: 999px; }
@media (min-width: 900px) { .act-line:hover { background: #f7f5ee; } }

/* ---------- Add sheet: first a few choices, swipe up for all (ui.js openChooser peek) ---------- */
.chooser.peek .choice.extra { display: none; }
.chooser.opened .choice.extra { animation: choice-in .22s ease-out both; }
@keyframes choice-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.chooser-more { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; padding: 10px 0 4px; color: var(--ink2); font-weight: 650; font-size: 15px; }
.chooser-more .grip { width: 44px; height: 5px; border-radius: 3px; background: #cfcbbd; }
.chooser.opened .chooser-more { display: none; }

/* ---------- Calendar filter button, Sales "See all" ---------- */
.filter-btn.on { background: var(--pri-soft); border-color: transparent; color: var(--pri-d); }
.see-all { margin-top: 8px; }
.msg.bot.audio-only { padding: 6px; }
.msg.bot.audio-only .speak { margin: 0; }

/* Milk tab: bottles in stock, the third number of the milk card (Person 1) */
.milk-nums:has(.ms-cell) { grid-template-columns: repeat(3, 1fr); }
.milk-nums .ms-cell { display: flex; flex-direction: column; align-items: flex-start; text-align: left; font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.milk-nums .ms-cell b { display: inline-flex; align-items: center; gap: 6px; color: var(--c-milk); }
.milk-nums .ms-cell .ms-edit { width: 18px; height: 18px; color: var(--ink3); }
@media (max-width: 400px) { .milk-nums:has(.ms-cell) b { font-size: 28px; } .milk-nums:has(.ms-cell) small { font-size: 13px; } }

/* Talk: conversations (Person 1) */
.chat-tools { display: inline-flex; gap: 2px; }
.chat-tools .iconbtn { position: relative; }
.chat-tools .iconbtn[disabled] { opacity: .35; }
.chat-tools .tool-n { position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--ink3); color: #fff; font: 700 10px/16px inherit; font-style: normal; }
.chat-elsewhere { display: flex; align-items: center; gap: 10px; width: 100%; margin: 8px 0 0; padding: 10px 14px; border: 1px solid color-mix(in srgb, var(--warn, #c98a12) 45%, transparent); border-radius: 14px; background: color-mix(in srgb, var(--warn, #c98a12) 10%, var(--card, #fff)); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.chat-elsewhere svg { flex: none; width: 20px; height: 20px; }
.chat-elsewhere span { flex: 1; font-size: 15px; }
.chat-elsewhere b { color: var(--pri); }
.chat-hist { display: flex; flex-direction: column; gap: 12px; }
.hist-list { display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; background: var(--card, #fff); }
.hist-row { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line, #e7e3d8); }
.hist-row:last-child { border-bottom: 0; }
.hist-row.now { background: color-mix(in srgb, var(--pri) 7%, transparent); }
.hist-open { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.hist-open b { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-open small { color: var(--ink2); font-size: 13px; }
.hist-row.waiting .hist-open small { color: var(--warn-ink, #8a5a00); }
.hist-row .iconbtn { color: var(--ink3); margin-right: 6px; }

/* Login screens (login.js, Person 1) */
.login { overflow-y: auto; align-items: flex-start; padding-top: max(24px, env(safe-area-inset-top)); }
.login-box { margin: auto 0; gap: 12px; }
.login-box h1 { font-size: 32px; }
.login-box > p { margin-bottom: 0; }
.login-tabs { display: flex; width: 100%; }
.login-form { width: 100%; display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login-form.card { padding: 16px; }
.login-form h3 { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.login-form h3 svg { width: 20px; height: 20px; color: var(--pri); }
.login .inp { width: 100%; font-size: 17px; }
.login .inp.code { text-transform: uppercase; letter-spacing: .12em; font-weight: 700; }
.pw-wrap { position: relative; display: block; }
.pw-wrap .inp { padding-right: 48px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); color: var(--ink3); }
.pw-eye.on { color: var(--pri); }
.linkbtn { background: none; border: 0; color: var(--pri); font: inherit; font-weight: 650; padding: 8px; cursor: pointer; align-self: center; }
.login-msg { width: 100%; padding: 10px 14px; border-radius: 12px; font-size: 15px; text-align: left; }
.login-msg.bad { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.login-msg.ok { background: var(--pri-soft); color: var(--ink); }
.login-or { width: 100%; display: flex; align-items: center; gap: 10px; color: var(--ink3); font-size: 14px; }
.login-or::before, .login-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.login-lang { display: flex; gap: 6px; margin-top: 6px; }
.login-lang button { background: none; border: 0; color: var(--ink3); font: inherit; font-size: 14px; padding: 6px 10px; border-radius: 8px; cursor: pointer; }
.login-lang button.on { color: var(--ink); font-weight: 700; background: var(--card); }
.invite-code { font-size: 22px; letter-spacing: .14em; }
