/* Field Notes — shared phone-first finishing layer. See DESIGN.md. */
:root {
 --sd-bg:#F5F6F5; --sd-ink:#18201C; --sd-ink2:#526058; --sd-line:#DCE2DE;
 --sd-brand:#287452; --sd-brand-dark:#205D42; --sd-brand-soft:#EAF2ED;
 --sd-r:20px; --sd-r-ctl:14px;
}
body.sd { --bone-faint:#617067; --hair:var(--sd-line); --glacier:var(--sd-brand); }
*, *::before, *::after { box-sizing:border-box; }
body.sd button, body.sd select, body.sd input:not([type=checkbox]):not([type=radio]), .seg button {
 min-height:44px; min-width:44px; touch-action:manipulation;
}
body.sd input:not([type=checkbox]):not([type=radio]), body.sd select, body.sd textarea { font-size:16px !important; max-width:100%; }
body.sd button:focus-visible, body.sd a:focus-visible, body.sd [tabindex]:focus-visible {
 outline:2px solid var(--sd-brand); outline-offset:3px;
}
body.sd button:active:not(:disabled) { transform:translateY(1px); }
body.sd [hidden] { display:none !important; }
/* Sign-in is an introduction followed by choices, never a stretched empty card. */
body.sd #screen-login { padding:28px 20px calc(24px + env(safe-area-inset-bottom)); overflow-y:auto; }
body.sd .login-box { flex:none; max-width:520px; width:100%; margin:auto !important; border:0; box-shadow:none; background:transparent; }
body.sd .login-box h2 { font-size:clamp(28px,7.8vw,34px) !important; line-height:1.12 !important; letter-spacing:-.04em; max-width:12ch; margin:16px 0 12px !important; }
body.sd #login-lead { text-align:left; font-size:16px; line-height:1.5; margin-bottom:28px; max-width:34ch; }
body.sd .gw-overline { color:var(--sd-ink2); font-size:12px; letter-spacing:.07em; }
body.sd .gw-overline::before { display:none; }
body.sd #legacy-login-panel { flex:none; gap:12px; }
body.sd #legacy-login-panel > div:has(#login-farm-row) { order:0; margin:0 !important; }
body.sd #legacy-login-panel > div:has(#login-farm-row) > div:first-child { text-align:left !important; font-size:12px !important; color:var(--sd-ink2) !important; }
body.sd #login-farm-row { margin:0 0 8px; border:1px solid var(--sd-line); border-radius:14px; padding:4px; }
body.sd #agent-picker { order:1; border-radius:18px; border-color:var(--sd-line); box-shadow:0 3px 12px #18201c04; }
body.sd .gw-agent { min-height:80px; padding:14px; gap:12px; }
body.sd .gw-agent-id b { white-space:normal; overflow-wrap:anywhere; line-height:1.3; }
body.sd .gw-agent-id small { color:var(--sd-ink2); line-height:1.4; white-space:normal; }
body.sd .gw-agent.is-selected { background:var(--sd-brand-soft); }
body.sd .gw-agent.is-selected .gw-agent-check { color:#fff; }
body.sd #worker-login-preview { order:2; }
body.sd #mission-strip { order:3; }
body.sd #legacy-login-panel > div:has(#link-sim-toggle) { order:4; margin:0 !important; }
body.sd #link-sim-toggle { display:flex !important; min-height:44px; justify-content:center; font-size:12px !important; line-height:1.4; }
body.sd #btn-login { order:5; margin-top:12px; min-height:56px; border-radius:14px; box-shadow:none; }
body.sd .nf-tabpane { padding:16px 16px calc(88px + env(safe-area-inset-bottom)); }
body.sd .nf-patrol-head { box-shadow:none; border:0; border-bottom:1px solid var(--sd-line); background:transparent; padding:0 0 16px; border-radius:0; }
body.sd .ck-map-wrap { min-height:220px !important; height:40dvh !important; max-height:420px !important; }
body.sd .ck-tool { width:44px !important; height:44px !important; }
body.sd .sync-pill { min-height:44px; cursor:pointer; }
body.sd .ck-guide { padding:16px 12px !important; }
body.sd .ck-guide-text { min-width:0; }
body.sd .ck-target-name { overflow-wrap:anywhere; }
body.sd .sd-tabbar button, body.sd .nav-item .i18n::after { font-size:12px !important; letter-spacing:0 !important; }
/* Supervisor tools use one deliberate grid, including the base-layer control. */
body.sd #view-map .hud-dock { display:grid !important; grid-template-columns:minmax(0,1fr); gap:8px !important; padding:12px 16px !important; }
body.sd #view-map .map-tool-group { display:grid !important; grid-template-columns:minmax(0,1fr) minmax(0,1fr) 44px 44px !important; gap:8px !important; width:100%; }
body.sd #view-map .map-tool-group .btn { min-width:44px !important; min-height:44px !important; width:100% !important; }
body.sd #view-map .map-style-select { min-height:44px; }
body.sd .farm-context-bar { font-size:13px; }
body.sd .map-kpi-bar .stat-pill { padding:14px 10px !important; }
body.sd .map-kpi-bar .val { font-size:26px; }
body.sd .map-kpi-bar .lbl { font-size:11px; line-height:1.35; letter-spacing:.03em; }
body.sd .modal, body.sd .gps-lock-card { max-width:min(520px,100%); max-height:calc(100dvh - 32px); overflow-y:auto; }
body.sd .modal-overlay, body.sd .gps-lock-overlay { padding:16px; }
body.sd .agent-meta, body.sd .agent-name { overflow-wrap:anywhere; }
body.sd #view-report .report-actions { grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
body.sd #view-report .report-actions-main { grid-column:1 / -1 !important; }
/* Report filters form a readable vertical sequence on phones. */
body.sd .top-bar-title { font-size:14px; line-height:1.4; }
body.sd .filter-group { min-width:0; }
body.sd .empty-state-card { text-align:left; padding:24px !important; border-radius:20px; box-shadow:none; }
body.sd .empty-state-card h3 { justify-content:flex-start !important; font-size:20px; line-height:1.3; }
body.sd .empty-state-card p { font-size:16px; line-height:1.5; }
@media(max-width:767px) {
 body.sd .stats-grid, body.sd .gw-mission-grid { grid-template-columns:minmax(0,1fr); }
 body.sd .top-bar-actions { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); }
 body.sd .top-bar-actions > :last-child { grid-column:1 / -1; }
}
@media(max-width:359px) {
 body.sd #screen-login { padding-inline:16px; }
 body.sd .ck-guide { gap:8px; }
 body.sd .ck-dist b { font-size:30px !important; }
 body.sd .mobile-app-sub { font-size:10px; }
}
@media(prefers-reduced-motion:reduce) {
 *, *::before, *::after { animation:none !important; transition:none !important; scroll-behavior:auto !important; }
}
@media print { .sd-tabbar { display:none !important; } }
body.sd .gw-seg .gw-seg-btn { min-height:44px; }
body.sd .map-ctrl-select { min-height:44px; width:100%; }
body.sd .farm-context-status::after { content:'VUE FERME'; }
html[lang=en] body.sd .farm-context-status::after { content:'FARM VIEW'; }
body.sd .farm-context-status::before { background:var(--sd-ink2); }
body.sd .gw-agent-check { color:transparent; }
body.sd .gw-agent.is-selected .gw-agent-check { color:#fff; }

body.sd .agent-acts { flex-wrap:wrap; }
body.sd .agent-acts .btn { min-width:44px !important; min-height:44px !important; flex-shrink:0; }

/* Emergency action stays within one tap from every patrol tab. */
#header-sos { display:none; min-width:44px; padding:0 10px; }
#app-container:has(#screen-main.active) #header-sos { display:inline-flex; }
#app-container:has(#screen-main.active) .gw-brand-text small { display:none; }
#app-container:has(#screen-main.active) .gw-header { gap:8px; }
#app-container:has(#screen-main.active) .gw-header-actions { gap:8px; }
#app-container:has(#screen-main.active) .shift-actions { display:none; }
body.sd #view-map .map-kpi-bar .stat-pill .lbl { white-space:normal; overflow:visible; text-overflow:clip; max-width:none; letter-spacing:0; font-size:11px; }
/* The supervisor's existing theme switch now changes the shared surfaces. */
html[data-theme=dark] body.sd {
 --sd-bg:#181D1A; --sd-surface:#222925; --sd-ink:#EDF2EE; --sd-ink2:#B5C2BA;
 --sd-line:#3B4740; --sd-brand:#88C5A4; --sd-brand-dark:#A0D2B7; --sd-brand-soft:#2B4437;
 --slate:var(--sd-bg); --slate-2:var(--sd-surface); --slate-3:#2C352F;
 --bone:var(--sd-ink); --bone-dim:var(--sd-ink2); --bone-faint:var(--sd-ink2);
 --glacier:var(--sd-brand); --hair:var(--sd-line);
}
html[data-theme=dark] body.sd .btn-primary { color:#18201C; }

/* Safari native selects do not reliably honor min-height alone. */
body.sd select { height:48px !important; }

/* Device theme covers the launcher, patrol app, console and report portal. */
html[data-theme=dark] { background:#181D1A !important; color-scheme:dark !important; }
html[data-theme=light] { color-scheme:light !important; }
html[data-theme=dark] body.sd {
 color-scheme:dark; background:var(--sd-bg) !important; color:var(--sd-ink);
 --gw-outside:#181D1A; --hair-light:#536359;
 --sd-warn:#E4B768; --sd-warn-soft:#3C3120;
 --sd-danger:#F08E83; --sd-danger-soft:#402824;
 --sd-ok:var(--sd-brand); --sd-ok-soft:var(--sd-brand-soft);
 --sodium:var(--sd-warn); --oxblood:var(--sd-danger);
}
html[data-theme=dark] body.sd .gw-header,
html[data-theme=dark] body.sd .sd-tabbar,
html[data-theme=dark] body.sd .app,
html[data-theme=dark] body.sd .gw-seg,
html[data-theme=dark] body.sd .sd-seg,
html[data-theme=dark] body.sd .ck-map-wrap,
html[data-theme=dark] body.sd .ck-map-fallback,
html[data-theme=dark] body.sd .tbl th,
html[data-theme=dark] body.sd .bandtrack,
html[data-theme=dark] body.sd .gw-agent-ava,
html[data-theme=dark] body.sd .btn:hover:not(.btn-primary) {
 background:var(--sd-surface) !important; color:var(--sd-ink);
}
html[data-theme=dark] body.sd .ck-confirm,
html[data-theme=dark] body.sd .sd-primary,
html[data-theme=dark] body.sd .btn-duty-action { color:#18201C !important; }
html[data-theme=dark] body.sd .gw-agent.is-selected { background:var(--sd-brand-soft) !important; }
html[data-theme=dark] body.sd .gw-agent.is-selected .gw-agent-check { color:#18201C; }
html[data-theme=dark] body.sd .sd-seg button.active { background:var(--sd-brand-soft); color:var(--sd-brand-dark); }
html[data-theme=dark] body.sd .ck-gps-chip,
html[data-theme=dark] body.sd .ck-tool { background:var(--sd-surface); color:var(--sd-ink); }
@media print { html[data-theme=dark] body.sd { --sd-bg:#fff; --sd-surface:#fff; --sd-ink:#18201C; --sd-ink2:#526058; --bone:#18201C; --bone-dim:#526058; } }
