:root {
  --ink: #142218;
  --muted: #647168;
  --paper: #f5f7f2;
  --surface: #ffffff;
  --line: #dce4dc;
  --green: #1f5a3a;
  --green-soft: #e5f0e8;
  --amber: #9a5a05;
  --amber-soft: #fff2d9;
  --red: #a23325;
  --red-soft: #fae9e7;
  --shadow: 0 5px 18px rgba(20, 34, 24, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { min-width: 320px; margin: 0; background: var(--paper); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #78b58d; outline-offset: 2px; }
.app-shell { min-height: 100dvh; padding: max(20px, env(safe-area-inset-top)) 16px calc(90px + env(safe-area-inset-bottom)); }
.screen { max-width: 680px; margin: 0 auto; }
.screen h1, .screen h2, .screen p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(1.6rem, 7vw, 2.05rem); letter-spacing: -.045em; }
h2 { font-size: 1rem; }
.eyebrow { margin-bottom: 7px; color: var(--green); font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.helper { color: var(--muted); line-height: 1.45; }
.topline, .section-head, .row, .task-title, .item-title, .form-row, .status-row { display: flex; align-items: center; }
.topline, .section-head { justify-content: space-between; gap: 12px; }
.topline { align-items: flex-start; }
.section-head { margin: 24px 0 10px; }
.section-head h2 { margin: 0; }
.section-head > span { color: var(--muted); font-size: .84rem; }
.language-switch { display: flex; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.language-switch button { min-height: 34px; border: 0; padding: 0 10px; background: transparent; color: var(--muted); font-size: .75rem; font-weight: 800; }
.language-switch button.active { background: var(--green); color: white; }
.filter { display: flex; gap: 4px; margin: 15px 0; padding: 4px; overflow-x: auto; border-radius: 12px; background: #e8ece7; }
.filter button { min-height: 40px; flex: 1 0 auto; border: 0; border-radius: 9px; padding: 0 11px; color: var(--muted); background: transparent; font-weight: 750; }
.filter button.active { color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.alert, .session, .card, .task, .livestock-row, .setting, .stock-row, .form-card { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.alert { display: flex; gap: 12px; padding: 14px; border-color: #e9c99a; background: var(--amber-soft); }
.alert strong { display: block; color: #734609; }
.alert p { margin: 4px 0 0; color: #754f17; font-size: .88rem; line-height: 1.4; }
.alert-icon { display: grid; width: 27px; height: 27px; flex: 0 0 27px; place-items: center; border-radius: 999px; color: var(--amber); background: #ffe5ae; font-weight: 900; }
.session { margin-top: 10px; padding: 16px; }
.session small { color: var(--amber); font-weight: 800; }
.session h2 { margin: 8px 0 5px; font-size: 1.13rem; }
.session p { margin-bottom: 14px; color: var(--muted); }
.primary, .secondary, .link, .claim { min-height: 46px; border-radius: 11px; font-weight: 800; }
.primary { width: 100%; border: 1px solid var(--green); padding: 0 16px; color: white; background: var(--green); }
.secondary { border: 1px solid var(--line); padding: 0 14px; color: var(--ink); background: var(--surface); }
.link { min-height: auto; border: 0; padding: 4px 0; color: var(--green); background: transparent; font-size: .85rem; font-weight: 800; }
.quick-grid, .activity-grid, .more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick, .activity, .more-card { min-height: 96px; border: 1px solid var(--line); border-radius: 15px; padding: 13px; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); text-align: left; }
.quick .icon, .activity .icon, .more-card .icon { display: block; margin-bottom: 8px; color: var(--green); font-size: 1.3rem; }
.quick small, .activity small, .more-card small { display: block; margin-top: 4px; color: var(--muted); font-size: .75rem; line-height: 1.25; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.metric { min-width: 0; padding: 12px 9px; border-radius: 13px; background: #e8eee8; }
.metric b, .metric span { display: block; }
.metric b { overflow: hidden; font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
.metric span { margin-top: 3px; color: var(--muted); font-size: .7rem; line-height: 1.2; }
.task, .livestock-row, .stock-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 13px; }
.task + .task, .livestock-row + .livestock-row, .stock-row + .stock-row { margin-top: 9px; }
.task p, .livestock-row p, .stock-row p { margin: 5px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.35; }
.task-title, .item-title { gap: 7px; flex-wrap: wrap; }
.claim { min-width: 70px; border: 1px solid var(--green); padding: 0 9px; color: var(--green); background: white; }
.claim.claimed { border-color: transparent; color: var(--green); background: var(--green-soft); }
.pill, .tag { display: inline-flex; align-items: center; min-height: 23px; border-radius: 999px; padding: 2px 8px; font-size: .7rem; font-weight: 800; }
.pill { color: #75613d; background: var(--amber-soft); }
.pill.green { color: var(--green); background: var(--green-soft); }
.tag.danger { color: var(--red); background: var(--red-soft); }
.search { width: 100%; min-height: 48px; margin: 15px 0; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; background: var(--surface); }
.search input { width: 100%; min-height: 46px; border: 0; outline: 0; background: transparent; }
.avatar { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-soft); font-weight: 900; }
.livestock-row { grid-template-columns: auto 1fr auto; }
.livestock-row .chevron, .stock-row .chevron { color: var(--muted); font-size: 1.3rem; }
.empty { padding: 22px; border: 1px dashed #bac7bc; border-radius: 14px; color: var(--muted); text-align: center; }
.entry-header { display: flex; align-items: center; gap: 10px; }
.entry-context { margin: 15px 0; border-radius: 12px; padding: 11px 12px; color: var(--green); background: var(--green-soft); font-size: .88rem; font-weight: 750; }
.form-card { padding: 16px; }
.form-card label { display: block; margin: 15px 0 5px; color: var(--muted); font-size: .8rem; font-weight: 800; }
.form-card label:first-child { margin-top: 0; }
.form-card input, .form-card select, .input-look { width: 100%; min-height: 49px; border: 1px solid var(--line); border-radius: 11px; padding: 0 11px; color: var(--ink); background: white; }
.input-look { display: flex; align-items: center; }
.unit-input { display: flex; align-items: center; gap: 9px; min-height: 49px; border: 1px solid var(--line); border-radius: 11px; padding: 0 11px; background: white; }
.unit-input input { min-width: 0; border: 0; padding: 0; }
.unit-input span { color: var(--muted); font-size: .84rem; white-space: nowrap; }
.form-actions { position: sticky; bottom: 0; display: grid; grid-template-columns: 1fr 1.2fr; gap: 9px; margin-top: 16px; padding: 12px 0 max(4px, env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--paper) 75%, transparent); }
.form-actions .secondary { padding: 0 8px; }
.sync-note { margin-top: 14px; color: var(--green); font-size: .8rem; }
.settings { display: grid; gap: 10px; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px; }
.setting small { display: block; margin-top: 3px; color: var(--muted); line-height: 1.35; }
.toggle { position: relative; width: 50px; height: 30px; flex: 0 0 auto; border: 0; border-radius: 99px; background: #bcc8bd; }
.toggle::after { position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; background: white; content: ""; transition: transform .15s ease; }
.toggle.on { background: var(--green); }
.toggle.on::after { transform: translateX(20px); }
.bottom-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 10; padding: 8px max(12px, env(safe-area-inset-left)) max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }
.bottom-nav-inner { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); max-width: 680px; margin: 0 auto; }
.nav-item { min-height: 54px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; font-size: .67rem; font-weight: 800; }
.nav-item span { display: block; margin-bottom: 3px; font-size: 1.15rem; }
.nav-item.active { color: var(--green); background: var(--green-soft); }
.nav-item.record { display: grid; width: 52px; height: 52px; place-self: center; place-items: center; border-radius: 50%; color: white; background: var(--green); font-size: 1.65rem; line-height: 1; box-shadow: 0 5px 12px rgba(31,90,58,.25); }
.nav-item.record span { margin: 0; }
.toast { position: fixed; right: 16px; bottom: 90px; left: 16px; z-index: 20; max-width: 500px; margin: auto; transform: translateY(120px); border-radius: 12px; padding: 12px 14px; color: white; background: #1e2b22; box-shadow: var(--shadow); opacity: 0; transition: .2s ease; text-align: center; }
.toast.show { transform: translateY(0); opacity: 1; }

@media (min-width: 700px) {
  body { padding: 24px; }
  .app-shell { min-height: calc(100dvh - 48px); border-radius: 22px; padding: 28px 24px 104px; box-shadow: 0 18px 48px rgba(20,34,24,.14); }
  .quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bottom-nav { right: 24px; bottom: 24px; left: 24px; border: 1px solid var(--line); border-radius: 16px; }
  .toast { bottom: 104px; }
}
