/* Afrinda Soil Intelligence — application styles. Plain CSS, no build step. */

:root {
    color-scheme: light;
    --page: #f9f9f7;
    --surface: #fcfcfb;
    --ink: #0b0b0b;
    --ink-2: #52514e;
    --muted: #6f6d68;
    --grid: #e1e0d9;
    --axis: #c3c2b7;
    --border: rgba(11, 11, 11, 0.10);
    --brand: #1f6f43;
    --brand-hover: #185a36;
    --focus: #2a78d6;

    /* Status — always paired with an icon and a label. */
    --good: #0ca30c;
    --good-ink: #006300;
    --critical: #d03b3b;
    --critical-ink: #a32222;
    --critical-wash: #fbeaea;

    /* Chart series: one fixed colour per device, assigned in order. */
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --series-3: #1baf7a;
    --series-4: #eda100;
    --series-5: #e87ba4;
    --series-6: #008300;
    --series-7: #6250d6;
    --series-8: #e34948;
    --series-other: #898781;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --page: #0d0d0d;
        --surface: #1a1a19;
        --ink: #f0efec;
        --ink-2: #c3c2b7;
        --muted: #9a988f;
        --grid: #2c2c2a;
        --axis: #383835;
        --border: rgba(255, 255, 255, 0.10);
        --brand: #23804f;
        --brand-hover: #2a9159;
        --focus: #6da7ec;

        --good-ink: #3fbf3f;
        --critical-ink: #f08a8a;
        --critical-wash: #3a1c1c;

        --series-1: #3987e5;
        --series-2: #d95926;
        --series-3: #199e70;
        --series-4: #c98500;
        --series-5: #d55181;
        --series-6: #0ca30c;
        --series-7: #9085e9;
        --series-8: #e66767;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1rem; margin: 28px 0 12px; color: var(--ink-2); font-weight: 600; }
.muted { color: var(--muted); margin: 0; font-size: 0.875rem; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---- App shell: sidebar on the left, slim top bar with the profile in the corner ---- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.05rem; color: var(--ink); text-decoration: none; }
.brand-lg { font-size: 1.35rem; }
.brand-name { display: flex; flex-direction: column; line-height: 1.1; }
.brand-tag { font-size: 0.62em; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); margin-top: 2px; white-space: nowrap; }
.logo { flex: none; }

.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.shell-main { min-width: 0; }

.sidebar {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column; gap: 18px;
    padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--border);
}
.sidebar .brand { padding: 4px 10px 0; }
.side-nav { display: grid; gap: 2px; }
.side-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 10px; border-radius: 8px;
    color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.side-nav a svg { flex: none; color: var(--muted); }
.side-nav a:hover { color: var(--ink); background: var(--page); }
.side-nav a[aria-current="page"] { color: var(--ink); background: var(--chip); font-weight: 600; }
.side-nav a[aria-current="page"] svg { color: var(--brand); }

.topbar {
    position: sticky; top: 0; z-index: 900;
    display: flex; align-items: center; gap: 12px; min-height: 56px;
    padding: 8px clamp(16px, 4vw, 32px);
    background: var(--surface); border-bottom: 1px solid var(--border);
}
.menu-btn, .topbar-brand { display: none; }
.menu-btn { place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; }

/* Profile: avatar in the top-right corner, opens a small account menu. */
.profile { position: relative; margin-left: auto; }
.profile summary {
    display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer;
    padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid transparent; color: var(--ink-2);
}
.profile summary::-webkit-details-marker { display: none; }
.profile summary:hover, .profile[open] summary { border-color: var(--border); background: var(--page); color: var(--ink); }
.profile-name { font-size: 0.9rem; font-weight: 500; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile[open] .profile-caret { transform: rotate(180deg); }
.avatar {
    display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%;
    background: var(--brand); color: #fff; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.02em;
}
.avatar-lg { width: 44px; height: 44px; font-size: 1rem; }
.profile-menu {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 1000;
    width: min(290px, calc(100vw - 32px)); display: grid; gap: 14px; padding: 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
}
.profile-head { display: flex; gap: 12px; align-items: flex-start; padding-bottom: 14px; border-bottom: 1px solid var(--grid); }
.profile-head > div { display: grid; gap: 3px; min-width: 0; }
.profile-head .sub { overflow-wrap: anywhere; }
.profile-head .badge { width: fit-content; margin-top: 4px; }
.profile-menu .lang-form, .profile-menu .lang-form select { width: 100%; }
.profile-menu form { margin: 0; }
.btn-full { width: 100%; }
.profile-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: -4px -6px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.profile-link:hover { background: var(--page); color: var(--ink); }
.profile-link svg { color: var(--muted); }

/* ---- Buttons & forms ---- */
.btn {
    font: inherit; font-weight: 600; cursor: pointer;
    border-radius: 8px; border: 1px solid transparent; padding: 8px 14px;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-quiet { background: transparent; color: var(--ink-2); border-color: var(--border); }
.btn-quiet:hover { color: var(--ink); border-color: var(--axis); }
.btn-block { width: 100%; padding: 11px 14px; margin-top: 20px; }

input[type="email"], input[type="password"], select {
    font: inherit; color: var(--ink); background: var(--surface);
    border: 1px solid var(--axis); border-radius: 8px; padding: 9px 11px;
}
input[type="email"], input[type="password"] { width: 100%; }

.alert { border-radius: 8px; padding: 10px 14px; margin: 16px 0; font-size: 0.9rem; }
.alert-error { background: var(--critical-wash); color: var(--critical-ink); border: 1px solid var(--critical); }

/* ---- Sign-in page ---- */
.auth-card {
    width: 100%; max-width: 380px; padding: 32px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.auth-tagline { color: var(--muted); margin: 6px 0 22px; }
.auth-card label { display: block; font-weight: 600; font-size: 0.875rem; margin: 14px 0 6px; }
.auth-card label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; color: var(--ink-2); }

/* ---- Page ---- */
/* Pages use the full width beside the sidebar. */
.page { width: 100%; margin: 0; padding: 24px clamp(16px, 3vw, 40px) 40px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.filters { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: flex-end; margin-top: 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }

.segmented { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--axis); border-radius: 8px; overflow: hidden; background: var(--surface); }
.segmented button {
    font: inherit; color: var(--ink-2); background: transparent; cursor: pointer;
    border: 0; border-right: 1px solid var(--grid); padding: 8px 12px; white-space: nowrap;
}
.segmented button:last-child { border-right: 0; }
.segmented button:hover { color: var(--ink); background: var(--page); }
.segmented button[aria-pressed="true"] { background: var(--brand); color: #fff; font-weight: 600; }

.empty { margin-top: 28px; padding: 40px 24px; text-align: center; background: var(--surface); border: 1px dashed var(--axis); border-radius: 12px; }
.empty h2 { margin: 0 0 6px; color: var(--ink); font-size: 1.1rem; }
.empty p { margin: 0; color: var(--ink-2); }

/* ---- Device cards ---- */
.device-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.device-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.device-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.device-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; min-width: 0; }
.device-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swatch { flex: none; width: 16px; height: 3px; border-radius: 2px; background: var(--series-other); }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.status svg { flex: none; }
.status-online { color: var(--good-ink); }
.status-offline { color: var(--critical-ink); }

.device-seen { margin: 2px 0 12px; color: var(--muted); font-size: 0.8rem; }
.device-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 12px; margin: 0; align-items: end; }
.device-metrics dt { color: var(--ink-2); font-size: 0.78rem; }
.device-metrics dd { margin: 2px 0 0; font-size: 1.45rem; font-weight: 600; line-height: 1.15; }
.device-metrics dd small { font-size: 0.85rem; font-weight: 500; color: var(--ink-2); margin-left: 2px; }

/* ---- Charts ---- */
.chart-grid { display: grid; grid-template-columns: 1fr; gap: 14px; transition: opacity 0.15s; }
.chart-grid.is-loading { opacity: 0.55; }
@media (min-width: 900px) {
    .chart-grid { grid-template-columns: 1fr 1fr; }
    .chart-card:first-child { grid-column: 1 / -1; }
}
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; min-width: 0; }
.chart-title { margin: 0; font-size: 1rem; font-weight: 600; }
.chart-title small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 0.82rem; color: var(--ink-2); }
.chart-legend li { display: inline-flex; align-items: center; gap: 6px; }
.chart-canvas { position: relative; height: 240px; margin-top: 10px; }
.chart-card:first-child .chart-canvas { height: 300px; }
.chart-empty { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 0.9rem; }

.chart-card details { margin-top: 10px; font-size: 0.85rem; }
.chart-card summary { cursor: pointer; color: var(--ink-2); width: fit-content; }
.table-wrap { max-height: 260px; overflow: auto; margin-top: 8px; border: 1px solid var(--grid); border-radius: 8px; }
table.data { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.data th, table.data td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--grid); white-space: nowrap; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th { position: sticky; top: 0; background: var(--surface); color: var(--ink-2); font-weight: 600; }
table.data tbody tr:last-child td { border-bottom: 0; }

/* =====================================================================
   Phase 2 — navigation, farm & device management
   ===================================================================== */

a { color: var(--link); }
:root { --link: #1c5cab; --chip: #efeee9; --organic-wash: #e3f3e3; --conv-wash: #fdf1d6; --conv-ink: #7a5200; }
@media (prefers-color-scheme: dark) {
    :root { --link: #86b6ef; --chip: #2a2a28; --organic-wash: #17331a; --conv-wash: #3a2e10; --conv-ink: #f0c868; }
}

.flash { margin: 16px clamp(16px, 3vw, 40px) 0; padding: 10px 14px; border-radius: 8px; background: var(--organic-wash); color: var(--good-ink); border: 1px solid var(--good); font-size: 0.9rem; }

/* Forms stay a readable width, aligned with the rest of the page. */
.page-narrow { max-width: 960px; }
.page-head .btn, a.btn { text-decoration: none; display: inline-block; }
.crumbs { margin: 0 0 8px; font-size: 0.875rem; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.strong { font-weight: 600; color: var(--ink); }
.sub { display: block; color: var(--muted); font-size: 0.8rem; font-weight: 400; }
td .sub, dd .sub { margin-top: 1px; }

.btn-danger { background: transparent; color: var(--critical-ink); border-color: var(--critical); }
.btn-danger:hover { background: var(--critical-wash); }
.danger-zone { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--grid); }

/* ---- Stat row ---- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin: 18px 0 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.stat dt { color: var(--ink-2); font-size: 0.8rem; }
.stat dd { margin: 4px 0 0; font-size: 1.7rem; font-weight: 600; line-height: 1.1; }
.stat dd small { font-size: 0.9rem; font-weight: 500; color: var(--ink-2); margin-left: 4px; }

/* ---- List tables ---- */
.table-card { margin-top: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow-x: auto; }
table.list { border-collapse: collapse; width: 100%; }
table.list th, table.list td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.list thead th { color: var(--ink-2); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
table.list tbody tr:last-child td { border-bottom: 0; }
table.list .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.list a { text-decoration: none; }
table.list a:hover { text-decoration: underline; }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: var(--chip); color: var(--ink-2); border: 1px solid var(--border); white-space: nowrap; }
.badge-stage-c1, .badge-stage-c2 { background: var(--conv-wash); color: var(--conv-ink); }
.badge-stage-o { background: var(--organic-wash); color: var(--good-ink); }
.chip { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--chip); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.status-waiting { color: var(--muted); }

/* ---- Forms ---- */
.form { display: grid; gap: 16px; margin-top: 16px; }
.form label { display: grid; gap: 6px; font-weight: 600; font-size: 0.875rem; }
.form input, .form select, .form textarea {
    font: inherit; font-weight: 400; color: var(--ink); background: var(--surface);
    border: 1px solid var(--axis); border-radius: 8px; padding: 9px 11px; width: 100%;
}
.form textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-row-3 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.form .hint { font-weight: 400; color: var(--muted); font-size: 0.8rem; }
.form .error, .error { font-weight: 500; color: var(--critical-ink); font-size: 0.85rem; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.form-inline { margin-top: 12px; }

/* ---- Farm page ---- */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 18px 0 0; }
.facts dt { color: var(--ink-2); font-size: 0.8rem; }
.facts dd { margin: 3px 0 0; font-weight: 500; }
.facts-wide { grid-column: 1 / -1; }
.facts-wide dd { font-weight: 400; white-space: pre-line; }

.plot-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.plot h3 { margin: 0; font-size: 1.05rem; }
.plot-head { display: flex; justify-content: space-between; gap: 12px; }
.plot-stage { text-align: right; }
.plot-stage .sub { margin-top: 4px; }
.plot-devices { margin: 12px 0; display: flex; flex-wrap: wrap; gap: 6px; }
.plot details, .add-plot { font-size: 0.9rem; }
.plot details { margin-top: 8px; }
.plot summary, .add-plot summary { cursor: pointer; color: var(--link); width: fit-content; font-weight: 500; }
.add-plot { margin-top: 14px; }

.timeline { list-style: none; margin: 10px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--grid); display: grid; gap: 12px; }
.timeline li > span:not(.badge) { margin-left: 6px; color: var(--ink-2); }
.timeline p { margin: 4px 0 0; }

.notice { margin-top: 18px; }
.notice h2 { margin: 0 0 4px; color: var(--ink); }
.unregistered { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.unregistered li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--grid); }
.unregistered .sub { flex: 1; min-width: 180px; }

/* Farm page: period filter, device cards and charts stack without headings between them. */
.filters + .alert, .filters + .device-grid, .alert + .device-grid { margin-top: 16px; }
.device-grid + .chart-grid { margin-top: 14px; }

/* =====================================================================
   Visits, map
   ===================================================================== */
.nowrap { white-space: nowrap; }
td.notes { white-space: pre-line; min-width: 180px; color: var(--ink-2); }
.alert-info { background: var(--conv-wash); color: var(--conv-ink); border: 1px solid var(--conv-ink); }
.alert-ok { background: var(--organic-wash); color: var(--good-ink); border: 1px solid var(--good); }
.alert .btn { margin-left: 8px; padding: 4px 10px; }
.form label.check { display: flex; align-items: flex-start; gap: 8px; font-weight: 400; }
.form label.check input { width: auto; margin-top: 3px; }
.form label .hint { display: inline; margin-left: 4px; }
.locate { display: grid; gap: 8px; padding: 14px; border: 1px dashed var(--axis); border-radius: 10px; }
.locate .btn { width: fit-content; }
.locate p { margin: 0; }
.locate p strong { color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.pager { display: flex; gap: 16px; justify-content: center; align-items: center; margin-top: 16px; font-size: 0.9rem; }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.plain-list .sub { display: inline; margin-left: 6px; }

.map { height: min(70vh, 620px); padding: 0; margin-top: 16px; overflow: hidden; z-index: 0; }
.map-note { margin-top: 8px; }
.map-key { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 0; padding: 0; font-size: 0.85rem; color: var(--ink-2); align-items: center; }
.farm-pin-wrap { background: none; border: 0; }
.farm-pin {
    display: inline-block; transform: translate(-50%, -50%); white-space: nowrap;
    padding: 3px 9px; border-radius: 999px; font: 700 12px/1.3 system-ui, sans-serif;
    background: #52514e; color: #fff; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
.map-key .farm-pin { transform: none; box-shadow: none; }
.farm-pin-c1, .farm-pin-c2 { background: #9a6700; }
.farm-pin-o { background: #1f6f43; }
.leaflet-container { font: inherit; }

/* `hidden` must always win over display rules such as `.form label.check { display: flex }`. */
[hidden] { display: none !important; }

/* Tablets and phones: the sidebar slides in over the page from the menu button. */
@media (max-width: 900px) {
    .shell { display: block; }
    .sidebar {
        position: fixed; inset: 0 auto 0 0; z-index: 1100; width: min(280px, 85vw);
        transform: translateX(-100%); visibility: hidden;
        transition: transform 0.2s ease, visibility 0s linear 0.2s;
        box-shadow: 0 0 32px rgba(0, 0, 0, 0.25);
    }
    .sidebar-open .sidebar { transform: none; visibility: visible; transition: transform 0.2s ease; }
    .sidebar-scrim { position: fixed; inset: 0; z-index: 1050; background: rgba(0, 0, 0, 0.4); }
    .menu-btn { display: grid; }
    .topbar-brand { display: inline-flex; }
}
@media (max-width: 560px) {
    .profile-name, .profile-caret { display: none; }
    .profile summary { padding: 0; }
    .topbar-brand span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .sidebar, .sidebar-open .sidebar { transition: none; }
}

/* =====================================================================
   Plot boundaries
   ===================================================================== */
.map-farm { height: min(55vh, 440px); }
.map-tall { height: min(68vh, 640px); margin-top: 12px; }
.plot .muted .sub { margin-top: 3px; }

.layer-switch { display: flex; background: #fff; }
.layer-switch button { font: 600 12px/1 system-ui, sans-serif; padding: 8px 10px; border: 0; background: #fff; color: #333; cursor: pointer; }
.layer-switch button + button { border-left: 1px solid #ccc; }
.layer-switch button[aria-pressed="true"] { background: #1f6f43; color: #fff; }

.plot-label { background: rgba(255, 255, 255, 0.92); border: 0; border-radius: 6px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); color: #0b0b0b; font: 600 12px/1.3 system-ui, sans-serif; padding: 3px 7px; }
.plot-label::before { display: none; }

.corner-pin {
    display: grid; place-items: center; transform: translate(-50%, -50%);
    width: 30px; height: 30px; border-radius: 50%; cursor: grab;
    background: #ffd23f; color: #0b0b0b; border: 2px solid #0b0b0b;
    font: 700 13px/1 system-ui, sans-serif; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
}

.boundary-bar { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; justify-content: space-between; margin-top: 16px; padding: 14px 18px; }
.boundary-readout { display: flex; gap: 28px; margin: 0; }
.boundary-readout dt { color: var(--ink-2); font-size: 0.8rem; }
.boundary-readout dd { margin: 2px 0 0; font-size: 1.3rem; font-weight: 600; }
.boundary-bar + .alert { margin-bottom: 0; }
.help-list { margin: 12px 0 0; padding-left: 18px; display: grid; gap: 4px; font-size: 0.875rem; }
.help-list strong { color: var(--ink-2); }

/* ---- Walk the boundary ---- */
.walk-panel { margin-top: 12px; border-color: var(--focus); }
.walk-panel h2 { margin: 0; color: var(--ink); }
.walk-instruction { margin: 8px 0 12px; font-size: 1.15rem; font-weight: 600; }
.walk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 12px; margin: 0 0 14px; }
.walk-stats dt { color: var(--ink-2); font-size: 0.78rem; }
.walk-stats dd { margin: 2px 0 0; font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- Language menu ---- */
.lang-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.lang-form select { font: inherit; font-size: 0.875rem; color: var(--ink-2); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; }
.auth-language { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--grid); text-align: center; }

/* ---- Warning flash (e.g. the broker could not be reached) ---- */
.flash-warning { background: var(--conv-wash); color: var(--conv-ink); border-color: var(--conv-ink); }
.badge-warn { margin-top: 6px; background: var(--conv-wash); color: var(--conv-ink); text-decoration: none; }
table.list a.badge-warn:hover { text-decoration: underline; }

/* =====================================================================
   Device: broker access
   ===================================================================== */
.broker { margin-top: 18px; display: grid; gap: 12px; }
.broker h2 { margin: 0; color: var(--ink); }
.broker .alert { margin: 0; }
.broker form { margin: 0; }
.broker-status { margin: 0; font-weight: 600; }
.broker-pending { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.broker-pending .btn { margin-left: 0; }
.broker-settings summary { cursor: pointer; color: var(--link); font-weight: 500; width: fit-content; }
.broker-settings .muted { margin: 8px 0; }
.code-block { position: relative; }
.code-block pre {
    margin: 0; padding: 14px 16px; overflow-x: auto;
    background: var(--page); border: 1px solid var(--grid); border-radius: 8px;
    font: 0.85rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.code-block .btn { margin-top: 8px; }
.copy-note { margin-left: 10px; font-size: 0.85rem; color: var(--good-ink); }

/* ---- API tokens ---- */
.token-new { margin-top: 18px; display: grid; gap: 10px; border-color: var(--focus); }
.token-new h2 { margin: 0; color: var(--ink); }
.token-new .muted { margin: 0; }
.token-new pre { overflow-wrap: anywhere; white-space: pre-wrap; }
.token-example-label { margin-top: 6px !important; }
.form-title { margin: 0; color: var(--ink); }
.btn-small { padding: 5px 10px; font-size: 0.85rem; }
table.list td.num form { margin: 0; }

/* =====================================================================
   Translate page
   ===================================================================== */
.field-grow { flex: 1 1 220px; }
.field-grow input { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--axis); border-radius: 8px; padding: 9px 11px; width: 100%; }
.translate-progress { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--ink-2); font-size: 0.9rem; }
.translate-progress progress { flex: 1; max-width: 360px; height: 10px; accent-color: var(--brand); }
.translate-list { display: grid; gap: 12px; }
/* Website content: one card per text, a box per language side by side, Save always in reach. */
.content-intro, .content-help { max-width: 72ch; }
.content-help { margin-top: 18px; font-size: 0.875rem; }
.content-flash { margin: 16px 0 0; }
.content-form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.content-item { padding: 14px 16px; }
.content-item header { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 6px; }
.content-item code { font-size: 0.8rem; color: var(--muted); }
.content-edited { background: var(--organic-wash); color: var(--good-ink); }
.content-also { font-size: 0.8rem; color: var(--muted); }
.content-doc { margin: 0 0 10px; font-size: 0.85rem; color: var(--ink-2); max-width: 80ch; }
.content-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px 20px; }
.content-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.content-field > span { font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }
.content-field textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--axis); border-radius: 8px; padding: 9px 11px; width: 100%; box-sizing: border-box; resize: vertical; line-height: 1.45; }
.content-field textarea[aria-invalid="true"] { border-color: var(--critical-ink); }
.content-original { font-size: 0.8rem; color: var(--muted); }
/* Right padding keeps the hint clear of the round assistant button in the corner. */
.content-save { position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 96px calc(12px + env(safe-area-inset-bottom, 0px)) 16px; margin-inline: -16px; background: var(--page); border-top: 1px solid var(--border); }
.content-save .muted { font-size: 0.85rem; }

/* Stock list: one table, a heading row per category, actions at the end of each row. */
.stock-list .stock-group th { padding-top: 18px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); background: var(--page); }
.stock-list tbody:first-of-type .stock-group th { padding-top: 10px; }
.stock-actions { white-space: nowrap; }

/* Settings: one card per group; the .env name is shown small, for whoever reads DEPLOY.md. */
.settings-form { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.settings-group { margin-top: 0; padding: 18px 20px; }
.settings-group .hint { margin: 4px 0 0; }
.settings-name { margin-left: 6px; font-size: 0.72rem; font-weight: 400; color: var(--muted); }
.settings-clear { margin-top: -8px; }
.settings-projects { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; min-width: 0; }
.settings-projects legend { padding: 0; margin-bottom: 4px; font-weight: 600; font-size: 0.875rem; }
.settings-project { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 10px 16px; }
@media (max-width: 560px) { .settings-project { grid-template-columns: 1fr; padding-bottom: 10px; border-bottom: 1px solid var(--border); } }

.translate-item { padding: 14px 16px; }
.translate-item header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.translate-item code { font-size: 0.8rem; color: var(--muted); }
.translate-item:not([data-todo]) .translate-todo { display: none; }
.translate-item.is-dirty { border-color: var(--focus); }
.translate-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 8px 24px; }
.translate-cols h3 { margin: 0 0 4px; font-size: 0.75rem; font-weight: 600; color: var(--ink-2); text-transform: none; }
.translate-source { margin: 0 0 10px; font-size: 1rem; white-space: pre-wrap; }
.translate-doc { margin: 0; font-size: 0.85rem; color: var(--ink-2); }
.translate-item textarea { font: inherit; width: 100%; color: var(--ink); background: var(--surface); border: 1px solid var(--axis); border-radius: 8px; padding: 9px 11px; resize: vertical; }
.translate-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.translate-status { font-size: 0.85rem; }
.translate-status.is-ok { color: var(--good-ink); }
.translate-status.is-error { color: var(--critical-ink); }

/* =====================================================================
   Alerts
   ===================================================================== */
.nav-count {
    margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px;
    background: var(--critical); color: #fff; font-size: 0.75rem; font-weight: 700; text-align: center;
}
.segmented a.segment { display: inline-block; padding: 8px 12px; color: var(--ink-2); text-decoration: none; border-right: 1px solid var(--grid); white-space: nowrap; }
.segmented a.segment:last-child { border-right: 0; }
.segmented a.segment:hover { color: var(--ink); background: var(--page); }
.segmented a.segment[aria-current="page"] { background: var(--brand); color: #fff; font-weight: 600; }
.badge-alert-dry_soil, .badge-alert-ph_out_of_range { background: var(--conv-wash); color: var(--conv-ink); }
.badge-alert-battery_low, .badge-alert-device_offline { background: var(--critical-wash); color: var(--critical-ink); }
.alert-text { margin-top: 4px; color: var(--ink); }
.farm-alerts { margin-top: 18px; border-color: var(--conv-ink); display: grid; gap: 10px; }
.farm-alerts h2 { margin: 0; color: var(--ink); }
.farm-alerts .badge { margin-right: 6px; }

/* =====================================================================
   Soil trends (sparklines)
   ===================================================================== */
.trend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px 24px; }
.trend { display: grid; gap: 4px; }
.trend-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.trend-name { color: var(--ink-2); font-size: 0.85rem; }
.trend-latest { font-weight: 600; font-variant-numeric: tabular-nums; }
.sparkline { color: var(--ink-2); overflow: visible; max-width: 100%; }
.sparkline-end { fill: var(--ink); stroke: var(--surface); stroke-width: 2; }
.sparkline-hit { fill: transparent; }
.sparkline-hit:hover { fill: var(--grid); fill-opacity: 0.6; }
.trend-dir { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.trend-dir .muted { font-weight: 400; margin-left: 4px; font-size: 0.8rem; }

/* =====================================================================
   Impact report
   ===================================================================== */
/* Stage ramp: one green hue, light → dark = less → more restored
   (validated: dataviz validate_palette.js --ordinal, light and dark). */
:root { --stage-conventional: #86c29e; --stage-in_conversion: #3a9a63; --stage-organic: #1f6f43; }
@media (prefers-color-scheme: dark) {
    :root { --stage-conventional: #2f6e4a; --stage-in_conversion: #3fa56a; --stage-organic: #8fd4a8; }
}
.stat-note { margin: 6px 0 0; color: var(--muted); font-size: 0.8rem; }
.impact-heroes .stat dd { font-size: 2rem; }
.impact-section { margin-top: 16px; }
.impact-section h2 { margin: 0 0 6px; color: var(--ink); }
.impact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.impact-grid .facts { margin-top: 12px; }
.stage-bar { display: flex; gap: 2px; height: 22px; margin-top: 14px; }
.stage-seg { min-width: 4px; }
.stage-seg:first-child { border-radius: 4px 0 0 4px; }
.stage-seg:last-child { border-radius: 0 4px 4px 0; }
.stage-seg:only-child { border-radius: 4px; }
.stage-seg-conventional { background: var(--stage-conventional); }
.stage-seg-in_conversion { background: var(--stage-in_conversion); }
.stage-seg-organic { background: var(--stage-organic); }
.stage-legend { display: flex; flex-wrap: wrap; gap: 6px 22px; list-style: none; margin: 10px 0 0; padding: 0; font-size: 0.875rem; color: var(--ink-2); }
.stage-legend li { display: inline-flex; align-items: center; gap: 6px; }
.stage-legend strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.stage-key { width: 12px; height: 12px; border-radius: 3px; }
.impact-method { margin-top: 24px; }
.fieldset { border: 1px solid var(--grid); border-radius: 10px; padding: 12px 14px 14px; margin: 0; display: grid; gap: 10px; }
.fieldset legend { font-weight: 600; font-size: 0.875rem; padding: 0 4px; }
.fieldset .hint { margin: 0; }

/* Print / "Save as PDF": just the report. */
@media print {
    .sidebar, .topbar, .sidebar-scrim, .no-print, .flash { display: none !important; }
    .shell { display: block; }
    body { background: #fff; color: #000; font-size: 12px; }
    .card, .stat, .table-card { break-inside: avoid; box-shadow: none; }
    .page { max-width: none; padding: 0; }
    .stage-seg, .stage-key { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
    a { color: inherit; text-decoration: none; }
}

/* =====================================================================
   Accounts: users page, profile, forgot password
   ===================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.user-list { list-style: none; margin: 16px 0 0; padding: 14px 18px; }
.user-item { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 0; border-bottom: 1px solid var(--grid); }
.user-item:first-child { padding-top: 4px; }
.user-item:last-child { border-bottom: 0; padding-bottom: 4px; }
.user-item.is-disabled .user-name input { color: var(--muted); text-decoration: line-through; }
.user-form { display: grid; grid-template-columns: minmax(180px, 1fr) 170px 110px auto; align-items: center; gap: 10px 14px; flex: 1 1 560px; margin: 0; }
.user-temp { margin: 0; width: 230px; }
.user-temp .btn { width: 100%; white-space: nowrap; }
.user-form input[type="text"], .user-form select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--axis); border-radius: 8px; padding: 7px 9px; width: 100%; }
.user-name { display: grid; gap: 2px; }
.user-form .check { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
@media (max-width: 720px) {
    .user-form { grid-template-columns: 1fr 1fr; }
    .user-name { grid-column: 1 / -1; }
    .user-temp { width: auto; }
}
.auth-heading { font-size: 1.15rem; margin: 18px 0 4px; }
.auth-forgot { margin: 14px 0 0; text-align: center; font-size: 0.875rem; }
.auth-card input[type="text"] { width: 100%; }
.auth-card input[type="password"] + .hint { display: block; }

/* =====================================================================
   Search in long lists
   ===================================================================== */
.search-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 16px 0 0; }
.search-bar input[type="search"] { flex: 1 1 260px; max-width: 420px; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--axis); border-radius: 8px; padding: 9px 11px; }
.select-search { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--axis); border-radius: 8px; padding: 7px 10px; width: 100%; margin-bottom: 6px; }
.form .select-search { padding: 9px 11px; font-weight: 400; }
.select-search-status { font-size: 0.8rem; color: var(--muted); font-weight: 400; min-height: 1em; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0 12px; }
.filter-bar input[type="search"] { flex: 1 1 240px; max-width: 360px; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--axis); border-radius: 8px; padding: 8px 10px; }
@media print { .filter-bar, .search-bar { display: none !important; } }
.map-find { margin: 16px 0 0; }
.map-find + .map { margin-top: 10px; }

/* ---- Install app ---- */
.install-btn { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding: 7px 12px; }
.install-btn + .notif { margin-left: 0; }
.install-btn[hidden] + .notif { margin-left: auto; }
.notif + .profile { margin-left: 0; }

/* Notifications: bell in the top bar with the open-alert count; opens the newest alerts. */
.notif { position: relative; margin-left: auto; }
.notif summary {
    position: relative; display: grid; place-items: center; width: 40px; height: 40px; list-style: none; cursor: pointer;
    border-radius: 999px; border: 1px solid transparent; color: var(--ink-2);
}
.notif summary::-webkit-details-marker { display: none; }
.notif summary:hover, .notif[open] summary { border-color: var(--border); background: var(--page); color: var(--ink); }
.notif-count {
    position: absolute; top: 1px; right: -2px; min-width: 18px; padding: 0 5px; border-radius: 999px;
    border: 2px solid var(--surface); background: var(--critical); color: #fff;
    font-size: 0.68rem; font-weight: 700; line-height: 15px; text-align: center;
}
.notif-menu {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 1000;
    width: min(340px, calc(100vw - 32px)); display: grid; padding: 6px 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
}
.notif-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 8px 16px 10px; border-bottom: 1px solid var(--grid); }
.notif-head strong { color: var(--ink); }
.notif-item { display: grid; gap: 4px; justify-items: start; padding: 10px 16px; border-bottom: 1px solid var(--grid); color: var(--ink); text-decoration: none; }
.notif-item:hover { background: var(--page); }
.notif-text { font-size: 0.875rem; }
.notif-empty { margin: 0; padding: 14px 16px; color: var(--muted); font-size: 0.875rem; }
.notif-all { padding: 10px 16px 6px; font-size: 0.875rem; font-weight: 600; text-decoration: none; }
.notif-all:hover { text-decoration: underline; }
.install-help { max-width: min(420px, calc(100vw - 32px)); border: 1px solid var(--border); border-radius: 14px; padding: 22px; background: var(--surface); color: var(--ink); }
.install-help::backdrop { background: rgba(0, 0, 0, 0.45); }
.install-help h2 { margin: 0 0 12px; color: var(--ink); font-size: 1.1rem; }
.install-help ol { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 8px; }
.install-help form { margin: 14px 0 0; text-align: right; }
.install-share { vertical-align: -3px; color: var(--focus); }
.install-card { display: grid; gap: 10px; }
.install-card p { margin: 0; }
.install-card .btn { width: fit-content; }
@media (max-width: 560px) {
    .install-btn span { display: none; }
    .install-btn { padding: 7px 9px; }
}

/* =====================================================================
   Card grids (devices, plots): 1 → 2 → 3 → 4 per row as the screen widens
   ===================================================================== */
@media (min-width: 640px)  { .device-grid, .plot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .device-grid, .plot-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1400px) { .device-grid, .plot-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---- Footer: the page fills the screen, the footer sits at the bottom ---- */
.shell-main { display: flex; flex-direction: column; min-height: 100vh; }
.shell-main > .page { flex: 1 0 auto; }
.site-footer {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 18px;
    padding: 14px clamp(16px, 3vw, 40px); border-top: 1px solid var(--border);
    color: var(--muted); font-size: 0.8rem;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; }
@media print { .site-footer { display: none; } }

/* ---- Device: soil moisture calibration ---- */
.calibration { margin-top: 18px; display: grid; gap: 12px; }
.calibration h2 { margin: 0; color: var(--ink); }
.calibration p { margin: 0; }
.calibration .table-card { margin-top: 0; }
.calibration table.list th, .calibration table.list td { padding: 9px 12px; }
.calibration table.list td form { margin: 0; }
.calibration .form { margin-top: 0; }
.calibration-status { font-weight: 600; }
.calibration-how summary { cursor: pointer; color: var(--link); font-weight: 500; width: fit-content; }
.calibration-how ol { margin: 8px 0; padding-left: 20px; display: grid; gap: 6px; font-weight: 400; }

/* =====================================================================
   Chat assistant (bottom-right corner)
   ===================================================================== */
.assistant { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 1200; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.assistant-launcher {
    width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
    display: grid; place-items: center; background: var(--brand); color: #fff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); transition: transform 0.15s ease;
}
.assistant-launcher:hover { transform: scale(1.06); background: var(--brand-hover); }
.assistant-launcher-close, .assistant.is-open .assistant-launcher-chat { display: none; }
.assistant.is-open .assistant-launcher-close { display: block; }
.assistant-panel {
    width: min(400px, calc(100vw - 32px)); height: min(600px, calc(100vh - 120px));
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
}
.assistant-head { display: flex; align-items: center; gap: 6px; padding: 14px 14px 12px 18px; background: var(--brand); color: #fff; }
.assistant-head > div { flex: 1; min-width: 0; }
.assistant-head h2 { margin: 0; font-size: 1rem; color: #fff; }
.assistant-head p { margin: 2px 0 0; font-size: 0.8rem; opacity: 0.85; }
.assistant-icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: #fff; cursor: pointer; }
.assistant-icon-btn:hover { background: rgba(255, 255, 255, 0.15); }
.assistant .chat { flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--page); }
.chat-q { align-self: flex-end; max-width: 85%; background: var(--brand); color: #fff; padding: 8px 12px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-a { align-self: flex-start; max-width: 100%; min-width: 0; background: var(--surface); border: 1px solid var(--border); padding: 10px 12px; border-radius: 14px 14px 14px 4px; display: grid; gap: 8px; }
.chat-a p { margin: 0; }
.chat-note { font-size: 0.8rem; color: var(--conv-ink); }
.chat-value { font-size: 1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.chat-value span { font-weight: 400; color: var(--ink-2); }
.chat-table { overflow: auto; max-height: 280px; border: 1px solid var(--grid); border-radius: 8px; }
.chat-table table { border-collapse: collapse; font-size: 0.82rem; width: 100%; }
.chat-table th, .chat-table td { padding: 6px 9px; border-bottom: 1px solid var(--grid); text-align: left; white-space: nowrap; }
.chat-table thead th { position: sticky; top: 0; background: var(--surface); color: var(--ink-2); font-weight: 600; }
.chat-table tbody th { color: var(--ink-2); font-weight: 600; background: var(--page); }
.chat-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.chat-table tr:last-child > * { border-bottom: 0; }
.chat-foot { font-size: 0.78rem; color: var(--muted); }
.chat-examples { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-button { font: inherit; font-size: 0.8rem; color: var(--ink-2); background: var(--page); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; cursor: pointer; text-align: left; }
.chip-button:hover { border-color: var(--brand); color: var(--ink); }
.chat-thinking { display: flex; gap: 4px; padding: 12px 14px; }
.chat-thinking span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: chat-dot 1s infinite ease-in-out; }
.chat-thinking span:nth-child(2) { animation-delay: 0.15s; }
.chat-thinking span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-dot { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }
.assistant-form { display: flex; gap: 8px; align-items: flex-end; padding: 10px; border-top: 1px solid var(--border); background: var(--surface); }
.assistant-form textarea { flex: 1; font: inherit; color: var(--ink); background: var(--page); border: 1px solid var(--axis); border-radius: 10px; padding: 9px 11px; resize: none; max-height: 120px; }
.assistant-form .btn { padding: 9px 12px; display: grid; place-items: center; }
/* Leave room so the button never covers the footer links. */
.site-footer { padding-right: 96px; }
@media (max-width: 560px) {
    .assistant { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); }
    .assistant.is-open { inset: 0; padding: 0; gap: 0; align-items: stretch; }
    .assistant.is-open .assistant-panel { width: 100%; height: 100%; border-radius: 0; border: 0; }
    .assistant.is-open .assistant-launcher { display: none; }
}
@media (prefers-reduced-motion: reduce) { .chat-thinking span { animation: none; } .assistant-launcher { transition: none; } }
@media print { .assistant { display: none; } }

/* ==== Public website (layouts/site.blade.php, views/site/) ==== */

.site { display: flex; flex-direction: column; min-height: 100vh; }
.site main { flex: 1 0 auto; }
.site-wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding-inline: clamp(16px, 4vw, 40px); }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 20; padding: 8px 12px; border-radius: 8px; background: var(--surface); color: var(--ink); }
.skip-link:focus { top: 8px; }

.site-header { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border); }
.site-header-row { display: flex; align-items: center; gap: 12px 20px; min-height: 64px; flex-wrap: wrap; }
.site-menu { display: flex; align-items: center; gap: 12px 20px; flex: 1; }
.site-nav { display: flex; gap: 4px; flex: 1; }
.site-menu-btn { display: none; margin-left: auto; place-items: center; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); cursor: pointer; }
.site-menu-btn:hover { border-color: var(--axis); }
.site-menu-close { display: none; }
.site-header.is-open .site-menu-open { display: none; }
.site-header.is-open .site-menu-close { display: block; }
.site-nav a { padding: 8px 10px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; white-space: nowrap; }
.site-nav a:hover { color: var(--ink); background: var(--chip); }
.site-nav a[aria-current="page"] { color: var(--ink); background: var(--chip); font-weight: 600; }
.site-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.site-actions .btn, .site-buttons .btn, .site-cta .btn { text-decoration: none; display: inline-block; }
.site-actions .btn { white-space: nowrap; }
.btn-lg { padding: 11px 20px; font-size: 1rem; }

.site-kicker { margin: 0 0 8px; color: var(--brand); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.04em; text-transform: uppercase; }
.site-lead { font-size: 1.125rem; color: var(--ink-2); margin: 14px 0 0; max-width: 62ch; }
.site h1 { font-size: clamp(1.9rem, 4.4vw, 3rem); line-height: 1.1; letter-spacing: -0.01em; }
.site h3 { margin: 0 0 6px; font-size: 1.05rem; }
.site .card p { margin: 0; color: var(--ink-2); }
.site-h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); color: var(--ink); margin: 0 0 16px; }

.site-hero { padding-block: clamp(24px, 4vw, 48px) clamp(8px, 2vw, 20px); }
.site-hero-grid { display: grid; gap: 32px; align-items: center; }
.site-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.site-art { border-radius: 16px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.site-art svg { display: block; width: 100%; height: auto; }
@media (min-width: 900px) {
    .site-hero-grid { grid-template-columns: 1fr 1.1fr; gap: 48px; }
}

.site-section { padding-block: clamp(20px, 3vw, 36px); }
.site-band { background: var(--surface); }
/* No doubled gap: a section right after the page title, and the closing sign-in box. */
.site-page-head + .site-section { padding-top: 12px; }
.site-section-cta { padding-top: 0; }
.site-step + .site-section-cta, .site-band + .site-section-cta { padding-top: clamp(20px, 3vw, 36px); }
.site-page-head { padding-block: clamp(24px, 4vw, 44px) 4px; }

.step-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.step-card a { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--ink-2); text-decoration: none; }
.step-card a:hover { border-color: var(--brand); }
.step-card strong { color: var(--ink); font-size: 1rem; }
.step-num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; margin-bottom: 4px; }
.site-more { font-weight: 600; text-decoration: none; }
.site-more:hover { text-decoration: underline; }

.site-stats { display: grid; gap: 12px; margin: 0 0 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.site-stats div { padding: 18px; border-radius: 12px; background: var(--page); border: 1px solid var(--border); display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 4px; }
.site-stats dt { color: var(--ink-2); font-size: 0.9rem; }
.site-stats dd { margin: 0; font-size: 2rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Public Impact page: the questions we are working to answer */
.site-q-total { display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap; margin: 0 0 18px; padding: 18px 20px; border-radius: 12px; background: var(--organic-wash); }
.site-q-total-num { font-size: clamp(2.4rem, 6vw, 3.25rem); font-weight: 800; line-height: 1; color: var(--brand); font-variant-numeric: tabular-nums; }
.site-q-total p { flex: 1 1 280px; margin: 0; color: var(--ink); font-size: 1.05rem; max-width: 62ch; }
.site-q-intro { color: var(--ink-2); max-width: 68ch; margin: 0 0 20px; }
.site-q-key { display: grid; gap: 12px; margin: 0 0 28px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.site-q-key div { padding: 14px 16px; border-radius: 12px; background: var(--page); border: 1px solid var(--border); }
.site-q-key dt { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.site-q-key dd { margin: 8px 0 0; color: var(--ink-2); font-size: 0.9rem; }
.site-q-num { font-size: 1.5rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.site-q-status, .site-q-forecast { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.site-q-answering { background: var(--organic-wash); color: var(--good-ink); }
.site-q-collecting { background: var(--conv-wash); color: var(--conv-ink); }
.site-q-planned { background: var(--chip); color: var(--ink-2); }
.site-q-forecast { border: 1px dashed var(--axis); color: var(--ink-2); }
.site-q-groups { display: grid; gap: 10px; }
.site-q-group { border: 1px solid var(--border); border-radius: 12px; background: var(--page); }
.site-q-group summary { display: flex; align-items: center; gap: 12px; padding: 16px 18px; cursor: pointer; list-style: none; border-radius: 12px; }
.site-q-group summary::-webkit-details-marker { display: none; }
.site-q-group summary:hover { background: var(--chip); }
.site-q-group summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.site-q-group[open] summary { border-bottom: 1px solid var(--border); border-radius: 12px 12px 0 0; }
.site-q-topic { flex: 1; font-weight: 600; font-size: 1.05rem; color: var(--ink); }
.site-q-count { color: var(--ink-2); font-size: 0.9rem; white-space: nowrap; }
.site-q-chevron { flex: none; color: var(--ink-2); transition: transform 0.15s ease; }
.site-q-group[open] .site-q-chevron { transform: rotate(180deg); }
.site-q-list { list-style: none; margin: 0; padding: 4px 18px 8px; }
.site-q-list li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.site-q-list li:last-child { border-bottom: 0; }
.site-q-text { flex: 1 1 240px; color: var(--ink); }
.site-q-tags { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.site-q-privacy { margin: 24px 0 0; }

.site-cols { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.site-step-grid { display: grid; gap: 20px 48px; align-items: center; }
.site-step h2 { margin: 0 0 12px; font-size: clamp(1.35rem, 2.6vw, 1.75rem); color: var(--ink); }
.site-step p { color: var(--ink-2); max-width: 60ch; }
@media (min-width: 900px) {
    .site-step-grid { grid-template-columns: 1fr 1fr; }
    .site-step:nth-of-type(even) .site-art { order: 2; }
}
.site-step:nth-of-type(even) { background: var(--surface); }
.site-points { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 8px; }
.site-points li { position: relative; padding-left: 30px; }
.site-points li::before { content: ""; position: absolute; left: 4px; top: 0.3em; width: 14px; height: 8px; border: solid var(--brand); border-width: 0 0 2.5px 2.5px; transform: rotate(-45deg); }
.site-points-numbered { counter-reset: point; }
.site-points-numbered li { counter-increment: point; }
.site-points-numbered li::before { content: counter(point); width: 22px; height: 22px; top: 0; left: 0; border: 0; transform: none; border-radius: 50%; background: var(--brand); color: #fff; font-size: 0.8rem; font-weight: 700; display: grid; place-items: center; }
.site-video { display: block; width: 100%; max-width: 100%; margin-top: 18px; border-radius: 12px; background: #000; aspect-ratio: 16 / 9; }

.tool-grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.tool-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--organic-wash); color: var(--brand); margin-bottom: 12px; }

.site-prose .site-h2 { margin-top: 28px; }
.site-prose > p { max-width: 68ch; color: var(--ink-2); }
.site-contact { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.site-contact address { font-style: normal; white-space: pre-line; color: var(--ink-2); }

/* Closing band: plain, on the page background, set apart by a thin line above. */
.site-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; padding-top: clamp(24px, 4vw, 36px); border-top: 1px solid var(--border); }
.site-cta h2 { margin: 0 0 4px; color: var(--ink); font-size: 1.35rem; }
.site-cta p { margin: 0; color: var(--ink-2); }

/* Website footer: a muted, greyish dark green, the same in light and dark mode (in dark
   mode a hairline on top marks where the page ends). */
.site-foot {
    --foot-bg: #22302a;
    --foot-ink: #f3f1ea;
    --foot-ink-2: rgba(243, 241, 234, 0.80);
    --foot-muted: rgba(243, 241, 234, 0.62);
    --foot-line: rgba(243, 241, 234, 0.14);
    --foot-accent: #e9b46a;
    background: var(--foot-bg); color: var(--foot-ink-2); margin-top: clamp(32px, 6vw, 64px);
}
@media (prefers-color-scheme: dark) { .site-foot { --foot-bg: #18211d; border-top: 1px solid var(--border); } }
/* One row: about on the left, the link columns (pages, contact, other projects; the last
   two only when set) together on the right, so it looks balanced with any number of them. */
.site-foot-cols { display: flex; flex-wrap: wrap; gap: 32px clamp(28px, 4vw, 56px); padding-block: clamp(36px, 5vw, 56px) 32px; }
.site-foot-about { flex: 1 1 220px; }
@media (max-width: 560px) { .site-foot-cols { flex-direction: column; } .site-foot-about { flex: none; } }
.site-foot-col { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; }

.site-foot-about p { margin: 6px 0 0; color: var(--foot-ink-2); font-size: 0.95rem; line-height: 1.55; max-width: 36ch; }
.site-foot h2 { margin: 0 0 6px; font-size: 0.78rem; font-weight: 700; color: var(--foot-accent); letter-spacing: 0.1em; text-transform: uppercase; }
.site-foot a { color: var(--foot-ink-2); text-decoration: none; text-underline-offset: 3px; }
.site-foot a:hover { color: var(--foot-ink); text-decoration: underline; }
.site-foot a:focus-visible, .site-foot select:focus-visible { outline: 2px solid #9cc9ff; outline-offset: 2px; border-radius: 4px; }
.site-foot .brand { color: var(--foot-ink); font-size: 1.15rem; }
.site-foot .brand:hover { text-decoration: none; }
.site-foot .brand-tag { color: var(--foot-ink-2); }
.site-foot-ic { display: inline-flex; align-items: flex-start; gap: 10px; }
.site-foot-ic svg { flex: none; margin-top: 2px; color: var(--foot-accent); }
.site-foot address { font-style: normal; color: var(--foot-ink-2); white-space: pre-line; }
.site-foot-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; padding-block: 18px 22px; border-top: 1px solid var(--foot-line); }
.site-foot-end { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.site-copy, .site-foot-made { color: var(--foot-muted); font-size: 0.875rem; }
.site-foot-made::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--foot-accent); vertical-align: 1px; }
.site-foot .lang-form select { color-scheme: dark; color: var(--foot-ink); background: transparent; border-color: var(--foot-line); }

/* Sign-in pages: the card sits in the middle of the space between header and footer. */
.auth-wrap { display: grid; place-items: center; padding: clamp(24px, 5vw, 56px) 16px; }
.site main:has(> .auth-wrap) { display: grid; }
.site .auth-heading { margin: 0; font-size: 1.5rem; line-height: 1.3; }
.site .auth-tagline { margin: 6px 0 4px; }

/* Closing band: two buttons. */
.site-cta-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-outline { background: transparent; color: var(--brand); border-color: var(--brand); text-decoration: none; display: inline-block; }
.btn-outline:hover { background: var(--organic-wash); color: var(--brand-hover); border-color: var(--brand-hover); }

/* Request a sensor */
.request-grid { display: grid; gap: 24px 40px; align-items: start; }
@media (min-width: 900px) { .request-grid { grid-template-columns: 1.6fr 1fr; } }
.request-form { display: grid; gap: 14px; padding: clamp(18px, 3vw, 28px); }
.request-fields { display: grid; gap: 14px 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.request-form label { display: grid; gap: 6px; font-weight: 600; font-size: 0.9rem; }
.request-form input, .request-form textarea {
    font: inherit; font-weight: 400; color: var(--ink); background: var(--surface);
    border: 1px solid var(--axis); border-radius: 8px; padding: 9px 11px; width: 100%;
}
.request-form textarea { resize: vertical; }
.request-form .optional { color: var(--muted); font-weight: 400; }
.request-form .alert { margin: 0; }
.request-sum { padding: 14px; border-radius: 10px; background: var(--page); border: 1px solid var(--border); }
.request-sum input { max-width: 140px; }
.request-form .btn { justify-self: start; }
.request-next h2 { margin: 0 0 10px; font-size: 1.15rem; color: var(--ink); }
.request-next .muted { margin-top: 16px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.request-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.request-actions form { margin: 0; }
.request-actions a.btn { text-decoration: none; }
.request-message { max-width: 34ch; white-space: pre-line; color: var(--ink-2); }

/* Narrow screens: menu as a scrolling row under the logo; language moves to the footer. */
@media (min-width: 1001px) and (max-width: 1240px) { .site-lang { display: none; } }
/* Phones and tablets: the ☰ button opens the menu as a panel under the header. */
@media (max-width: 1000px) {
    .site-header-row { padding-block: 10px; }
    .site-header.has-js .site-menu-btn { display: grid; }
    .site-menu { flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 12px; padding-bottom: 6px; }
    .site-header.has-js .site-menu { display: none; }
    .site-header.has-js.is-open .site-menu { display: flex; }
    .site-nav { flex-direction: column; gap: 2px; }
    .site-nav a { padding: 11px 12px; font-size: 1.05rem; }
    .site-actions { margin-left: 0; flex-direction: column; align-items: stretch; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
    .site-actions .btn { text-align: center; padding: 11px 14px; }
    .site-lang .lang-form, .site-lang select { width: 100%; }
}


/* Drawings: colours follow the light / dark theme. */
.il {
    --il-sky: #e7f0ee; --il-sun: #f2b544; --il-hill: #cfe1c6; --il-ground: #e3ecd6;
    --il-soil: #a35a32; --il-soil-deep: #7d4124; --il-maize: #3c8a37; --il-maize-dark: #2c6a29;
    --il-tassel: #d6ae3e; --il-concrete: #bdbab1; --il-concrete-dark: #94918a; --il-door: #5f6368;
    --il-panel: #234a73; --il-panel-line: #7ba0c9; --il-ink: #33322f; --il-paper: #ffffff; --il-soft: #dcdbd4;
    --il-warn: #e09a00; --il-warn-wash: #fdf1d6; --il-bad: #d03b3b; --il-bad-wash: #fbeaea;
}
@media (prefers-color-scheme: dark) {
    .il {
        --il-sky: #15211f; --il-sun: #d9a23c; --il-hill: #1f3322; --il-ground: #1c2a1b;
        --il-soil: #6e3b20; --il-soil-deep: #4f2915; --il-maize: #3f8f3a; --il-maize-dark: #2f6e2b;
        --il-concrete: #8d8a83; --il-concrete-dark: #6c6a64; --il-door: #3d4044;
        --il-ink: #d9d8d3; --il-paper: #232322; --il-soft: #3a3a37;
        --il-warn-wash: #3a2e10; --il-bad-wash: #3a1c1c;
    }
}
.il-sky { fill: var(--il-sky); }
.il-sun { fill: var(--il-sun); }
.il-hill { fill: var(--il-hill); }
.il-ground { fill: var(--il-ground); }
.il-soil { fill: var(--il-soil); }
.il-soil-deep { fill: var(--il-soil-deep); }
.il-trunk { fill: none; stroke: #6b4a2b; stroke-width: 4; stroke-linecap: round; }
.il-canopy { fill: var(--il-maize-dark); }
.il-stalk { stroke: var(--il-maize-dark); stroke-width: 3; stroke-linecap: round; fill: none; }
.il-leaf { stroke: var(--il-maize); stroke-width: 4; stroke-linecap: round; fill: none; }
.il-ear { fill: var(--il-tassel); }
.il-tassel { stroke: var(--il-tassel); stroke-width: 2; stroke-linecap: round; fill: none; }
.il-concrete { fill: var(--il-concrete); }
.il-concrete-dark { fill: var(--il-concrete-dark); }
.il-door { fill: var(--il-door); }
.il-lock { fill: var(--il-sun); }
.il-panel { fill: var(--il-panel); }
.il-panel-line { stroke: var(--il-panel-line); stroke-width: 1; fill: none; }
.il-line { stroke: var(--il-ink); stroke-width: 2.5; stroke-linecap: round; fill: none; }
.il-line-dot { fill: var(--il-ink); }
.il-wave { stroke: var(--brand); stroke-width: 2.5; stroke-linecap: round; fill: none; }
.il-cable { stroke: #2b2b2b; stroke-width: 2; fill: none; stroke-dasharray: 5 3; }
.il-probe { fill: #2f2f2f; }
.il-dash { stroke: var(--brand); stroke-width: 2; stroke-dasharray: 3 6; stroke-linecap: round; fill: none; }
.il-card { fill: var(--il-paper); stroke: var(--il-soft); stroke-width: 1; }
.il-drop { fill: #2a78d6; }
.il-spark { stroke: var(--brand); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.il-text-bar { fill: var(--il-soft); }
.il-text-bar-soft { opacity: 0.6; }
.il-measure { stroke: var(--il-ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.il-callout { fill: var(--brand); stroke: var(--il-paper); stroke-width: 2; }
.il-callout-text, .il-badge-text { fill: #fff; font: 700 12px system-ui, sans-serif; text-anchor: middle; }
.il-track { stroke: #c9a77c; stroke-width: 10; fill: none; stroke-linecap: round; opacity: 0.6; }
.il-plot { fill: #cfe5b8; stroke: var(--il-maize-dark); stroke-width: 1; }
@media (prefers-color-scheme: dark) { .il-plot { fill: #24401f; } }
.il-row { stroke: var(--il-maize); stroke-width: 3; stroke-dasharray: 1 7; stroke-linecap: round; }
.il-walked { stroke: var(--brand); stroke-width: 3.5; stroke-linejoin: round; stroke-linecap: round; fill: none; }
.il-person { fill: var(--il-ink); }
.il-person-body { stroke: var(--il-ink); stroke-width: 3; stroke-linecap: round; fill: none; }
.il-phone-mini { fill: var(--il-door); }
.il-pending { fill: var(--il-paper); stroke: var(--brand); stroke-width: 2; stroke-dasharray: 3 3; }
.il-area { fill: var(--il-ink); font: 700 15px system-ui, sans-serif; text-anchor: middle; }
.il-gateway { fill: var(--il-paper); stroke: var(--il-ink); stroke-width: 2; }
.il-led { fill: var(--good); }
.il-cloud { fill: var(--il-paper); stroke: var(--il-soft); stroke-width: 1.5; }
.il-phone { fill: #2b2b2b; }
.il-screen { fill: var(--il-paper); }
.il-grid-line { stroke: var(--il-soft); stroke-width: 1; }
.il-axis { stroke: var(--il-ink); stroke-width: 1.5; opacity: 0.5; }
.il-good { fill: var(--good); }
.il-clock { stroke: var(--il-ink); stroke-width: 2; stroke-linecap: round; fill: none; }
.il-row-card { fill: var(--il-paper); stroke: var(--il-soft); stroke-width: 1; }
.il-warn { fill: var(--il-warn); }
.il-bad { fill: var(--il-bad); }
.il-warn-wash { fill: var(--il-warn-wash); }
.il-bad-wash { fill: var(--il-bad-wash); }
.il-warn-ink { fill: var(--il-warn); }
.il-bad-ink { fill: var(--il-bad); }
.il-warn-stroke { stroke: var(--il-warn); stroke-width: 2; stroke-linecap: round; fill: none; }
.il-bad-stroke { stroke: var(--il-bad); stroke-width: 2; stroke-linecap: round; fill: none; }
.il-ph { font: 700 11px system-ui, sans-serif; text-anchor: middle; }
.il-bell { stroke: var(--il-ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.il-trend { stroke: #2a78d6; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; fill: none; }
.il-trend-dot { fill: #2a78d6; stroke: var(--il-paper); stroke-width: 2; }
.il-stage-c0 { fill: #b9b6ad; }
.il-stage-c1 { fill: #eda100; }
.il-stage-c2 { fill: #8cc152; }
.il-stage-o { fill: var(--brand); }
.il-sprout-stem { stroke: var(--il-maize-dark); stroke-width: 2.5; stroke-linecap: round; }
.il-sprout { fill: var(--il-maize); }
@media print { .site-header, .site-foot, .site-cta { display: none; } }

/* ---- Questions (administrators): what the platform should answer, and the data each needs ---- */
.q-intro { max-width: 80ch; }
.q-section { margin-top: 28px; }
.q-section > h2 { margin: 0 0 6px; font-size: 1.1rem; color: var(--ink); }
.q-section > .muted { margin-bottom: 4px; }
.q-count { margin-left: 6px; font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.q-stat-link { color: inherit; text-decoration: none; }
.q-stat-link:hover { text-decoration: underline; }
.q-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--axis); }
.q-dot-answered { background: var(--good); }
.q-dot-ready { background: var(--link); }
.q-dot-collecting { background: var(--conv-ink); }
.q-dot-missing { background: var(--muted); }
.q-list { list-style: none; margin: 8px 0 0; padding: 0; }
.q-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--grid); scroll-margin-top: 80px; }
.q-item:last-child { border-bottom: 0; }
.q-item:target { background: var(--organic-wash); }
.q-main { min-width: 0; flex: 1; }
.q-text { margin: 0; color: var(--ink); font-weight: 600; }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; font-size: 0.82rem; }
.q-meta a { text-decoration: none; }
.q-meta a:hover { text-decoration: underline; }
.q-years { color: var(--ink-2); }
.q-status-answered { background: var(--organic-wash); color: var(--good-ink); }
.badge-site { background: transparent; border-color: var(--brand); color: var(--brand); }
.q-status-collecting { background: var(--conv-wash); color: var(--conv-ink); }
.q-sources { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; }
.q-source { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 0.78rem; border: 1px solid transparent; }
.q-source-has { background: var(--organic-wash); color: var(--good-ink); }
.q-source-empty { background: var(--conv-wash); color: var(--conv-ink); }
.q-source-cannot { color: var(--ink-2); border: 1px dashed var(--axis); }
td .q-source { white-space: nowrap; }
.q-source-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 20px; }
.q-source-group { margin: 0 0 6px; font-size: 0.8rem; font-weight: 600; color: var(--ink-2); }
.q-source-groups label.check { margin-bottom: 6px; }
@media (max-width: 560px) {
    .q-item { flex-direction: column; }
    td .q-source { white-space: normal; }
}
.stat dd.stat-note { font-size: 0.8rem; font-weight: 400; line-height: 1.4; color: var(--muted); }
@media (max-width: 600px) {
    /* The bell is not at the screen edge on phones: keep its list inside the screen. */
    .notif-menu { position: fixed; left: 16px; right: 16px; top: calc(env(safe-area-inset-top, 0px) + 60px); width: auto; }
}

/* ---- 360° photos on a farm's page (public/js/pano.js, Pannellum) ---- */
.pano-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 14px; margin-top: 8px; }
.pano, #pano.pnlm-container { height: clamp(300px, 52vh, 520px); padding: 0; overflow: hidden; } /* pannellum.css loads later and sets 100% */
.pano-list { list-style: none; margin: 0; padding: 6px; display: grid; align-content: start; gap: 2px; max-height: clamp(300px, 52vh, 520px); overflow-y: auto; }
.pano-list li { padding: 2px 0 6px; border-bottom: 1px solid var(--grid); }
.pano-list li:last-child { border-bottom: 0; }
.pano-pick { display: grid; gap: 2px; width: 100%; text-align: left; font: inherit; color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.pano-pick:hover { background: var(--page); }
.pano-pick[aria-pressed="true"] { background: var(--organic-wash); border-color: var(--good); }
.pano-by { padding: 0 10px; }
.inline-form { display: inline; margin: 0; }
.link-button { font: inherit; color: var(--critical-ink); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; }
.pano-add .hint { margin: 10px 0 0; color: var(--muted); font-size: 0.85rem; }
@media (max-width: 760px) {
    .pano-layout { grid-template-columns: 1fr; }
    .pano-list { max-height: none; grid-auto-flow: column; grid-auto-columns: minmax(160px, 1fr); overflow-x: auto; }
    .pano-list li { border-bottom: 0; border-right: 1px solid var(--grid); }
}

/* ---- Stock of parts and tools ---- */
.stock-section { margin-top: 28px; }
.stock-section > h2 { margin: 0 0 8px; font-size: 1.1rem; color: var(--ink); }
.stock-notes { margin: 8px 0 0; max-width: 80ch; white-space: pre-line; }
.stock-farms { list-style: none; margin: 8px 0 0; padding: 4px 18px; }
.stock-farms li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.stock-farms li:last-child { border-bottom: 0; }
#move { margin-top: 28px; }
.stock-kind-received, .stock-kind-returned { background: var(--organic-wash); color: var(--good-ink); }
.stock-kind-installed { background: var(--conv-wash); color: var(--conv-ink); }
.stock-kind-lost { background: var(--critical-wash); color: var(--critical-ink); }
td .badge-warn { margin: 0 6px 0 0; }
#move .form-row, [data-pano-upload] .form-row { align-items: start; } /* a hint under one field must not stretch the others */

/* ---- Farmer consent (farm page) and SMS log ---- */
.consent-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-top: 8px; }
.consent { border-left: 4px solid var(--axis); }
.consent-yes { border-left-color: var(--good); }
.consent-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.consent-choices { list-style: none; margin: 10px 0 6px; padding: 0; display: grid; gap: 3px; font-size: 0.9rem; }
.consent-links { margin: 10px 0 0; font-size: 0.9rem; }
.consent .add-plot { margin-top: 8px; }
.consent-history { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; font-size: 0.85rem; }
.sms-body { max-width: 46ch; font-size: 0.875rem; }
.sms-status-sent { background: var(--organic-wash); color: var(--good-ink); }
.sms-status-failed { background: var(--critical-wash); color: var(--critical-ink); }
.site-copy a { color: inherit; }
