/* FarmBase - one stylesheet for every page (design system "FarmBase", 10 Nov 2026).
   Tokens first, then the layout (sidebar on a computer, rail on a tablet, bottom bar on a phone),
   then the shared components. Pages use these classes; avoid one-off inline styles. */

:root {
    /* colour tokens */
    --surface: #f7f5f0; --surface-raised: #ffffff; --surface-sunken: #efebe3;
    --line: #e2ded5; --line-strong: #8f897e;
    --ink: #1e2421; --ink-muted: #5b655f;
    --brand: #1d5bd6; --brand-hover: #1747a8; --on-brand: #ffffff; --brand-soft: #e3ecfd;
    --accent: #d9822b; --accent-soft: #fbebd9; --accent-ink: #8a4b0f;
    --ok: #1e7a46; --ok-soft: #e3f2e8; --warn: #9a4a06; --warn-soft: #fff1dc;
    --danger: #b42318; --danger-soft: #fdecea; --focus: #b8661a;
    /* space, shape */
    --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px; --tap: 44px;
    --radius-sm: 6px; --radius-md: 10px; --radius-lg: 16px; --radius-pill: 22px;
    --shadow-raised: 0 1px 2px rgba(30, 36, 33, .06), 0 2px 8px rgba(30, 36, 33, .06);
    --shadow-bar: 0 -2px 12px rgba(30, 36, 33, .10);
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Ethiopic", "Abyssinica SIL", Nyala, Kefa, sans-serif;
    --font-mono: ui-monospace, Menlo, Consolas, monospace;
    /* names used by older pages (kept so their inline styles follow the new colours) */
    --green: var(--brand); --green-dark: var(--brand-hover); --muted: var(--ink-muted); --red: var(--danger);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font-sans); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--surface); }
a { color: var(--brand); }
a:hover { color: var(--brand-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
img { max-width: 100%; }

/* ---------- text ---------- */
h1 { margin: 0 0 var(--space-4); font-size: 22px; line-height: 28px; font-weight: 700; }
h2 { margin: 0 0 var(--space-3); font-size: 18px; line-height: 24px; font-weight: 600; }
h3 { margin: 0 0 var(--space-2); font-size: 16px; line-height: 22px; font-weight: 600; }
p { line-height: 1.55; margin: 0 0 var(--space-3); }
.muted { color: var(--ink-muted); font-size: 14px; }
.code, code { font-family: var(--font-mono); font-size: 13px; }
@media (min-width: 1024px) { h1 { font-size: 28px; line-height: 34px; } }

/* ---------- environment banner ---------- */
.env-banner { background: var(--warn); color: #fff; text-align: center; font-weight: 600; padding: 4px 12px; font-size: 13px; letter-spacing: .03em; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
main { width: 100%; max-width: 960px; margin: 0 auto; padding: var(--space-6) var(--space-6) var(--space-8); }
main.wide { max-width: 1240px; }
main.narrow { max-width: 460px; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 30; height: 56px; display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-4); background: var(--brand); color: var(--on-brand); }
.topbar a, .topbar button, .topbar summary { color: inherit; }
.topbar .brand { font-weight: 800; font-size: 18px; text-decoration: none; letter-spacing: -.01em; white-space: nowrap; }
.topbar .org { font-weight: 700; font-size: 15px; text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.topbar .top-link { font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.topbar .top-link:hover { text-decoration: underline; }
.lang-inline { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.lang-inline button { background: none; border: 0; font: inherit; font-size: 14px; cursor: pointer; padding: 4px; color: inherit; }

/* account menu (a <details>) */
.menu { position: relative; }
.menu > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border-radius: var(--radius-md); border: 1px solid rgba(255, 255, 255, .5); cursor: pointer; font-size: 14px; font-weight: 600; white-space: nowrap; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: 44px; min-width: 240px; background: var(--surface-raised); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-raised); padding: var(--space-2); z-index: 50; }
.menu-panel .menu-head { padding: var(--space-2) var(--space-3); font-size: 13px; color: var(--ink-muted); }
.menu-panel a, .menu-panel button { display: flex; width: 100%; align-items: center; gap: var(--space-2); min-height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-md); background: none; border: 0; font: inherit; font-size: 15px; color: var(--ink); text-decoration: none; text-align: left; cursor: pointer; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-sunken); color: var(--ink); }
.menu-panel form { margin: 0; }
.menu-panel hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-1) 0; }
.menu-panel .ic { color: var(--ink-muted); }

/* sidebar (computer) / rail (tablet) */
.sidebar { display: none; flex: none; background: var(--surface-raised); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .side-brand { display: flex; align-items: center; height: 56px; padding: 0 var(--space-4); font-weight: 800; font-size: 20px; color: var(--brand); text-decoration: none; letter-spacing: -.01em; border-bottom: 1px solid var(--line); }
.sidebar .side-org { padding: var(--space-3) var(--space-4) 0; }
.sidebar .side-org b { display: block; font-size: 15px; }
.nav-group { font-size: 12px; font-weight: 600; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .04em; padding: var(--space-4) var(--space-4) 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; min-height: 40px; margin: 0 var(--space-2); padding: 0 var(--space-3); border-radius: var(--radius-md); color: var(--ink); text-decoration: none; font-size: 15px; font-weight: 500; }
.nav-item .ic { color: var(--ink-muted); flex: none; }
.nav-item:hover { background: var(--surface-sunken); color: var(--ink); }
.nav-item.on { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.nav-item.on .ic { color: var(--brand); }

@media (min-width: 768px) and (max-width: 1023px) {
    .sidebar { display: block; width: 88px; padding-bottom: var(--space-4); }
    .sidebar .side-brand { font-size: 13px; justify-content: center; padding: 0; }
    .sidebar .side-org, .sidebar .nav-group { display: none; }
    .sidebar .nav-list { padding-top: var(--space-2); }
    .nav-item { flex-direction: column; justify-content: center; gap: 2px; min-height: 60px; margin: 2px 8px; padding: 4px 2px; font-size: 11px; font-weight: 600; text-align: center; line-height: 1.2; }
    .nav-item .ic { width: 22px; height: 22px; }
}
@media (min-width: 1024px) {
    .sidebar { display: block; width: 240px; }
    .topbar { background: var(--surface-raised); color: var(--ink); border-bottom: 1px solid var(--line); }
    .topbar .menu > summary { border-color: var(--line-strong); }
}

/* phone bottom bar and "More" sheet */
.tabbar { display: none; }
@media (max-width: 767px) {
    main, main.wide { padding: var(--space-4) var(--space-3) 112px; }
    main.narrow { padding-bottom: var(--space-8); }
    .topbar { padding: 0 var(--space-3); }
    .hide-phone { display: none !important; }
    .tabbar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(68px + env(safe-area-inset-bottom)); padding: 6px 8px env(safe-area-inset-bottom); background: var(--surface-raised); border-top: 1px solid var(--line); box-shadow: var(--shadow-bar); }
    .tab, .tabbar .more > summary { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: 56px; border-radius: var(--radius-md); font-size: 12px; font-weight: 600; color: var(--ink-muted); text-decoration: none; cursor: pointer; list-style: none; }
    .tabbar .more > summary::-webkit-details-marker { display: none; }
    .tab.on, .tabbar .more[open] > summary { color: var(--brand); background: var(--brand-soft); }
    .tab .scan-dot { width: 52px; height: 52px; margin-top: -22px; border-radius: 26px; background: var(--accent); color: var(--ink); display: flex; align-items: center; justify-content: center; border: 4px solid var(--surface-raised); box-shadow: var(--shadow-raised); }
    .tab-scan.on { background: none; }
    .more-sheet { position: fixed; left: 0; right: 0; top: 0; padding-top: var(--space-2); bottom: calc(68px + env(safe-area-inset-bottom)); overflow-y: auto; background: var(--surface-raised); padding-bottom: var(--space-4); }
    .more-sheet .nav-item { min-height: var(--tap); font-size: 16px; }
}
@media print { .topbar, .sidebar, .tabbar, .env-banner, .no-print { display: none !important; } main { padding: 0; max-width: none; } }

/* ---------- components ---------- */
.card { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-6); margin-bottom: var(--space-4); }
@media (max-width: 767px) { .card { padding: var(--space-4); } }
.card > :last-child { margin-bottom: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--tap); margin-top: var(--space-4); padding: 0 var(--space-4); border-radius: var(--radius-md); border: 1px solid var(--brand); background: var(--brand); color: var(--on-brand); font: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer; text-align: center; }
.btn:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--on-brand); }
.btn.secondary { background: var(--surface-raised); color: var(--brand); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #8f1c13; border-color: #8f1c13; }
.btn.full { width: 100%; }
.btn .ic { flex: none; }
@media (max-width: 767px) { form > .btn[type=submit]:last-child, form > button.btn:last-child { width: 100%; } }

.link-button { background: none; border: 0; color: var(--danger); cursor: pointer; font: inherit; font-size: 14px; padding: 0; text-decoration: underline; }
.inline-form { display: inline; margin: 0; }
.links { margin-top: var(--space-4); font-size: 14px; }

label { display: block; font-weight: 600; font-size: 14px; margin: var(--space-4) 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=tel], input[type=search], input[type=url], select, textarea {
    width: 100%; min-height: var(--tap); padding: 10px 12px; font: inherit; font-size: 16px; color: var(--ink);
    border: 1px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface-raised);
}
textarea { min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--line-strong); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--brand); vertical-align: -4px; margin-right: 6px; }
input[type=file] { font: inherit; font-size: 15px; max-width: 100%; }
.code-input { font-size: 24px !important; letter-spacing: .2em; text-align: center; }
.error-text { color: var(--danger); font-size: 14px; margin-top: 6px; }

.grid2, .grid3 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-4); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 767px) { .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 768px) and (max-width: 1023px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.notice { border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4); font-size: 15px; line-height: 1.5; border: 1px solid transparent; }
.notice.ok { background: var(--ok-soft); color: #145a33; border-color: #b9dcc6; }
.notice.warn { background: var(--warn-soft); color: #6f3604; border-color: #f2cf9a; }
.notice.error { background: var(--danger-soft); color: var(--danger); border-color: #f4bdb6; }

.tag, .badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; background: var(--surface-sunken); color: var(--ink-muted); white-space: nowrap; }
.tag.off, .badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.warm { background: var(--accent-soft); color: var(--accent-ink); }
.badge.brand { background: var(--brand-soft); color: var(--brand); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-sunken); }
tbody tr:hover td { background: #faf9f6; }
td a { color: var(--brand); }
@media (max-width: 1023px) { table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; } }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
dt { color: var(--ink-muted); }
dd { margin: 0; }
@media (max-width: 479px) { dl { grid-template-columns: minmax(0, 1fr); gap: 2px; } dd { margin-bottom: var(--space-2); font-weight: 500; } }

details > summary { cursor: pointer; color: var(--brand); font-weight: 600; margin-top: 10px; min-height: 32px; }
.menu > summary, .more > summary { margin-top: 0; }

.codes { font-family: var(--font-mono); font-size: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; background: var(--surface-sunken); padding: var(--space-4); border-radius: var(--radius-md); }
.secret { font-family: var(--font-mono); word-break: break-all; background: var(--surface-sunken); padding: 8px 10px; border-radius: var(--radius-sm); }
#qr svg { width: 200px; height: 200px; }

/* ---------- page building blocks ---------- */
.small { font-size: 14px; line-height: 20px; }
.only-desktop { display: none; }
@media (min-width: 1024px) { .only-desktop { display: block; } .not-desktop { display: none !important; } }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-3) var(--space-4); margin-bottom: var(--space-4); }
.page-head h1 { margin: 0; }
.page-head p { margin: 2px 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.page-actions .btn { margin-top: 0; }
@media (max-width: 767px) { .page-actions { width: 100%; } .page-actions .btn { flex: 1 1 auto; } }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; text-decoration: none; margin-bottom: var(--space-3); }
.card.flush { padding: 0; overflow: hidden; }
.card.flush table { display: table; }
.pages { margin: var(--space-4) 0; }

/* filter bar: search first; the other filters fold away on a phone, one row on a computer */
.filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2) var(--space-3); align-items: end; background: var(--surface-sunken); border-radius: var(--radius-lg); padding: var(--space-3) var(--space-4) var(--space-4); margin-bottom: var(--space-4); }
.filters label { margin: 0 0 4px; font-size: 13px; }
.filters .btn { margin-top: 0; width: 100%; }
.filter-more > summary { margin: 0; min-height: 36px; display: flex; align-items: center; font-size: 15px; }
.filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2) var(--space-3); align-items: end; margin-top: var(--space-2); }
@media (min-width: 768px) {
    .filters { grid-template-columns: minmax(0, 2fr) minmax(0, 5fr) auto; }
    .filter-more > summary { display: none; }
    .filter-grid { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); margin-top: 0; }
    .filters .btn { width: auto; }
}
@media (min-width: 768px) and (max-width: 1023px) { .filters { grid-template-columns: minmax(0, 1fr) auto; } .filter-more { grid-column: 1 / -1; grid-row: 2; } }

/* badges row */
.badges { display: inline-flex; flex-wrap: wrap; gap: 4px; }

/* animal cards (phone: one column of rows; tablet: two columns) */
.animal-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2); }
@media (min-width: 768px) { .animal-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); } }
.animal-card { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3); background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--ink); text-decoration: none; min-height: var(--tap); }
.animal-card:hover { border-color: var(--brand); color: var(--ink); box-shadow: var(--shadow-raised); }
.animal-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 14px; line-height: 20px; }
.animal-text b { font-size: 16px; line-height: 22px; overflow-wrap: anywhere; }
.animal-text .badges { margin-top: 4px; }
.animal-photo { width: 76px; height: 76px; flex: none; border-radius: var(--radius-md); object-fit: cover; background: var(--surface-sunken); display: inline-flex; align-items: center; justify-content: center; color: var(--ink-muted); font-size: 12px; font-weight: 600; text-align: center; }
@media (min-width: 768px) { .animal-photo { width: 92px; height: 92px; } }
.animal-photo.sm { width: 44px; height: 44px; }
.animal-table td { vertical-align: middle; }
.animal-table .thumb-cell { width: 64px; }
.animal-table .row-link { font-weight: 700; color: var(--ink); text-decoration: none; }
.animal-table .row-link:hover { color: var(--brand); text-decoration: underline; }

/* quick page after a scan: big fields and buttons for the field */
.quick-head { display: flex; gap: var(--space-3); align-items: center; margin-bottom: var(--space-4); }
.quick-head h1 { margin: 0; font-size: 22px; overflow-wrap: anywhere; }
.quick-step > summary { font-size: 18px; margin: 0; padding: 4px 0; min-height: var(--tap); display: flex; align-items: center; }
.quick input[type=text], .quick input[type=date], .quick input[type=number], .quick select, .quick textarea { font-size: 18px; min-height: 52px; }
.quick #q_weight { font-size: 32px; font-weight: 700; text-align: center; min-height: 68px; }
.quick .btn { width: 100%; min-height: 52px; font-size: 17px; }
.quick-foot { display: flex; flex-direction: column; gap: var(--space-2); margin: var(--space-4) 0; }
.quick-foot .btn { margin-top: 0; }
@media (min-width: 768px) { .quick-foot { flex-direction: row; } .quick-foot .btn { flex: 1; } }

/* animal page: photo + name + actions, then the details */
.animal-hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); margin-bottom: var(--space-4); }
@media (min-width: 768px) { .animal-hero { grid-template-columns: 240px minmax(0, 1fr); gap: var(--space-6); align-items: start; } }
.hero-photo img, .hero-nophoto { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-lg); display: block; }
@media (min-width: 768px) { .hero-photo img, .hero-photo .hero-nophoto { aspect-ratio: 1 / 1; } }
.hero-nophoto { aspect-ratio: 16 / 7; background: var(--surface-sunken); color: var(--ink-muted); display: flex; align-items: center; justify-content: center; font-weight: 600; }
.photo-upload { margin-top: var(--space-2); }
.photo-upload > summary { margin-top: 0; font-size: 14px; }
.photo-upload form { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); }
.photo-upload .btn { margin-top: 0; }
.hero-text { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.hero-text h1 { margin: 0; overflow-wrap: anywhere; }
.quick-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); margin-top: var(--space-2); }
.quick-actions .btn { margin-top: 0; flex-direction: column; gap: 2px; min-height: 64px; padding: 6px 4px; font-size: 13px; }
@media (min-width: 1024px) { .quick-actions { display: flex; flex-wrap: wrap; } .quick-actions .btn { flex-direction: row; min-height: var(--tap); padding: 0 var(--space-4); font-size: 15px; } }
.hero-text .page-actions { margin-top: var(--space-2); }
@media (min-width: 1024px) { dl.details { grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); column-gap: var(--space-6); } }

/* Today page */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-4); }
@media (min-width: 1024px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); } }
.stat { display: flex; flex-direction: column; gap: 2px; padding: var(--space-4); background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--ink); text-decoration: none; }
.stat:hover { border-color: var(--brand); color: var(--ink); }
.stat b { font-size: 30px; line-height: 36px; }
.is-bad { color: var(--danger); } .is-warm { color: var(--accent-ink); } .is-warn { color: var(--warn); }
.today-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--space-4); }
@media (min-width: 1024px) { .today-grid { grid-template-columns: 3fr 2fr; } }
ul.todo { list-style: none; margin: 0; padding: 0; }
ul.todo li { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) 0; border-top: 1px solid var(--line); }
ul.todo li:first-child { border-top: 0; padding-top: 0; }
.dot { width: 10px; height: 10px; border-radius: 5px; flex: none; margin-top: 7px; background: var(--line-strong); }
.dot.bad { background: var(--danger); } .dot.warn { background: var(--warn); } .dot.warm { background: var(--accent); } .dot.brand { background: var(--brand); }
.money-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); align-items: center; }
.money-strip div { display: flex; flex-direction: column; }
.money-strip b { font-size: 20px; }
.money-strip .btn { margin-top: 0; }
@media (min-width: 768px) { .money-strip { grid-template-columns: 1fr 1fr auto; } }

/* a row of fields with its button: wraps to one field a line on a phone */
.form-row { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: flex-end; }
.form-row > * { flex: 1 1 160px; min-width: 0; }
.form-row > :first-child { flex-grow: 2; }
.form-row label { margin-top: var(--space-2); }
.form-row .btn, .form-row > button, .form-row > div:last-child:has(> .btn:only-child) { flex: 0 0 auto; margin-top: 0; }
.form-row input[type=checkbox] + *, .form-row label:has(input[type=checkbox]) { flex: 0 1 auto; }
@media (max-width: 767px) { .form-row > * { flex-basis: 100%; } .form-row .btn { width: 100%; } }
/* photo beside text, stacked on a phone */
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
@media (min-width: 768px) { .split { grid-template-columns: minmax(200px, 320px) minmax(0, 1fr); gap: var(--space-6); } }

/* tables on a phone: each row becomes a small card (labels from the column headers, see the layout script).
   Tables with many columns keep scrolling sideways. */
@media (max-width: 767px) {
    table.stack { display: block; overflow: visible; }
    table.stack thead { display: none; }
    table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
    table.stack tr { border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); margin-bottom: var(--space-2); background: var(--surface-raised); }
    table.stack td { border: 0; padding: 4px 0; }
    table.stack td::before { content: attr(data-label); display: block; color: var(--ink-muted); font-size: 12px; font-weight: 600; line-height: 16px; }
    table.stack td[data-label=""]::before { display: none; }
    table.stack td:empty { display: none; }
    table.stack tbody tr:hover td { background: none; }
    table.stack tfoot { display: block; }
    table.stack tfoot tr { background: var(--surface-sunken); }
}

/* "In the field" page (works offline) */
.field-status { display: flex; flex-direction: column; gap: 4px; }
.field-status .page-actions { margin-top: var(--space-2); }
.dot.ok-dot { background: var(--ok); }
.tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; background: var(--surface-sunken); padding: 4px; border-radius: var(--radius-md); margin-bottom: var(--space-3); }
.tab-btn { min-height: var(--tap); border: 0; border-radius: 8px; background: transparent; font: inherit; font-weight: 600; color: var(--ink-muted); cursor: pointer; }
.tab-btn.on { background: var(--surface-raised); color: var(--brand); box-shadow: var(--shadow-raised); }
.scan-video { width: 100%; max-height: 50vh; border-radius: var(--radius-md); background: #000; margin: var(--space-3) 0; object-fit: cover; }
.count-figure { font-size: 22px; text-align: center; margin-bottom: var(--space-2); }
.count-figure b { font-size: 40px; color: var(--brand); }
.field-animal h2 { margin: var(--space-3) 0 2px; font-size: 22px; }
.field-animal dl { margin: var(--space-3) 0; }

/* certificates */
.cert-head { display: flex; gap: var(--space-4); justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
.cert-code { font-family: var(--font-mono); font-size: 22px; font-weight: 700; letter-spacing: .08em; margin: var(--space-2) 0; }
.cert-qr { width: 140px; height: 140px; }
.cert-photo { width: 140px; height: 140px; object-fit: cover; border-radius: var(--radius-md); }
.cert-table { margin-top: var(--space-4); }
.cert-table th { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--brand); background: var(--brand-soft); }
.cert-table td:first-child { color: var(--ink-muted); width: 34%; }

/* 13 Nov 2026 - several choices in one filter (tick boxes), sortable table headers */
.filters .label { display: block; margin: 0 0 4px; font-size: 13px; font-weight: 600; }
.multi { position: relative; }
.multi > summary { list-style: none; cursor: pointer; min-height: 40px; display: flex; align-items: center; padding: 8px 32px 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface-raised); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.multi > summary::-webkit-details-marker { display: none; }
.multi > summary::after { content: '▾'; position: absolute; right: 10px; color: var(--muted); }
.multi-list { position: absolute; z-index: 20; left: 0; min-width: 100%; margin-top: 4px; padding: 6px; background: var(--surface-raised); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.multi-list label { display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px; font-weight: 400; font-size: 15px; border-radius: 6px; white-space: nowrap; }
.multi-list label:hover { background: var(--surface-sunken); }
.multi-list input { width: 18px; height: 18px; margin: 0; }
a.th-sort { color: inherit; text-decoration: none; }
a.th-sort:hover, a.th-sort.on { color: var(--brand, #1d5bd6); }

/* 14 Nov 2026 - public website (Home, Features, Pricing, About, Contact) */
.site { background: var(--surface-raised); }
.site-wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--space-6); box-sizing: border-box; }
.site-head { position: sticky; top: 0; z-index: 30; background: var(--surface-raised); border-bottom: 1px solid var(--line); }
.site-head-row { display: flex; align-items: center; gap: var(--space-4); height: 64px; }
.site-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.site-brand:hover { color: var(--ink); }
.site-logo { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: var(--on-brand); font-size: 14px; font-weight: 800; }
.site-nav { display: none; gap: var(--space-1); margin-left: var(--space-6); }
.site-nav a { padding: 8px 12px; border-radius: var(--radius-md); color: var(--ink); text-decoration: none; font-weight: 500; font-size: 15px; }
.site-nav a:hover { background: var(--surface-sunken); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); }
.site-signin { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }
.site-cta { margin: 0; white-space: nowrap; }
.site-head .spacer { flex: 1; }
.site-lang, .site-burger { position: relative; }
.site-lang > summary, .site-burger > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; border-radius: var(--radius-md); border: 1px solid var(--line); cursor: pointer; font-size: 14px; font-weight: 600; color: var(--ink); }
.site-lang > summary::-webkit-details-marker, .site-burger > summary::-webkit-details-marker { display: none; }
.site-lang-panel, .site-burger-panel { position: absolute; right: 0; top: 48px; min-width: 200px; background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-raised); padding: var(--space-2); z-index: 50; }
.site-lang-panel form { margin: 0; }
.site-lang-panel button, .site-burger-panel a { display: flex; align-items: center; width: 100%; min-height: 44px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-md); background: none; font: inherit; font-size: 15px; color: var(--ink); text-decoration: none; text-align: left; cursor: pointer; box-sizing: border-box; }
.site-lang-panel button:hover, .site-burger-panel a:hover { background: var(--surface-sunken); color: var(--ink); }
.site-lang-panel button[aria-current], .site-burger-panel a[aria-current] { color: var(--brand); font-weight: 600; }
.site-burger-panel hr { border: 0; border-top: 1px solid var(--line); margin: var(--space-2) 0; }
.site-burger-panel .btn { justify-content: center; color: var(--on-brand); margin-top: var(--space-2); }
.site-burger-panel .btn:hover { background: var(--brand-hover); color: var(--on-brand); }
@media (min-width: 960px) { .site-nav { display: flex; } .site-burger { display: none; } }
@media (max-width: 959px) { .site-lang > summary span { display: none; } }

.site-main { max-width: none; padding: 0; }
.site-section { padding: 56px 0; }
.site-section.alt { background: var(--surface); }
.site-hero { padding: 48px 0 56px; background: linear-gradient(180deg, var(--brand-soft) 0%, var(--surface-raised) 100%); }
.site-hero-grid { display: grid; gap: 40px; align-items: center; }
@media (min-width: 960px) { .site-hero-grid { grid-template-columns: 1.1fr 1fr; } .site-hero { padding: 72px 0 80px; } }
.eyebrow { display: inline-block; margin-bottom: var(--space-3); padding: 4px 12px; border-radius: var(--radius-pill); background: var(--surface-raised); color: var(--brand); font-size: 13px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; }
.site-h1 { margin: 0 0 var(--space-4); font-size: 34px; line-height: 1.15; font-weight: 800; letter-spacing: -.02em; }
@media (min-width: 960px) { .site-h1 { font-size: 46px; } }
.site-h2 { margin: 0 0 var(--space-3); font-size: 26px; line-height: 1.2; font-weight: 800; letter-spacing: -.01em; }
@media (min-width: 960px) { .site-h2 { font-size: 32px; } }
.lead { font-size: 18px; line-height: 1.6; color: var(--ink-muted); margin: 0 0 var(--space-6); max-width: 640px; }
.site-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.site-actions .btn { margin: 0; min-height: 48px; padding: 0 22px; font-size: 16px; }
.section-head { max-width: 720px; margin-bottom: 32px; }
.feature-grid { display: grid; gap: var(--space-4); }
@media (min-width: 640px) { .feature-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .feature-grid { grid-template-columns: repeat(3, 1fr); } }
.feature { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-6); }
.feature h3 { margin: var(--space-3) 0 var(--space-2); font-size: 18px; }
.feature p { margin: 0; color: var(--ink-muted); font-size: 15px; }
.feature-ic { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.split-2 { display: grid; gap: 40px; align-items: center; }
@media (min-width: 960px) { .split-2 { grid-template-columns: 1fr 1fr; } }
.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-3); }
.ticks li { position: relative; padding-left: 32px; font-size: 16px; }
.ticks li::before { content: ''; position: absolute; left: 0; top: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5.5 10.5l3 3 6-7' fill='none' stroke='%231d5bd6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/16px no-repeat; }
.chip-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }
.chip-tile { background: var(--surface-raised); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4); }
.chip-tile b { display: block; font-size: 16px; }
.chip-tile span { color: var(--ink-muted); font-size: 14px; }
.cta-band { background: var(--brand); color: var(--on-brand); border-radius: 20px; padding: 40px var(--space-6); text-align: center; }
.cta-band .site-h2 { color: var(--on-brand); }
.cta-band p { color: rgba(255,255,255,.88); font-size: 17px; max-width: 620px; margin: 0 auto var(--space-6); }
.cta-band .site-actions { justify-content: center; }
.cta-band .btn { background: var(--surface-raised); color: var(--brand); }
.cta-band .btn:hover { background: var(--brand-soft); color: var(--brand-hover); }
.cta-band .btn.secondary { background: transparent; color: var(--on-brand); border: 1px solid rgba(255,255,255,.7); }

/* the example card in the hero */
.demo { position: relative; max-width: 420px; margin: 0 auto; width: 100%; }
.demo-card { background: var(--surface-raised); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 18px 50px rgba(29, 91, 214, .16); padding: var(--space-4); }
.demo-label { position: absolute; top: -12px; right: 16px; padding: 2px 10px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 700; }
.demo-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); margin-bottom: var(--space-3); }
.demo-stats div { background: var(--surface); border-radius: var(--radius-md); padding: 10px; }
.demo-stats b { display: block; font-size: 22px; line-height: 1.1; }
.demo-stats span { font-size: 12px; color: var(--ink-muted); }
.demo-animal { display: grid; grid-template-columns: 64px 1fr; gap: var(--space-3); align-items: center; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.demo-photo { width: 64px; height: 64px; border-radius: 14px; background: linear-gradient(135deg, #e8d9c2, #c9ad86); display: grid; place-items: center; color: #6b5233; }
.demo-animal b { display: block; }
.demo-animal .muted { font-size: 13px; }
.demo-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.demo-badges span { padding: 2px 8px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; background: var(--brand-soft); color: var(--brand); }
.demo-badges span.warn { background: var(--accent-soft); color: var(--accent-ink); }
.demo-owners { margin-top: var(--space-3); padding: var(--space-3); border-radius: var(--radius-md); background: var(--surface); font-size: 14px; display: flex; justify-content: space-between; gap: var(--space-2); }

/* features page */
.fsection { display: grid; gap: var(--space-4); padding: 32px 0; border-top: 1px solid var(--line); }
.fsection:first-child { border-top: 0; }
@media (min-width: 960px) { .fsection { grid-template-columns: 320px 1fr; gap: 48px; } }
.fsection h2 { display: flex; align-items: center; gap: var(--space-3); font-size: 22px; }

/* pricing */
.plan-grid { display: grid; gap: var(--space-4); }
@media (min-width: 960px) { .plan-grid { grid-template-columns: repeat(3, 1fr); } }
.plan { position: relative; display: flex; flex-direction: column; background: var(--surface-raised); border: 1px solid var(--line); border-radius: 20px; padding: var(--space-6); }
.plan.featured { border: 2px solid var(--brand); box-shadow: 0 18px 50px rgba(29, 91, 214, .14); }
.plan h2 { font-size: 20px; }
.plan .price { font-size: 30px; font-weight: 800; letter-spacing: -.01em; margin: var(--space-2) 0 var(--space-1); }
.plan .price small { font-size: 15px; font-weight: 500; color: var(--ink-muted); }
.plan .ticks { margin: var(--space-4) 0 var(--space-6); flex: 1; }
.plan .btn { margin: 0; justify-content: center; }
.plan-tag { position: absolute; top: -12px; left: 24px; padding: 2px 10px; border-radius: var(--radius-pill); background: var(--brand-soft); color: var(--brand); font-size: 12px; font-weight: 700; }

/* footer */
.site-foot { border-top: 1px solid var(--line); background: var(--surface); padding: 40px 0 24px; margin-top: 0; }
.site-foot-grid { display: grid; gap: var(--space-6); }
@media (min-width: 760px) { .site-foot-grid { grid-template-columns: 2fr 1fr 1fr; } }
.site-foot h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); }
.site-foot-grid a:not(.site-brand) { display: block; padding: 4px 0; color: var(--ink); text-decoration: none; }
.site-foot-grid a:not(.site-brand):hover { color: var(--brand); }
.site-copy { margin-top: var(--space-6); font-size: 13px; }
