 :root {
  --bg: oklch(0.98 0.012 100); --card: oklch(0.995 0.005 95); --ink: oklch(0.24 0.035 150); --muted: oklch(0.46 0.025 160); --line: oklch(0.88 0.04 100);
  --green: oklch(0.45 0.14 150); --green-dark: oklch(0.27 0.075 151); --green-mid: oklch(0.35 0.075 151);
  --yellow: oklch(0.87 0.17 91); --yellow-ink: oklch(0.28 0.06 70); --red: oklch(0.51 0.19 28); --soft: oklch(0.94 0.05 140);
  --sky: oklch(0.55 0.11 230); --sky-wash: oklch(0.95 0.025 230); --green-wash: oklch(0.45 0.14 150 / 0.1); --red-wash: oklch(0.51 0.19 28 / 0.08);
  --on-color: oklch(0.99 0.004 100); --sidebar-line: oklch(0.34 0.04 152);
  --shadow: 0 1px 0 oklch(0.88 0.018 200), 0 12px 30px -18px oklch(0.36 0.075 152 / 0.25);
  --shadow-lift: 0 18px 40px -20px oklch(0.45 0.14 150 / 0.35);
  --sunrise: linear-gradient(120deg, oklch(0.87 0.17 91 / 0.55), oklch(0.8 0.15 60 / 0.35) 45%, oklch(0.75 0.13 150 / 0.3));
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Manrope, system-ui, sans-serif; background: var(--bg); color: var(--ink); display: flex; min-height: 100vh; }
h1, h2, h3, .brand-name, .big { font-family: Fraunces, Georgia, serif; font-weight: 600; margin: 0; }
.sidebar { width: 240px; background: var(--green-dark); color: var(--on-color); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 24px 12px; }
.brand { padding: 0 12px 20px; } .brand img { width: 128px; border-radius: 8px; }
.brand-name { font-size: 1.25rem; margin-top: 10px; } .brand-sub { font-size: .75rem; opacity: .7; }
#nav a, #bottom-nav a { color: inherit; text-decoration: none; display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 8px; opacity: .8; font-weight: 600; font-size: .9rem; }
#nav a:hover { background: var(--green-mid); opacity: 1; }
#nav a.active, #bottom-nav a.active { background: var(--green-mid); color: var(--yellow); opacity: 1; }
.sync { margin-top: auto; font-size: .75rem; border: 1px solid var(--sidebar-line); border-radius: 8px; padding: 10px; }
.sync::first-letter { color: var(--yellow); }
main { flex: 1; min-width: 0; padding-bottom: 40px; animation: rise .4s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.mobile-top, #bottom-nav { display: none; }
.page-head { background: var(--sunrise); border-bottom: 1px solid var(--line); padding: 32px 40px 24px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 24px; }
.eyebrow { color: var(--red); font-size: .75rem; font-weight: 700; letter-spacing: 0; text-transform: uppercase; }
.page-head h1 { font-size: 2.2rem; margin-top: 4px; }
.wrap { padding: 0 40px; display: grid; gap: 24px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.side-form { grid-template-columns: 340px 1fr; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 20px; box-shadow: 0 12px 30px -20px oklch(0.27 0.075 151 / 0.4); }
.lift { transition: transform .2s, box-shadow .2s; } .lift:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -20px oklch(0.45 0.14 150 / 0.55); }
.pill { display: inline-block; border-radius: 12px; padding: 8px 16px; } .pill .label { font-size: .75rem; font-weight: 700; } .pill .big { font-size: 1.6rem; }
.yellow { background: var(--yellow); color: var(--yellow-ink); } .red { background: var(--red); color: var(--card); } .green { background: var(--green); color: var(--card); }
label { display: block; font-size: .85rem; margin-top: 10px; }
input, select { width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--card); }
.row { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); }
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--line); background: var(--card); padding: 8px 12px; font-weight: 600; }
button:hover { background: var(--soft); }
button.primary { background: var(--green); color: var(--card); border: 0; width: 100%; margin-top: 14px; padding: 11px; }
button.primary:hover { background: var(--green-mid); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { border-radius: 999px; padding: 5px 12px; font-size: .85rem; }
.chip.on { background: var(--green); color: var(--card); border-color: transparent; }
.muted { color: var(--muted); font-size: .8rem; } .error { color: var(--red); font-size: .85rem; }
ul.list { list-style: none; padding: 0; margin: 16px 0 0; } ul.list li { display: flex; justify-content: space-between; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.tag { border-radius: 999px; padding: 2px 9px; font-size: .75rem; font-weight: 700; background: var(--soft); white-space: nowrap; }
.batch { padding: 0; overflow: hidden; } .batch-head { display: flex; justify-content: space-between; padding: 12px 16px; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 16px; text-align: center; }
.stat { background: var(--soft); border-radius: 8px; padding: 8px; } .stat .big { font-size: 1.3rem; } .stat.warn .big { color: var(--red); }
.batch .foot { border-top: 1px solid var(--line); padding: 10px 16px; } .actions { display: flex; gap: 8px; padding: 0 16px 16px; }
.grid-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.grid-btns button { padding: 14px 6px; } .grid-btns button.on { background: var(--yellow); border-color: transparent; }
.bar { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--green); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; } th, td { text-align: left; padding: 10px 6px; border-top: 1px solid var(--line); }
.score { font-size: 4rem; color: var(--green); }
.pos { color: var(--green); } .neg { color: var(--red); }
@media (max-width: 800px) {
  body { display: block; } .sidebar { display: none; }
  .mobile-top { display: flex; gap: 10px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--line); font-family: Fraunces, serif; font-size: 1.2rem; }
  .mobile-top img { width: 52px; }
  #bottom-nav { display: grid; grid-template-columns: repeat(7, 1fr); position: fixed; inset: auto 0 0 0; background: var(--green-dark); color: var(--on-color); z-index: 5; }
  #bottom-nav a { flex-direction: column; gap: 2px; font-size: 10px; padding: 8px 2px; border-radius: 0; }
  main { padding-bottom: 90px; } .page-head { padding: 24px 18px; } .wrap { padding: 0 18px; } .side-form { grid-template-columns: 1fr; }
}
.tag.red { background: var(--red); color: var(--card); } .tag.yellow { background: var(--yellow); color: var(--yellow-ink); }

/* Restored enterprise workspace and chart presentation. */
.sidebar { flex-shrink: 0; }
.card { box-shadow: var(--shadow); }
.lift:hover { box-shadow: var(--shadow-lift); }
.page-head h1 { max-width: 760px; line-height: 1.18; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--sky); outline-offset: 3px; }
.enterprise-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.enterprise-tabs button { background: var(--soft); border: 0; padding: 11px 18px; }
.enterprise-tabs button.on { background: var(--green); color: var(--on-color); }
.finance-layout { display: grid; grid-template-columns: minmax(0,1fr) 280px; gap: 28px; }
.finance-main { min-width: 0; padding: 24px 0; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.section-heading h2 { margin-top: 6px; font-size: 1.5rem; }
.be-number { font-family: Fraunces, Georgia, serif; font-size: 3rem; line-height: 1.2; margin-top: 16px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.finance-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin: 24px 0; border-block: 1px solid var(--line); padding: 16px 0; gap: 16px; }
.finance-metrics span, .formula span { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 8px; }
.finance-metrics b { font-variant-numeric: tabular-nums; }
.chart-box { position: relative; height: 320px; width: 100%; min-width: 0; }
.scenario { align-self: start; background: var(--sky-wash); border-top: 4px solid var(--sky); padding: 24px; border-radius: 0 0 8px 8px; }
.scenario h2 { font-size: 1.7rem; margin-top: 6px; }
.scenario label { margin-top: 28px; }
.scenario strong { display: block; font-size: 1.2rem; margin-top: 6px; font-variant-numeric: tabular-nums; }
input[type=range] { border: 0; padding: 0; cursor: pointer; accent-color: var(--green); margin-top: 16px; }
#variableRange { accent-color: var(--red); }
.formula { border-top: 1px solid var(--line); margin-top: 30px; padding-top: 20px; font-size: .85rem; }
.payback { border-top: 1px solid var(--line); padding: 28px 0; }
.payback-marker { color: var(--green); font-family: Fraunces, Georgia, serif; font-size: 1.7rem; white-space: nowrap; }
.payback-marker small { display: block; font: 600 .75rem Manrope, sans-serif; color: var(--muted); margin-top: 4px; }
.breeding-row { border-top: 1px solid var(--line); }
.tag { white-space: normal; height: fit-content; text-align: center; }
.card { min-width: 0; }
.card:has(table) { overflow-x: auto; }
@media (max-width:1100px) { .finance-layout { grid-template-columns: minmax(0,1fr); } .scenario { max-width: none; } }
@media (max-width:800px) {
 .finance { gap: 18px; } .be-number { font-size: 2.5rem; }
 .finance-metrics { gap: 8px; } .finance-metrics b { font-size: .85rem; }
 .enterprise-tabs button { padding: 10px 12px; font-size: .8rem; }
 .section-heading { flex-wrap: wrap; } .chart-box { height: 290px; }
 .page-head h1 { font-size: 1.8rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .lift:hover { transform: none; } }

/* --- Laravel app additions --- */
.flash { margin: 0 40px 16px; background: var(--green); color: var(--on-color); border-radius: 8px; padding: 10px 16px; font-size: .9rem; }
.sidebar form button, #bottom-nav form button { background: none; border: 0; color: inherit; width: 100%; }
.inline-form { display: inline; }
ul.list li form button { padding: 4px 10px; font-size: .8rem; }
.login-wrap { max-width: 380px; margin: 8vh auto; }
.login-wrap .brand-row { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.login-wrap img { width: 72px; border-radius: 10px; }
a.chip { text-decoration: none; color: inherit; border: 1px solid var(--line); background: var(--card); display: inline-block; }
a.chip.on { background: var(--green); color: var(--on-color); border-color: transparent; }
.grid-btns label { margin: 0; cursor: pointer; }
.grid-btns input[type=radio], .chips input[type=radio] { display: none; }
.grid-btns .opt { display: block; text-align: center; border: 1px solid var(--line); border-radius: 8px; padding: 14px 6px; font-weight: 600; background: var(--card); }
.grid-btns input:checked + .opt { background: var(--yellow); border-color: transparent; }
.chips .opt { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: .85rem; background: var(--card); font-weight: 600; }
.chips input:checked + .opt { background: var(--green); color: var(--on-color); border-color: transparent; }
#bottom-nav { grid-template-columns: repeat(7, 1fr) !important; }
.enterprise-tabs a { background: var(--soft); border: 0; padding: 11px 18px; border-radius: 8px; text-decoration: none; color: inherit; font-weight: 600; font-size: .9rem; }
.enterprise-tabs a.on { background: var(--green); color: var(--on-color); }


/* --- Report pack printing --- */
@media print {
  .sidebar, .mobile-top, #bottom-nav, .no-print, .flash { display: none !important; }
  body { display: block; background: var(--card); }
  main { padding: 0; animation: none; }
  .report-pack .card { box-shadow: none; border: 1px solid var(--line); break-inside: avoid; margin-bottom: 14px; }
  .print-section { page-break-inside: avoid; }
  /* Long tables must be allowed to break across pages — but cleanly:
     headers repeat on every page, and no row is ever cut in half. */
  .print-section:has(table) { page-break-inside: auto; }
  table { break-inside: auto; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
  a { text-decoration: none; color: inherit; }
}
.report-head { border-bottom: 2px solid var(--line); padding-bottom: 10px; margin-bottom: 12px; }

/* Batches page: buy form beside tabbed batch panels */
.buy-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px 14px; align-items: end; }
.buy-grid label { margin: 0; }
.batch-panel table { width: 100%; }
.batch-extras { display: grid; gap: 10px; padding: 0 16px 16px; }
.batch-extras details { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0 !important; }
.batch-extras details > summary { font-weight: 600; list-style-position: inside; }
.batch-extras > p, .batch-extras > div, .batch-extras > form { margin: 0 !important; }

/* ===== v3 theme: Barnyard Haven executive refresh ===== */
:root {
  --sidebar-bg: oklch(0.27 0.075 151);
  --sidebar-ink: oklch(0.97 0.006 100);
  --sidebar-accent: oklch(0.35 0.075 151);
  --sidebar-gold: oklch(0.87 0.17 91);
  --soil: oklch(0.51 0.19 28);
  --field-grad: linear-gradient(135deg, oklch(0.45 0.14 150), oklch(0.32 0.1 151));
  --sunrise-grad: linear-gradient(120deg, oklch(0.87 0.17 91 / 0.55), oklch(0.8 0.15 60 / 0.35) 45%, oklch(0.75 0.13 150 / 0.3));
  --shadow-card: 0 1px 0 oklch(0.88 0.018 200), 0 12px 30px -18px oklch(0.36 0.075 152 / 0.35);
}
.sidebar { background: var(--sidebar-bg); color: var(--sidebar-ink); border-right: 0; }
.sidebar .brand-name { color: var(--sidebar-ink); }
.sidebar .brand-sub, .sidebar .sync { color: oklch(0.97 0.006 100 / 0.6); }
.sidebar .sync { border: 1px solid oklch(0.34 0.04 152); border-radius: 8px; margin: 12px; padding: 10px; }
.sidebar nav a { color: oklch(0.97 0.006 100 / 0.8); border-radius: 8px; }
.sidebar nav a:hover { background: var(--sidebar-accent); color: var(--sidebar-ink); }
.sidebar nav a.active { background: var(--sidebar-accent); color: var(--sidebar-gold); }
#bottom-nav { background: var(--sidebar-bg); }
#bottom-nav a { color: oklch(0.97 0.006 100 / 0.7); }
#bottom-nav a.active { color: var(--sidebar-gold); }
.mobile-top { background: var(--sidebar-bg); color: var(--sidebar-ink); }
.page-head { background: var(--sunrise-grad); border-bottom: 1px solid var(--line); padding-top: 30px; padding-bottom: 22px; }
.page-head .eyebrow { color: var(--soil); }
.card { box-shadow: var(--shadow-card); }
.hero-field { background: var(--field-grad); color: oklch(0.99 0.004 100); border-radius: 14px; padding: 24px; }
.hero-field .verdict { font-family: Fraunces, Georgia, serif; font-size: 1.5rem; line-height: 1.35; margin-top: 8px; }
.hero-field .accent-text { color: var(--sidebar-gold); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 16px; }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi span { font-size: .85rem; color: var(--muted); }
.kpi b { font-family: Fraunces, Georgia, serif; font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: .76rem; }
.exec-cols { display: flex; gap: 16px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 4px; box-shadow: var(--shadow-card); }
.seg a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: .9rem; padding: 8px 16px; border-radius: 8px; }
.seg a.on { background: var(--green); color: var(--on-color); }
.avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; background: var(--green); color: var(--on-color); font-family: Fraunces, Georgia, serif; font-size: 1.1rem; flex-shrink: 0; }
.score-ring { transform: rotate(-90deg); }
.score-ring .track { stroke: oklch(0.99 0.004 100 / 0.15); }
.score-ring .fill { stroke: var(--sidebar-gold); stroke-linecap: round; }
.hero-field .bar { background: oklch(0.99 0.004 100 / 0.15); }
.hero-field .bar i { background: var(--sidebar-gold); }
.stream li { display: flex; gap: 10px; font-size: .88rem; padding: 7px 0; }
.stream .t { width: 44px; flex-shrink: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.stream .fx { color: var(--muted); font-size: .8rem; }

/* ===== Manage: tabs + modals ===== */
.tabbar { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 40px 18px; }
.tabbar button { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 9px 18px; font-weight: 600; font-size: .9rem; color: var(--muted); cursor: pointer; }
.tabbar button.on { background: var(--green); color: var(--on-color); border-color: transparent; }
.tabpanel { display: none; }
.tabpanel.on { display: block; }
@media (max-width: 900px) { .tabbar { margin: 0 18px 14px; } }
dialog.modal { border: 0; border-radius: 12px; padding: 0; max-width: min(640px, 92vw); width: 100%; box-shadow: var(--shadow-card); background: var(--card); color: inherit; }
dialog.modal::backdrop { background: oklch(0.24 0.035 150 / 0.45); backdrop-filter: blur(2px); }
dialog.modal .modal-body { padding: 22px 24px 24px; max-height: 82vh; overflow-y: auto; }
dialog.modal h2 { margin-bottom: 6px; }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; }
.modal-actions .primary { width: auto; padding: 12px 22px; }
.modal-actions .ghost { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 12px 18px; font-weight: 600; cursor: pointer; }
.btn-new { border: 0; background: var(--green); color: var(--on-color); border-radius: 8px; padding: 10px 16px; font-weight: 700; cursor: pointer; font-size: .9rem; }
.btn-ghost-sm { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 4px 10px; font-size: .8rem; font-weight: 600; cursor: pointer; }
.btn-danger-sm { border: 1px solid oklch(0.56 0.19 30 / .4); color: var(--red); background: var(--card); border-radius: 8px; padding: 4px 10px; font-size: .8rem; font-weight: 600; cursor: pointer; }
#confirm-modal .modal-body { text-align: left; }
#confirm-modal .danger { background: var(--red); color: var(--on-color); border: 0; border-radius: 8px; padding: 12px 22px; font-weight: 700; cursor: pointer; }

/* ===== Health page redesign ===== */
.range-pill { display: inline-block; background: var(--soft); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scope-chip { display: inline-block; border-radius: 999px; padding: 3px 12px; font-size: .78rem; font-weight: 700; }
.scope-type { background: var(--green-wash); color: var(--green); }
.scope-all { background: oklch(0.87 0.17 91 / .25); color: oklch(0.5 0.1 80); }
.scope-species { background: oklch(0.51 0.19 28 / .12); color: var(--soil); }
.mini-bar { height: 5px; border-radius: 99px; background: var(--soft); overflow: hidden; width: 120px; }
.mini-bar i { display: block; height: 100%; background: var(--green); }
.dose-row { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.dose-row:last-child { border-bottom: 0; }
.dose-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--soft); display: grid; place-items: center; font-size: 1.1rem; flex-shrink: 0; }
.dose-main { flex: 1; min-width: 0; }
.dose-main b { display: block; }
.dose-main .muted { font-size: .8rem; }
.give-btn { background: var(--green); color: var(--on-color); border: 0; border-radius: 8px; padding: 9px 16px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.given-chip { color: var(--green); font-weight: 700; font-size: .85rem; white-space: nowrap; }
.missed-chip { background: var(--red-wash); color: var(--red); border-radius: 999px; padding: 2px 9px; font-size: .74rem; font-weight: 700; }
.tl { list-style: none; margin: 10px 0 0; position: relative; padding-left: 20px; }
.tl::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.tl li { position: relative; padding: 6px 0 6px 10px; display: flex; justify-content: space-between; gap: 8px; align-items: baseline; font-size: .88rem; }
.tl li::before { content: ''; position: absolute; left: -18px; top: 13px; width: 10px; height: 10px; border-radius: 99px; background: var(--card); border: 2px solid var(--muted); }
.tl li.done::before { background: var(--green); border-color: var(--green); }
.tl li.late::before { background: var(--red); border-color: var(--red); }
.tl li.today-dot::before { background: var(--sidebar-gold, var(--yellow)); border-color: var(--sidebar-gold, var(--yellow)); }
.age-chip { background: var(--field-grad, var(--green)); color: var(--on-color); border-radius: 8px; padding: 3px 10px; font-size: .78rem; font-weight: 700; }
.health-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Reports: tabs on screen, the WHOLE pack on paper */
@media print {
  .tabpanel { display: block !important; }
  .tabbar { display: none !important; }
}

/* A shown panel that lays out as a stack of sections */
.tabpanel.on.stack { display: grid; gap: 20px; }

/* UI/UX review — shared workspace, accessible navigation and compact health tools. */
:root {
  --bg: oklch(0.978 0.007 145);
  --card: oklch(0.998 0.002 145);
  --ink: oklch(0.25 0.028 151);
  --muted: oklch(0.46 0.022 151);
  --line: oklch(0.89 0.017 151);
  --surface-hover: oklch(0.96 0.02 151);
  --focus-ring: oklch(0.51 0.13 230);
  --warning-wash: oklch(0.96 0.06 91);
  --sidebar-muted: oklch(0.8 0.025 151);
  --shadow-card: 0 2px 8px oklch(0.25 0.03 151 / 0.04);
  --dialog-shadow: 0 24px 80px oklch(0.25 0.03 151 / 0.22);
}
body { line-height:1.5; letter-spacing:0; }
h1,h2,h3 { line-height:1.25; overflow-wrap:anywhere; }
h2 { font-size:1.25rem; }
a { color:var(--green); }
button,input,select,textarea { color:inherit; }
button,a,input,select,textarea,summary { touch-action:manipulation; }
button { min-height:40px; }
input,select,textarea { min-height:44px; border-radius:6px; }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible { outline:3px solid var(--focus-ring); outline-offset:3px; }
input[type=radio] { min-height:0; }
.grid-btns input[type=radio],.chips input[type=radio] { display:block; position:absolute; width:1px; height:1px; opacity:0; margin:0; padding:0; }
.grid-btns input:focus-visible + .opt,.chips input:focus-visible + .opt { outline:3px solid var(--focus-ring); outline-offset:3px; }
.chips label { position:relative; margin-top:0; }
.skip-link { position:fixed; top:8px; left:8px; z-index:100; background:var(--card); padding:12px; transform:translateY(-180%); }
.skip-link:focus { transform:none; }
.sidebar { width:232px; padding:20px 12px 12px; }
.brand { display:flex; align-items:center; gap:12px; color:inherit; text-decoration:none; padding:0 6px 20px; }
.brand img { width:64px; height:64px; object-fit:contain; border-radius:0; flex-shrink:0; }
.brand-name { font-size:1.05rem; margin-top:0; }
.brand-sub { margin-top:4px; }
#nav { flex:1; min-height:0; overflow-y:auto; scrollbar-width:thin; scrollbar-color:var(--sidebar-accent) transparent; }
.nav-group-label { margin:18px 12px 7px; font-size:.68rem; font-weight:700; color:var(--sidebar-muted); text-transform:uppercase; }
#nav .nav-group-label:first-child { margin-top:0; }
#nav a { min-height:40px; padding:8px 12px; font-size:.83rem; opacity:1; margin-bottom:2px; }
.nav-icon { width:19px; height:19px; flex-shrink:0; }
#nav a.active { box-shadow:inset 3px 0 var(--sidebar-gold); }
.account-panel { border-top:1px solid var(--sidebar-line); padding:14px 10px 0; margin-top:12px; }
.account-name { font-size:.8rem; overflow-wrap:anywhere; }
.logout-button { display:flex; align-items:center; gap:10px; color:inherit; background:none; border:0; padding:8px 0; font-size:.8rem; }
.sidebar form .logout-button { text-align:left; padding:8px 0; }
.logout-button:hover { background:none; text-decoration:underline; }
main { animation:none; }
.page-head { background:var(--card); padding:30px 32px 24px; margin-bottom:24px; align-items:center; border-top:4px solid var(--yellow); }
.page-head h1 { font-size:2rem; }
.page-head .eyebrow { color:var(--green); }
.wrap { padding:0 32px; gap:20px; }
.card { box-shadow:var(--shadow-card); padding:22px; }
.lift:hover { transform:none; box-shadow:var(--shadow-card); }
.hero-field { border-radius:0; background:var(--green-dark); color:var(--on-color); border-left:5px solid var(--yellow); }
.hero-field .verdict { margin-bottom:0; }
.kpis { grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.kpi { border-top:3px solid var(--green); padding:18px; }
.kpi:nth-child(2) { border-top-color:var(--sky); }
.kpi:nth-child(3) { border-top-color:var(--red); }
.kpi:nth-child(4) { border-top-color:var(--yellow); }
.kpi span { font-size:.77rem; }
.kpi b { font-size:1.65rem; overflow-wrap:anywhere; }
.kpi small { line-height:1.5; }
.exec-cols { gap:20px; align-items:flex-start; }
.exec-cols > .card { align-self:stretch; }
.health-workspace .exec-cols > .card { align-self:flex-start; }
.health-workspace .exec-cols > section { min-width:0; }
.pill { border-radius:6px; padding:8px 14px; }
.tag.red { background:var(--red-wash); color:var(--red); }
.tag.yellow { background:var(--warning-wash); color:var(--yellow-ink); }
.tag { font-size:.73rem; line-height:1.4; }
.tabbar { margin:0 32px 22px; gap:0; border-bottom:1px solid var(--line); overflow-x:auto; flex-wrap:nowrap; }
.tabbar button { border:0; border-radius:0; white-space:nowrap; background:transparent; padding:12px 18px; border-bottom:3px solid transparent; }
.tabbar button.on { background:transparent; color:var(--green); border-bottom-color:var(--green); }
.tabbar button:hover { background:var(--surface-hover); }
.seg { border-radius:8px; box-shadow:none; }
.seg a { min-height:40px; display:flex; align-items:center; }
.health-actions button { min-height:44px; }
.dose-row { gap:12px; align-items:flex-start; }
.dose-main b { font-size:.92rem; }
.dose-ico { background:var(--sky-wash); color:var(--sky); border-radius:6px; }
.give-btn { min-height:44px; }
.dose-progress { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-top:6px; }
.mini-bar { width:80px; }
ul.list { margin-top:12px; }
ul.list li { align-items:flex-start; gap:12px; }
ul.list li > span:first-child { min-width:0; overflow-wrap:anywhere; }
.health-workspace .list li > span:last-child { flex-wrap:wrap; justify-content:flex-end; }
.protocol-editor { table-layout:fixed; }
.protocol-editor th { font-size:.73rem; color:var(--muted); }
.protocol-editor td { vertical-align:top; }
.protocol-editor th:first-child { width:105px; }
.protocol-editor th:last-child { width:46px; }
.protocol-step-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.protocol-step-fields label { margin:0; font-size:.72rem; color:var(--muted); }
.protocol-step-fields input { width:100%; min-width:0; margin:3px 0 0; }
.protocol-step-fields .medication-field { grid-column:1 / -1; }
.protocol-step-fields button { justify-self:start; }
.protocol-toolbar { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; flex-wrap:wrap; }
.protocol-toolbar .protocol-actions { display:flex; flex-wrap:wrap; gap:6px; }
.btn-ghost-sm,.btn-danger-sm { min-height:36px; }
.protocol-step-fields .btn-ghost-sm { min-height:40px; }
.health-workspace .card:has(.protocol-editor) { overflow:visible; }
.tl li { flex-wrap:wrap; }
dialog.modal { border-radius:8px; box-shadow:var(--dialog-shadow); max-width:min(640px,calc(100vw - 24px)); }
dialog.modal .modal-body { max-height:calc(100dvh - 48px); padding:24px; }
.modal-actions { align-items:center; flex-wrap:wrap; border-top:1px solid var(--line); padding-top:16px; }
.modal-actions .primary { margin-top:0; }
.flash { margin:16px 32px; background:var(--soft); color:var(--green-dark); border-left:4px solid var(--green); }
.navigation-dialog { background:var(--card); color:var(--ink); border:0; border-radius:8px; padding:20px; width:min(440px,calc(100vw - 24px)); max-height:calc(100dvh - 32px); box-shadow:var(--dialog-shadow); }
.navigation-dialog::backdrop { background:oklch(0.25 0.03 151 / .45); }
.navigation-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.navigation-heading button { font-size:1.6rem; width:44px; padding:0; }
.navigation-dialog nav { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; }
.navigation-dialog .nav-group-label { grid-column:1 / -1; color:var(--muted); margin:14px 8px 2px; }
.navigation-dialog nav a { display:flex; align-items:center; gap:8px; min-height:44px; padding:8px; text-decoration:none; border-radius:6px; font-size:.82rem; color:var(--ink); }
.navigation-dialog nav a.active { background:var(--soft); color:var(--green); }
.navigation-dialog .logout-button { margin-top:16px; }
.stream { padding-left:0; }
.chart-box { margin-top:14px; }
.login-wrap { padding:0 16px; width:100%; }
.login-wrap .brand-row { padding:12px 0; }
.login-wrap img { border-radius:0; }
@media(max-width:1100px) { .kpis { grid-template-columns:repeat(2,minmax(0,1fr)); } .side-form { grid-template-columns:minmax(260px,320px) minmax(0,1fr); } }
@media(max-width:800px) {
  .sidebar { display:none; }
  .mobile-top { justify-content:space-between; padding:10px 16px; background:var(--card); color:var(--ink); }
  .mobile-top > a { display:flex; align-items:center; gap:10px; color:inherit; text-decoration:none; }
  .mobile-top img { width:44px; height:44px; object-fit:contain; }
  .mobile-top span { font-size:1.08rem; }
  .menu-trigger { display:grid; place-items:center; width:44px; padding:0; background:none; }
  #bottom-nav { grid-template-columns:repeat(7,minmax(0,1fr)) !important; grid-template-rows:repeat(2,64px); padding-bottom:env(safe-area-inset-bottom,0); background:var(--card); color:var(--ink); border-top:1px solid var(--line); z-index:20; }
  #bottom-nav a,#bottom-nav button { display:flex; flex-direction:column; gap:4px; justify-content:center; align-items:center; min-width:0; min-height:64px; margin:0; padding:8px 1px; font-size:.64rem; line-height:1.2; text-align:center; color:var(--muted); opacity:1; border:0; border-radius:0; background:none; text-decoration:none; }
  #bottom-nav a.active { color:var(--green); background:var(--soft); }
  main { padding-bottom:calc(152px + env(safe-area-inset-bottom,0px)); }
  .page-head { padding:22px 18px 20px; margin-bottom:18px; }
  .page-head h1 { font-size:1.65rem; }
  .wrap { padding:0 18px; gap:16px; }
  .card { padding:18px; }
  .kpis { gap:10px; }
  .kpi { padding:14px; }
  .kpi b { font-size:1.45rem; }
  .kpi span { font-size:.72rem; }
  .health-actions { gap:6px; width:100%; }
  .health-actions button { padding:9px 11px; font-size:.75rem; }
  .tabbar { margin:0 18px 18px; }
  .tabbar button { padding:10px 12px; font-size:.76rem; }
  .dose-row { flex-wrap:wrap; }
  .dose-main { flex-basis:calc(100% - 55px); }
  .dose-row > form,.dose-row > .given-chip { margin-left:50px; }
  .side-form { grid-template-columns:minmax(0,1fr); }
  .flash { margin:12px 18px; }
  .row { grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); }
  .modal-actions { gap:8px; }
  dialog.modal .modal-body { padding:20px; }
  .protocol-editor { table-layout:auto; }
  .protocol-editor th:first-child { width:82px; }
  .protocol-editor td { padding:12px 3px; }
  .range-pill { padding:2px 5px; font-size:.67rem; }
  .protocol-toolbar h2 { max-width:100%; }
  .protocol-editor .btn-danger-sm { padding:4px 8px; }
  .protocol-step-fields { gap:6px; }
  .protocol-step-fields input { padding:8px; font-size:.8rem; }
  .finance-metrics { grid-template-columns:1fr; gap:14px; }
  .chart-box { height:280px; }
  .payback-marker { white-space:normal; }
  .hero-field { padding:20px; }
  .hero-field .verdict { font-size:1.25rem; }
  .animals-workspace details form { flex-wrap:wrap; }
}
@media print {
  .sidebar,.mobile-top,#bottom-nav,.no-print,.flash,dialog,.skip-link,.health-actions,.seg,.menu-trigger,.page-head button { display:none !important; }
  body { background:var(--card); }
  .page-head { border-top:0; }
  .card,.hero-field { box-shadow:none; break-inside:avoid; }
  .hero-field { background:var(--card); color:var(--ink); }
  .hero-field .accent-text { color:var(--green); }
  .kpis { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .wrap { padding:0 16px; }
  .exec-cols { display:block; }
  .exec-cols > section { margin-bottom:16px; }
  .chart-box { height:240px; break-inside:avoid; }
  .tabpanel { display:block !important; }
  .tabbar { display:none !important; }
  main { padding:0; }
}

/* Whole-app sweep: constrain financial tables, wrap actions and preserve batch framing. */
.report-pack,.tabpanel,.wrap > section,.wrap > div { min-width:0; }
.report-pack { width:100%; }
.batch.card { padding:0; }
.batch-head,.actions { flex-wrap:wrap; gap:8px; }
.card h2 + button { flex-shrink:0; }
.card > div[style*="justify-content:space-between"] { flex-wrap:wrap; gap:10px; }
ul.list li > b { overflow-wrap:anywhere; text-align:right; }
ul.list li > span[style*="display:flex"] { flex-wrap:wrap; justify-content:flex-end; }
.table-scroll { max-width:100%; overflow-x:auto; overscroll-behavior-x:contain; scrollbar-width:thin; }
.table-scroll:focus-visible { outline:3px solid var(--focus-ring); outline-offset:3px; }
.table-scroll table { min-width:540px; }
.table-scroll th { white-space:nowrap; }
@media(max-width:800px) {
  .grid-btns { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .card:has(table) { overflow-x:visible; }
  .page-head > div { min-width:0; max-width:100%; }
  .stats { padding:12px; gap:6px; }
  .stat .big { font-size:1.1rem; overflow-wrap:anywhere; }
}
@media print {
  .table-scroll { overflow:visible; }
  .table-scroll table { min-width:0; font-size:.7rem; }
  .table-scroll th { white-space:normal; }
}

/* Care plans — tabular schedule (modal entry) */
.plan-table th { font-size:.73rem; color:var(--muted); }
.plan-table td { vertical-align:middle; }
.plan-table .plan-actions { text-align:right; white-space:nowrap; }
.plan-table .plan-actions .inline-form { display:inline-block; margin-left:4px; }
@media (max-width:760px){ .plan-table .range-pill{padding:2px 5px;font-size:.67rem} .plan-table td{padding:10px 3px} }
