/* Farm Ledger V4 — design system.
   Tokens first (colour roles, type, space, radius), then the app shell (header, sidebar, phone tab bar),
   then components (buttons, fields, cards, badges, sheets). V3's screens use the old variable names
   (--paper, --pasture, --ink, …); they are mapped onto the V4 tokens here so every V3 screen takes the new look.

   Colour roles (never colour alone: every status also has an icon and a word):
     forest  — Farm Ledger identity, primary actions
     pasture — done, healthy, resolved
     soil    — supporting information
     red     — urgent, unresolved danger
     orange  — needs attention
     amber   — awaiting action
     blue    — information, water, location
     purple  — specialist (animal health, dairy) */

:root{
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-display: var(--font-ui);
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --forest-900:#0F2A1B; --forest-800:#163A28; --forest-700:#1F4D36; --forest-600:#2A6347; --forest-100:#E2EEE6;
  --pasture-700:#23693A; --pasture-100:#DCEFE0;
  --soil-700:#6B4E31; --soil-100:#F1E8DD;
  --red-700:#B42318; --red-100:#FCE6E3;
  --orange-700:#A84707; --orange-100:#FDEADB;
  --amber-700:#7D6000; --amber-100:#FAF0C6;
  --blue-700:#1D63A8; --blue-100:#E1EDF8;
  --purple-700:#6941A8; --purple-100:#EEE7F8;
  --grey-700:#4F5A53; --grey-100:#E8ECE7;

  --bg:#F2F4F0; --surface:#FFFFFF; --surface-2:#F7F8F5; --border:#D3DAD2; --border-strong:#9FAAA1;
  --text:#16201A; --text-2:#4A564E; --on-primary:#FFFFFF; --primary:var(--forest-700); --primary-hover:var(--forest-800);
  --focus:#1D63A8;
  --farm:#1F4D36;                       /* set to the open farm's colour by the app */

  --r-sm:6px; --r-md:10px; --r-lg:16px;
  --shadow-pop:0 10px 30px rgba(15,42,27,.20);
  --appbar-h:56px; --sidenav-w:244px; --tabbar-h:64px;

  /* V3 names → V4 tokens (V3 screens keep working and take the new look) */
  --paper:var(--bg); --paper-raised:var(--surface); --pasture:var(--forest-700); --pasture-dark:var(--forest-800);
  --on-pasture:#FFFFFF; --soil:var(--soil-700); --steel:var(--text-2); --steel-light:var(--grey-100);
  --wheat:#9A5F0C; --rust:var(--red-700); --water:var(--blue-700); --stock:var(--purple-700);
  --line:var(--border); --ink:var(--text); --ink-soft:var(--text-2);
  color-scheme: light;
}
html[data-theme="dark"]{
  --forest-900:#0B1A11; --forest-800:#1E5A3B; --forest-700:#2A7350; --forest-600:#317A55; --forest-100:#173326;
  --pasture-700:#6CC08A; --pasture-100:#14301E;
  --soil-700:#D2B48C; --soil-100:#2E2418;
  --red-700:#FF8C7E; --red-100:#3B1612;
  --orange-700:#FFA65C; --orange-100:#3A230F;
  --amber-700:#E9C74B; --amber-100:#332A08;
  --blue-700:#86BBEE; --blue-100:#13283D;
  --purple-700:#BCA0F2; --purple-100:#271C3C;
  --grey-700:#AAB5AD; --grey-100:#253029;
  --bg:#0E1511; --surface:#161F19; --surface-2:#1C2720; --border:#2D3A31; --border-strong:#4D5D52;
  --text:#E7EEE8; --text-2:#A9B7AD; --primary:#2A7350; --primary-hover:#1E5A3B; --focus:#86BBEE;
  --wheat:#E0A54A; --shadow-pop:0 10px 30px rgba(0,0,0,.5);
  color-scheme: dark;
}
html[data-contrast="high"]{
  --bg:#FFFFFF; --surface:#FFFFFF; --surface-2:#FFFFFF; --border:#000000; --border-strong:#000000;
  --text:#000000; --text-2:#000000; --primary:#0B3D22; --primary-hover:#000000; --focus:#0000CC;
  --red-700:#8A0F05; --orange-700:#7A3300; --amber-700:#4D3B00; --blue-700:#0A3D75; --purple-700:#43207A; --pasture-700:#0D4A20;
}
html[data-contrast="high"][data-theme="dark"]{
  --bg:#000000; --surface:#000000; --surface-2:#000000; --border:#FFFFFF; --border-strong:#FFFFFF;
  --text:#FFFFFF; --text-2:#FFFFFF; --primary:#0F5C33; --focus:#FFFF00;
  --red-700:#FFB0A6; --orange-700:#FFC48F; --amber-700:#FFE27A; --blue-700:#B8D8FF; --purple-700:#DCC9FF; --pasture-700:#9BE3B2;
}

/* ---------- base ---------- */
html, body{background:var(--bg);color:var(--text);}
body{font-family:var(--font-ui);font-size:15px;line-height:1.5;margin:0;-webkit-font-smoothing:antialiased;font-variant-numeric:tabular-nums;}
h1,h2,h3,h4{font-family:var(--font-display);letter-spacing:-0.01em;line-height:1.25;}
:focus-visible{outline:3px solid var(--focus) !important;outline-offset:2px;}
html[data-contrast="high"] :focus-visible{outline-width:4px !important;}
a{color:var(--blue-700);}
::selection{background:var(--forest-100);color:var(--text);}
.sr-only{position:absolute !important;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;}
.ico{width:20px;height:20px;flex:none;stroke:currentColor;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round;vertical-align:middle;}
.ico.lg{width:24px;height:24px;}

/* ---------- app shell ---------- */
.appbar{
  position:sticky;top:0;z-index:60;height:var(--appbar-h);display:flex;align-items:center;gap:8px;
  padding:0 10px 0 0;background:var(--surface);border-bottom:1px solid var(--border);
}
.farm-id{
  display:flex;align-items:center;gap:10px;height:100%;min-width:0;padding:0 12px 0 0;border:0;background:none;
  color:var(--text);cursor:pointer;text-align:left;font:inherit;
}
.farm-id .farm-block{
  align-self:stretch;width:56px;display:flex;align-items:center;justify-content:center;flex:none;
  background:var(--farm);color:#fff;font-weight:800;font-size:22px;letter-spacing:0;
}
.farm-id .farm-txt{display:flex;flex-direction:column;min-width:0;line-height:1.2;}
.farm-id .farm-name{font-weight:700;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:46vw;}
.farm-id .farm-role{font-size:12.5px;color:var(--text-2);white-space:nowrap;}
.farm-id .ico{color:var(--text-2);}
.farm-id:hover .farm-name{text-decoration:underline;}
.appbar-search{position:relative;flex:1;max-width:520px;margin-left:auto;}
.appbar-search input{
  width:100%;height:40px;border:1px solid var(--border);border-radius:20px;background:var(--surface-2);color:var(--text);
  padding:0 14px 0 38px;font:inherit;font-size:15px;
}
.appbar-search .ico{position:absolute;left:12px;top:10px;color:var(--text-2);pointer-events:none;}
.appbar-actions{display:flex;align-items:center;gap:4px;}
.icon-btn{
  position:relative;display:inline-flex;align-items:center;justify-content:center;gap:6px;min-width:44px;height:44px;padding:0 10px;
  border:0;border-radius:22px;background:none;color:var(--text);cursor:pointer;font:inherit;font-weight:600;font-size:14px;
}
.icon-btn:hover{background:var(--grey-100);}
.icon-btn .count{position:absolute;top:4px;right:2px;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:var(--red-700);color:#fff;font-size:11px;font-weight:700;line-height:18px;}
html[data-theme="dark"] .icon-btn .count{color:#000;}
.avatar{width:34px;height:34px;border-radius:50%;background:var(--forest-100);color:var(--forest-700);display:inline-flex;align-items:center;justify-content:center;font-weight:700;font-size:13px;}
html[data-theme="dark"] .avatar{color:var(--text);}
#searchToggle{display:none;}

/* sync status — wording carries the meaning; the dot only repeats it */
.sync-pill{
  display:inline-flex;align-items:center;gap:7px;height:36px;padding:0 12px;border-radius:18px;border:1px solid var(--border);
  background:var(--surface);color:var(--text);font:600 13px var(--font-ui);cursor:pointer;white-space:nowrap;
}
.sync-pill::before{content:"";width:9px;height:9px;border-radius:50%;background:var(--grey-700);flex:none;}
.sync-pill.s-synced::before{background:var(--pasture-700);}
/* V5 (second directive §6): one meaning per colour, the same on the pill, Today and the Sync centre — green genuinely all
   synced; blue information (waiting or sending, nothing wrong); amber caution (kept on this device only, or a sign-in is
   needed); red needs a person (refused changes, a conflict); grey not started */
.sync-pill.s-pending::before,.sync-pill.s-syncing::before{background:var(--blue-700);}
.sync-pill.s-offline::before,.sync-pill.s-unreachable::before,.sync-pill.s-signin::before{background:var(--amber-700);}
.sync-pill.s-problem::before,.sync-pill.s-conflict::before{background:var(--red-700);}
.sync-pill.s-starting::before{background:var(--text-2, #6B7280);}
.sync-pill.s-problem,.sync-pill.s-conflict{border-color:var(--red-700);color:var(--red-700);}
.sync-pill.s-offline,.sync-pill.s-unreachable,.sync-pill.s-signin{border-color:var(--amber-700);}
.sync-pill .lbl-short{display:none;}

.sidenav{
  position:fixed;z-index:50;top:var(--appbar-h);left:0;bottom:0;width:var(--sidenav-w);overflow-y:auto;
  background:var(--surface);border-right:1px solid var(--border);padding:12px 10px 24px;
}
.nav-item{
  display:flex;align-items:center;gap:12px;width:100%;min-height:44px;padding:0 12px;margin:1px 0;border:0;border-radius:var(--r-sm);
  background:none;color:var(--text);font:500 15px var(--font-ui);text-align:left;cursor:pointer;
}
.nav-item .ico{color:var(--text-2);}
.nav-item:hover{background:var(--grey-100);}
.nav-item.active{background:var(--forest-100);color:var(--forest-700);font-weight:700;box-shadow:inset 3px 0 0 var(--farm);}
html[data-theme="dark"] .nav-item.active{color:var(--text);}
.nav-item.active .ico{color:inherit;}
.nav-sep{height:1px;background:var(--border);margin:10px 4px;}
.nav-new{
  display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:48px;margin:0 0 12px;border:0;border-radius:var(--r-md);
  background:var(--primary);color:var(--on-primary);font:700 15px var(--font-ui);cursor:pointer;
}
.nav-new:hover{background:var(--primary-hover);}

main{max-width:1180px;margin:0 auto;padding:20px 28px 96px;}
@media (min-width:1024px){
  main{margin-left:var(--sidenav-w);margin-right:0;max-width:none;padding:24px 36px 80px;}
  main > *{max-width:1180px;}
  .tabbar,.more-sheet{display:none !important;}
}
@media (max-width:1023px){
  .sidenav{display:none;}
  main{padding:16px 14px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));}
  .appbar{padding-right:4px;}
  .appbar-search{display:none;}
  .appbar-search.open{display:block;position:absolute;left:8px;right:8px;top:8px;max-width:none;z-index:2;}
  #searchToggle{display:inline-flex;}
  .sync-pill .lbl-long{display:none;}
  .sync-pill .lbl-short{display:inline;}
  .farm-id .farm-block{width:52px;font-size:20px;}
}
/* round 4: on a small phone the farm's name may take two lines instead of being cut to "La V…" (which farm is open
   must always be readable); the role is in the account menu */
@media (max-width:420px){
  .farm-id{gap:8px;padding-right:4px;}
  .farm-id .farm-block{width:40px;font-size:18px;}
  .farm-id .farm-name{white-space:normal;overflow-wrap:anywhere;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;font-size:15px;line-height:1.15;max-width:none;}
  .farm-id .farm-role{display:none;}
  .farm-id .farm-chev{display:none;}
  .appbar{gap:4px;}
}

/* phone tab bar: the four most used places and the + in the middle */
.tabbar{
  position:fixed;z-index:55;left:0;right:0;bottom:0;display:flex;align-items:stretch;
  height:calc(var(--tabbar-h) + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom);
  background:var(--surface);border-top:1px solid var(--border);
}
.tab{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;border:0;background:none;
  color:var(--text-2);font:600 13px var(--font-ui);cursor:pointer;min-width:0;   /* 13 px (was 12): the bottom labels are read at arm's length */
}
.tab.active{color:var(--forest-700);}
html[data-theme="dark"] .tab.active{color:var(--pasture-700);}
.tab.active .ico{stroke-width:2.4;}
.tab-new{flex:1;display:flex;align-items:center;justify-content:center;}
.newbtn{
  width:56px;height:56px;margin-top:-18px;border-radius:50%;border:4px solid var(--surface);background:var(--primary);color:#fff;
  display:flex;align-items:center;justify-content:center;cursor:pointer;box-shadow:var(--shadow-pop);
}
.newbtn .ico{width:28px;height:28px;stroke-width:2.4;}
@media (min-width:1024px){ #fab.newbtn{display:none;} }
body.modal-open .tabbar{display:none;}
/* V9: on phones the "Install Farm Ledger" banner sits above the tab bar, never over the + button */
@media (max-width:1023px){ .pwa-banner{bottom:calc(var(--tabbar-h) + 30px + env(safe-area-inset-bottom)) !important;} }

/* "More" sheet on phones: every place, grouped */
.more-sheet{position:fixed;inset:0;z-index:90;background:rgba(10,20,14,.45);display:none;}
.more-sheet.open{display:block;}
.more-panel{
  position:absolute;left:0;right:0;bottom:0;max-height:86vh;overflow-y:auto;background:var(--surface);
  border-radius:var(--r-lg) var(--r-lg) 0 0;padding:8px 12px calc(16px + env(safe-area-inset-bottom));
}
.more-panel .grab{width:44px;height:5px;border-radius:3px;background:var(--border-strong);margin:4px auto 10px;}
.more-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;}
.more-find{grid-column:1/-1;width:100%;min-height:48px;font-size:17px;padding:10px 12px;border:1px solid var(--line,#C9D1C8);border-radius:10px;background:var(--card,#fff);color:inherit;box-sizing:border-box;}
.more-grid [data-find][hidden]{display:none;}
.more-grid .nav-item{flex-direction:column;justify-content:center;gap:6px;min-height:84px;padding:8px;text-align:center;font-size:13.5px;background:var(--surface-2);border:1px solid var(--border);}
.more-grid .nav-item.active{box-shadow:none;border-color:var(--forest-700);}

/* section tabs (the sheets inside a place) */
nav.subtabs.chips{display:flex;gap:8px;overflow-x:auto;padding:2px 0 12px;margin:0 0 8px;border:0;background:none;scrollbar-width:thin;}
nav.subtabs.chips:empty{display:none;}
.chips .sub-btn{
  flex:none;min-height:40px;padding:0 14px;border:1px solid var(--border);border-radius:20px;background:var(--surface);color:var(--text);
  font:600 14px var(--font-ui);cursor:pointer;letter-spacing:0;white-space:nowrap;
}
.chips .sub-btn.active{background:var(--forest-700);border-color:var(--forest-700);color:#fff;}
html[data-theme="dark"] .chips .sub-btn.active{background:var(--forest-600);}
.chips .sub-btn .cnt{margin-left:6px;font-weight:500;opacity:.8;}

.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;flex-wrap:wrap;margin:4px 0 14px;}
.page-title{font-size:24px;font-weight:750;margin:0;}

/* ---------- components ---------- */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 16px;border-radius:8px;
  border:1px solid var(--primary);background:var(--primary);color:var(--on-primary);font:600 15px var(--font-ui);
  letter-spacing:0;cursor:pointer;text-decoration:none;
}
.btn:hover{background:var(--primary-hover);border-color:var(--primary-hover);}
.btn.ghost{background:var(--surface);color:var(--text);border-color:var(--border-strong);}
.btn.ghost:hover{background:var(--grey-100);}
.btn.danger{background:var(--red-700);border-color:var(--red-700);color:#fff;}
html[data-theme="dark"] .btn.danger{color:#000;}
.btn:disabled,.btn[aria-disabled="true"]{opacity:.55;cursor:not-allowed;}
input, select, textarea{font-family:var(--font-ui);color:var(--text);}
.field input,.field select,.field textarea,.input{
  width:100%;min-height:44px;padding:8px 12px;border:1px solid var(--border-strong);border-radius:8px;background:var(--surface);font-size:16px;
}
.field label{display:block;font-weight:600;font-size:14px;margin:0 0 4px;color:var(--text);}
.field .help{font-size:13px;color:var(--text-2);margin-top:4px;}
.field .err{font-size:13.5px;color:var(--red-700);margin-top:4px;font-weight:600;}
.field [aria-invalid="true"]{border-color:var(--red-700);box-shadow:0 0 0 1px var(--red-700);}

.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-md);padding:16px;}
.card-title{font-weight:700;font-size:16px;margin:0 0 8px;display:flex;align-items:center;gap:8px;}

.badge{
  display:inline-flex;align-items:center;gap:5px;padding:2px 9px 2px 7px;border-radius:12px;font:600 12.5px var(--font-ui);
  border:1px solid transparent;white-space:nowrap;
}
.badge .ico{width:14px;height:14px;stroke-width:2.2;}
.badge.urgent{background:var(--red-100);color:var(--red-700);border-color:color-mix(in srgb, var(--red-700) 30%, transparent);}
.badge.attention{background:var(--orange-100);color:var(--orange-700);}
.badge.awaiting{background:var(--amber-100);color:var(--amber-700);}
.badge.info{background:var(--blue-100);color:var(--blue-700);}
.badge.done{background:var(--pasture-100);color:var(--pasture-700);}
.badge.special{background:var(--purple-100);color:var(--purple-700);}
.badge.muted{background:var(--grey-100);color:var(--grey-700);}
html[data-contrast="high"] .badge{border-color:currentColor;background:transparent;}

/* V3 screens: tables, panels and pills in the V4 style */
.panel-title{font-size:22px;font-weight:750;color:var(--text);}
.panel-desc{font-size:14px;color:var(--text-2);max-width:72ch;}
.section-rule{font-size:13px;font-weight:700;letter-spacing:0;color:var(--text-2);border-top-color:var(--border);}
.sheet-wrap{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-md);}
table.sheet th{background:var(--surface-2);color:var(--text-2);font:600 13px var(--font-ui);letter-spacing:0;border-bottom:1px solid var(--border);}
table.sheet td input, table.sheet td select{color:var(--text);}
.toolbar .filter{min-height:44px;border-radius:8px;border:1px solid var(--border-strong);background:var(--surface);color:var(--text);}
.modal{background:var(--surface);color:var(--text);border-radius:var(--r-lg);}
.toast,#toastBar .toast{border-radius:var(--r-md);}
.saved-flash{font-family:var(--font-ui);}
/* on a phone the "Saved on this device" note appears just above the bottom bar, not over the page's heading or the map's tools */
@media (max-width:1023px){ .saved-flash{top:auto;bottom:calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom));right:12px;} }

/* ---------- appearance options ---------- */
/* larger text: everything except the map canvas grows by 15 % */
html[data-text="large"] .appbar, html[data-text="large"] .sidenav, html[data-text="large"] .tabbar,
html[data-text="large"] main > section.view:not(#view-map), html[data-text="large"] .modal, html[data-text="large"] .more-panel,
html[data-text="large"] .gate-card, html[data-text="large"] #acctPage{zoom:1.15;}
/* zoom enlarges a height cap too (94vh would become 108 % of the screen and push a dialog's title and Close off the top of a phone),
   so the caps are divided by the same 1.15 */
html[data-text="large"] .modal{max-height:calc(min(92vh,900px) / 1.15);}
html[data-text="large"] .more-panel{max-height:calc(86vh / 1.15);}
@media (max-width:640px){ html[data-text="large"] .modal{max-height:calc(94vh / 1.15);} }
/* reduced clutter: explanations, keyboard hints, charts' export buttons and decoration go; the information stays */
html[data-calm="on"] .panel-desc, html[data-calm="on"] .kbd-hint, html[data-calm="on"] .hint, html[data-calm="on"] .chart-export,
html[data-calm="on"] [data-export-chart], html[data-calm="on"] [data-export-png], html[data-calm="on"] .calm-hide{display:none !important;}
html[data-calm="on"] *{animation:none !important;transition:none !important;box-shadow:none !important;}

/* settings */
.opt-group{display:grid;gap:8px;margin:0 0 18px;}
.opt-row{display:flex;flex-wrap:wrap;gap:8px;}
.opt{
  display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 14px;border:1px solid var(--border-strong);border-radius:8px;
  background:var(--surface);color:var(--text);font:600 14.5px var(--font-ui);cursor:pointer;
}
.opt[aria-pressed="true"]{border-color:var(--forest-700);background:var(--forest-100);color:var(--forest-700);box-shadow:inset 0 0 0 1px var(--forest-700);}
html[data-theme="dark"] .opt[aria-pressed="true"]{color:var(--text);}

@media print{ .appbar,.sidenav,.tabbar,.more-sheet{display:none !important;} main{margin:0 !important;padding:0 !important;} }
.season-pick{display:inline-flex;align-items:center;gap:8px;font-weight:600;font-size:14px;} .season-pick select{min-height:44px;border:1px solid var(--border-strong);border-radius:8px;padding:0 10px;background:var(--surface);color:var(--text);font:inherit;}

/* phones: the farm name always has room (brief §11: the open farm is obvious at all times) */
@media (max-width:1023px){
  .farm-id{flex:1 1 auto;min-width:0;}
  .farm-id .farm-txt{flex:1 1 auto;min-width:92px;}
  .farm-id .farm-name{max-width:none;font-size:15.5px;}
  .farm-id .farm-chev{display:none;}
  .appbar-actions{flex:none;gap:0;}
  .appbar-actions .icon-btn{min-width:42px;padding:0 8px;}
  #chatOpen .ask-lbl{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);}
  .sync-pill{padding:0 10px;}
}
@media (max-width:360px){ .farm-id .farm-role{display:none;} }
/* the farm name never runs under the buttons beside it (it was drawn over search and the bell; tapping the end of the
   name opened search): the farm button is as wide as its content can shrink to, and the name ends in "…" inside it */
.farm-id{overflow:hidden;}
.farm-id .farm-txt{min-width:0;}
/* on a phone the assistant is in More ("Ask the farm"), so the farm name has room */
@media (max-width:480px){ #chatOpen{display:none !important;} }
/* Larger text: the top bar keeps its normal size on a phone (its words are already large); zoomed, it no longer fit */
@media (max-width:640px){ html[data-text="large"] .appbar{zoom:1;} }
/* in "Which farm?", the farm open now is marked, and Sign out is set apart from the farm buttons */
.farm-choice.is-now{outline:3px solid var(--text);outline-offset:2px;}
.gate-signout{margin-top:22px;padding-top:12px;border-top:1px solid var(--border);}
/* nothing floats over an open form */
body.modal-open #fab, body.modal-open .tabbar{display:none !important;}

/* ---------- records: cards and forms ---------- */
html[data-sheetview="cards"] .cards-host + .sheet-wrap{display:none;}   /* only the record table that the cards replace — never other tables (sync, reports, dashboard) */
html[data-sheetview="table"] .cards-host{display:none;}
.view-switch{display:inline-flex;gap:0;}
.view-switch .opt{min-height:40px;border-radius:0;}
.view-switch .opt:first-child{border-radius:8px 0 0 8px;}
.view-switch .opt:last-child{border-radius:0 8px 8px 0;margin-left:-1px;}
@media (max-width:1023px){ .view-switch{display:none;} }
.rec-cards{list-style:none;margin:0 0 12px;padding:0;display:grid;gap:10px;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));}
.rec-card{
  display:flex;flex-direction:column;gap:6px;width:100%;min-height:64px;padding:14px 16px;text-align:left;cursor:pointer;
  background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:var(--r-md);font:inherit;
}
.rec-card:hover{border-color:var(--border-strong);}
.rc-top{display:flex;align-items:baseline;justify-content:space-between;gap:10px;}
.rc-title{font-weight:700;font-size:16px;line-height:1.3;}
.rc-date{font-size:13.5px;color:var(--text-2);white-space:nowrap;}
.rc-badges{display:flex;flex-wrap:wrap;gap:6px;}
.rc-facts{display:flex;flex-wrap:wrap;gap:4px 14px;font-size:14px;}
.rc-facts .k,.calc-row .k{color:var(--text-2);margin-right:4px;}
.rc-notes{font-size:14px;color:var(--text-2);}
.empty-card{padding:22px;border:1px dashed var(--border-strong);border-radius:var(--r-md);background:var(--surface);color:var(--text-2);display:flex;flex-wrap:wrap;gap:12px;align-items:center;}
.rec-form{display:grid;gap:14px;}
.rec-form .field{margin:0;}
.loc-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap;}
.loc-row input{flex:1;min-width:180px;}
.calc-box{background:var(--surface-2);border:1px solid var(--border);border-radius:var(--r-md);padding:10px 12px;}
.calc-box .k-head{font-weight:700;font-size:13.5px;margin-bottom:6px;}
.calc-row{display:flex;justify-content:space-between;gap:12px;font-size:14px;padding:2px 0;}
.btn.danger-text{color:var(--red-700);border-color:var(--red-700);}
.notice{padding:10px 12px;border-radius:var(--r-sm);background:var(--amber-100);color:var(--amber-700);font-weight:600;margin:0;}
.modal-foot{display:flex;gap:8px;align-items:center;flex-wrap:wrap;}
.rec-form textarea{min-height:88px;resize:vertical;}

/* dialogs: the buttons stay in view on long forms; on phones a dialog is a full-height sheet */
.modal{border-top:0;display:flex;flex-direction:column;max-height:min(92vh,900px);overflow:hidden;}
.modal-head{flex:none;border-bottom:1px solid var(--border);}
.modal-title{color:var(--text);font-weight:750;font-size:19px;}
.modal-body{flex:1 1 auto;overflow-y:auto;overscroll-behavior:contain;}
.modal-foot{flex:none;border-top:1px solid var(--border);background:var(--surface);justify-content:flex-start;}
.modal-foot:empty{display:none;}
@media (max-width:640px){
  .modal-back.open{align-items:flex-end;padding:0;}
  .modal{width:100% !important;max-width:none !important;max-height:94vh;border-radius:var(--r-lg) var(--r-lg) 0 0;}
  .modal-foot{padding-bottom:calc(12px + env(safe-area-inset-bottom));}
  .modal-foot .btn{flex:1 1 auto;}
}

/* ---------- problems (issues) ---------- */
.nav-item .count,.tab .count{margin-left:auto;min-width:20px;height:20px;padding:0 6px;border-radius:10px;background:var(--grey-100);color:var(--text);font:700 12px/20px var(--font-ui);text-align:center;}
.nav-item .count.urgent,.tab .count.urgent{background:var(--red-700);color:#fff;}
html[data-theme="dark"] .nav-item .count.urgent,html[data-theme="dark"] .tab .count.urgent{color:#000;}
.tab{position:relative;}
.tab .count{position:absolute;top:6px;left:calc(50% + 6px);margin:0;}
.cat-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:8px;}
.cat-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;min-height:92px;padding:10px;border:1px solid var(--border-strong);border-radius:var(--r-md);
  background:var(--surface);color:var(--text);font:600 14.5px var(--font-ui);text-align:center;cursor:pointer;}
.cat-btn:hover{border-color:var(--forest-700);background:var(--forest-100);}
.cat-btn .ico{color:var(--forest-700);}
html[data-theme="dark"] .cat-btn .ico{color:var(--pasture-700);}
.opt.pr-urgent[aria-pressed="true"]{border-color:var(--red-700);background:var(--red-100);color:var(--red-700);box-shadow:inset 0 0 0 1px var(--red-700);}
.opt.pr-attention[aria-pressed="true"]{border-color:var(--orange-700);background:var(--orange-100);color:var(--orange-700);box-shadow:inset 0 0 0 1px var(--orange-700);}
.check-row{display:flex;align-items:center;gap:10px;min-height:44px;font-weight:600;}
.check-row input{width:22px;height:22px;}
.field .opt{font-weight:400;color:var(--text-2);}
.iss-card{display:flex;flex-direction:column;gap:6px;width:100%;padding:14px 16px 14px 18px;text-align:left;cursor:pointer;background:var(--surface);color:var(--text);
  border:1px solid var(--border);border-radius:var(--r-md);font:inherit;box-shadow:inset 5px 0 0 var(--grey-700);}
.iss-card.tone-urgent{box-shadow:inset 5px 0 0 var(--red-700);}
.iss-card.tone-attention{box-shadow:inset 5px 0 0 var(--orange-700);}
.iss-card.tone-awaiting{box-shadow:inset 5px 0 0 var(--amber-700);}
.iss-card.tone-info{box-shadow:inset 5px 0 0 var(--blue-700);}
.iss-card.tone-done{box-shadow:inset 5px 0 0 var(--pasture-700);}
.iss-group{margin-top:14px;}
/* V10 #184: the problems as a photo grid, by urgency */
.iss-grid{list-style:none;margin:8px 0 0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px;}
.iss-tile{display:flex;flex-direction:column;width:100%;padding:0;text-align:left;cursor:pointer;background:var(--surface);color:var(--text);border:1px solid var(--border);
  border-radius:var(--r-md);overflow:hidden;font:inherit;position:relative;box-shadow:inset 0 5px 0 var(--grey-700);}
.iss-tile.tone-urgent{box-shadow:inset 0 5px 0 var(--red-700);} .iss-tile.tone-attention{box-shadow:inset 0 5px 0 var(--orange-700);}
.iss-tile.tone-awaiting{box-shadow:inset 0 5px 0 var(--amber-700);} .iss-tile.tone-info{box-shadow:inset 0 5px 0 var(--blue-700);} .iss-tile.tone-done{box-shadow:inset 0 5px 0 var(--pasture-700);}
.iss-tile-img,.iss-tile-none{display:flex;width:100%;aspect-ratio:4/3;object-fit:cover;background:var(--surface-2,#eee);}
.iss-tile-none{flex-direction:column;align-items:center;justify-content:center;gap:4px;color:var(--text-muted,#6b6a60);font-size:13px;}
.iss-tile-n{position:absolute;top:10px;right:8px;background:rgba(0,0,0,.65);color:#fff;border-radius:10px;padding:1px 7px;font-size:12px;}
.iss-tile-t{padding:8px 10px 0;font-weight:600;line-height:1.25;}
.iss-tile-p{padding:2px 10px 10px;font-size:13px;color:var(--text-muted,#6b6a60);}
.iss-list{grid-template-columns:repeat(auto-fill,minmax(320px,1fr));}
.iss-head{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px;}
.kvl{display:grid;grid-template-columns:max-content 1fr;gap:6px 14px;margin:0 0 12px;}
.kvl dt{color:var(--text-2);font-weight:600;}
.kvl dd{margin:0;}
.iss-desc{white-space:pre-wrap;margin:0 0 12px;}
.iss-photos{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin:0 0 12px;}
.iss-thumb{width:96px;height:72px;object-fit:cover;border-radius:var(--r-sm);}
.iss-actions{display:flex;flex-wrap:wrap;gap:8px;margin:4px 0 14px;padding:12px;background:var(--surface-2);border:1px solid var(--border);border-radius:var(--r-md);}
.k-head{font-size:15px;font-weight:700;margin:6px 0 6px;}
.iss-hist{list-style:none;margin:0 0 12px;padding:0;display:grid;gap:8px;}
.iss-hist li{display:flex;flex-direction:column;padding:8px 10px;border-left:3px solid var(--border-strong);background:var(--surface-2);border-radius:0 var(--r-sm) var(--r-sm) 0;}
.iss-hist li.is-comment{border-left-color:var(--blue-700);}
.iss-hist .k{font-size:12.5px;color:var(--text-2);}
.linkish{background:none;border:0;padding:0 2px;color:var(--blue-700);text-decoration:underline;font:inherit;cursor:pointer;min-height:32px;}
.quick-pick.quick-report{border-color:var(--red-700);box-shadow:inset 4px 0 0 var(--red-700);}
/* V5: the New entry grid — the entry's name reads first (16 px, semibold), its hint second (14 px); no letter-spacing */
.quick-pick{font-family:var(--font-ui);font-size:16px;font-weight:600;letter-spacing:0;line-height:1.25;color:var(--text);min-height:64px;display:flex;flex-direction:column;justify-content:flex-start;}
.quick-pick .qp-title{display:flex;align-items:center;gap:8px;}
.quick-pick .qp-emo{font-size:20px;line-height:1;flex:none;width:24px;text-align:center;}
.quick-pick small{font-size:14px;line-height:1.35;color:var(--text-2);margin-top:4px;}
/* problem markers on the map: colour + icon + word (word shown from zoom 15) */
.fm-iss{position:absolute;left:-14px;top:-14px;width:max-content;display:flex;align-items:center;gap:4px;white-space:nowrap;pointer-events:auto;cursor:pointer;}
.fm-iss .dot{flex:none;width:28px;height:28px;border-radius:50%;display:flex;align-items:center;justify-content:center;border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.45);color:#fff;}
.fm-iss .dot .ico{width:16px;height:16px;stroke-width:2.4;}
.fm-iss .w{font:700 12px var(--font-ui);color:#fff;background:rgba(0,0,0,.62);padding:1px 6px;border-radius:8px;}
.fm-nolabels .fm-iss .w{display:none;}
/* a location that is only approximate (paddock centre, or a GPS fix wider than 100 m): dashed ring */
.fm-iss.approx .dot{border-style:dashed;}
/* a problem on a trough, gate…: drawn just above it, so the point itself can still be tapped */
.fm-iss.onfeat{top:-40px;left:-6px;}
/* V9 fix list #46: above the map, not over it (it used to cover the top of the map), and it can be hidden */
.fm-basefail{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0 0 6px;padding:4px 4px 4px 10px;border-radius:8px;background:#FFF4D6;color:#3a2c00;border:1px solid #E7C66A;font:13px/1.35 var(--font-ui);}
.fm-basefail[hidden]{display:none;}
.fm-basefail span{flex:1 1 220px;}
.fm-basefail-x{min-height:44px;}
.fm-tools button{min-width:44px;min-height:44px;}   /* every map tool at least 44 px to tap */
@media (max-width:640px){ .leaflet-touch .leaflet-bar a{width:44px;height:44px;line-height:44px;} }
.fm-isslist{list-style:none;margin:0;padding:0;display:grid;gap:6px;}
.fm-isslist .btn{width:100%;justify-content:flex-start;text-align:left;}
.fm-iss.c-red .dot{background:#C62828;} .fm-iss.c-orange .dot{background:#C2570C;} .fm-iss.c-yellow .dot{background:#B8860B;}
.fm-iss.c-blue .dot{background:#1D63A8;} .fm-iss.c-green .dot{background:#2E7D46;} .fm-iss.c-grey .dot{background:#6B726D;}
.fm-iss.c-red .dot{animation:fmpulse 1.6s ease-out infinite;}
@keyframes fmpulse{0%{box-shadow:0 0 0 0 rgba(198,40,40,.6)}70%{box-shadow:0 0 0 12px rgba(198,40,40,0)}100%{box-shadow:0 0 0 0 rgba(198,40,40,0)}}
@media (prefers-reduced-motion:reduce){ .fm-iss.c-red .dot{animation:none;} }
.fm-icon.broken{outline:3px solid #C62828;outline-offset:1px;border-radius:50%;}
.fm-icon.attention{outline:3px solid #C2570C;outline-offset:1px;border-radius:50%;}

/* ===== Today (app/v4/today.js) ===== */
.today{margin:0 0 8px;}
.t-head{margin:4px 0 16px;}
.t-head h1{font-family:var(--font-display);font-size:clamp(24px,4vw,32px);line-height:1.15;margin:0;color:var(--text);font-weight:700;}
.t-head p{margin:4px 0 0;color:var(--text-2);}
.t-sync{font-size:14px;display:flex;align-items:center;gap:8px;}
.t-sync::before{content:"";width:9px;height:9px;border-radius:50%;background:var(--grey-700);flex:none;}
.t-sync.s-synced::before{background:var(--pasture-700);}
.t-sync.s-pending::before,.t-sync.s-syncing::before{background:var(--blue-700);}
.t-sync.s-offline::before,.t-sync.s-unreachable::before,.t-sync.s-signin::before{background:var(--amber-700);}
.t-sync.s-conflict::before,.t-sync.s-problem::before{background:var(--red-700);}
.t-sync:empty{display:none;}
.t-grid{display:grid;gap:16px;grid-template-columns:1fr;}
.t-col{display:contents;}
@media (min-width:1024px){ .t-grid{grid-template-columns:minmax(0,3fr) minmax(0,2fr);align-items:start;} .t-col{display:flex;flex-direction:column;gap:16px;min-width:0;} }
.t-block{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-md);padding:16px;min-width:0;}
.t-block h2{font-size:17px;font-weight:700;margin:0 0 10px;display:flex;align-items:center;gap:8px;color:var(--text);}
.t-count{font-size:13px;font-weight:700;background:var(--grey-100);color:var(--grey-700);border-radius:999px;padding:1px 8px;}
.t-list{list-style:none;margin:0 0 6px;padding:0;display:grid;gap:8px;}
.t-row{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:10px;width:100%;min-height:52px;padding:10px 12px 10px 14px;text-align:left;cursor:pointer;
  background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:var(--r-sm);font:inherit;box-shadow:inset 4px 0 0 var(--grey-700);}
.t-row:hover{background:var(--surface-2);}
.t-row.tone-urgent{box-shadow:inset 4px 0 0 var(--red-700);} .t-row.tone-urgent .t-ico{color:var(--red-700);}
.t-row.tone-attention{box-shadow:inset 4px 0 0 var(--orange-700);} .t-row.tone-attention .t-ico{color:var(--orange-700);}
.t-row.tone-info{box-shadow:inset 4px 0 0 var(--blue-700);} .t-row.tone-info .t-ico{color:var(--blue-700);}
.t-txt{display:flex;flex-direction:column;min-width:0;}
.t-txt strong{font-weight:650;overflow-wrap:anywhere;}
.t-txt span{color:var(--text-2);font-size:14px;}
.t-empty{color:var(--text-2);margin:0 0 8px;}
.t-note{color:var(--text-2);font-size:14px;margin:6px 0 0;}
.t-job{display:flex;align-items:center;gap:8px;border:1px solid var(--border);border-radius:var(--r-sm);padding:4px 6px 4px 0;}
.t-job.late{border-color:color-mix(in srgb, var(--orange-700) 45%, var(--border));}
.t-job-main{flex:1;min-width:0;min-height:48px;display:flex;flex-direction:column;justify-content:center;text-align:left;background:none;border:0;padding:6px 12px;font:inherit;color:var(--text);cursor:pointer;}
.t-job-main strong{font-weight:650;overflow-wrap:anywhere;}
.t-job-main span{color:var(--text-2);font-size:14px;}
.t-job.late .t-job-main span{color:var(--orange-700);font-weight:600;}
.t-job .btn.sm{min-height:44px;white-space:nowrap;}
.t-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:0 0 12px;}
.t-stat{display:flex;flex-direction:column;align-items:flex-start;gap:2px;padding:10px 12px;min-height:64px;border:1px solid var(--border);border-radius:var(--r-sm);background:var(--surface);color:var(--text);font:inherit;text-align:left;cursor:pointer;box-shadow:inset 0 4px 0 var(--grey-700);}
.t-stat .n{font-size:24px;font-weight:700;line-height:1.1;font-variant-numeric:tabular-nums;}
.t-stat span:last-child{font-size:13px;color:var(--text-2);}
.t-stat.tone-urgent{box-shadow:inset 0 4px 0 var(--red-700);} .t-stat.tone-awaiting{box-shadow:inset 0 4px 0 var(--amber-700);} .t-stat.tone-info{box-shadow:inset 0 4px 0 var(--blue-700);}
.t-actions{display:flex;flex-wrap:wrap;gap:8px;}
.t-changes{list-style:none;margin:0;padding:0;display:grid;gap:6px;}
.t-changes li{display:grid;grid-template-columns:4.5em 1fr;gap:8px;font-size:14.5px;}
.t-changes .when{color:var(--text-2);font-variant-numeric:tabular-nums;}
.t-season{margin-top:28px;}
.t-block .linkish{min-height:44px;}
@media (max-width:480px){ .t-row{grid-template-columns:auto 1fr;} .t-row .badge{grid-column:2;justify-self:start;} .t-stats{grid-template-columns:1fr 1fr 1fr;gap:6px;} .t-stat{padding:8px;} }

/* ===== Timeline (app/v4/timeline.js) ===== */
.tl-filters{display:flex;flex-wrap:wrap;gap:10px;margin:0 0 16px;}
.tl-f{display:flex;flex-direction:column;gap:4px;font-weight:600;font-size:14px;min-width:160px;flex:1 1 160px;max-width:280px;}
.tl-f select{min-height:44px;}
.tl-list,.tl-day-list{list-style:none;margin:0;padding:0;}
.tl-day{margin:0 0 18px;}
.tl-day h3{font-size:15px;font-weight:700;margin:0 0 8px;color:var(--text);position:sticky;top:calc(var(--appbar-h) + 4px);background:var(--bg);padding:4px 0;z-index:1;}
.tl-day-list{display:grid;gap:6px;border-left:2px solid var(--border-strong);margin-left:6px;padding-left:12px;}
.tl-row{display:grid;grid-template-columns:4.6em 1fr;gap:8px;width:100%;text-align:left;padding:8px 10px;background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:var(--r-sm);font:inherit;}
button.tl-row{cursor:pointer;min-height:44px;} button.tl-row:hover{background:var(--surface-2);}
.tl-time{color:var(--text-2);font-variant-numeric:tabular-nums;font-size:14px;padding-top:1px;} .tl-av{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:50%;color:#fff;font-size:11px;font-weight:700;margin-right:6px;vertical-align:middle;letter-spacing:.02em;} .tl-pad h4{margin:6px 0 4px;font-size:14px;color:var(--text-2);} .tl-chk{flex-direction:row;align-items:center;gap:6px;} .tl-strip{display:flex;gap:6px;overflow-x:auto;padding:4px 0 8px;} .tl-ph{height:72px;width:auto;min-width:72px;border-radius:6px;cursor:zoom-in;object-fit:cover;background:var(--surface-2);} .dy-cmp-pick{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0;} .dy-cmp-t{width:100%;border-collapse:collapse;margin:6px 0;} .dy-cmp-t th,.dy-cmp-t td{border-bottom:1px solid var(--border);padding:4px 6px;text-align:left;} .dy-cmp-cols{display:grid;grid-template-columns:1fr 1fr;gap:12px;} .dy-cmp-list{list-style:none;padding:0;margin:0;font-size:13px;} .dy-cmp-list li{padding:3px 0;border-bottom:1px solid var(--border);}
.tl-txt{display:flex;flex-direction:column;gap:2px;min-width:0;}
.tl-sum{color:var(--text-2);font-size:14.5px;overflow-wrap:anywhere;}
.tl-note{color:var(--amber-700);font-size:13px;}
.t-stale{color:var(--amber-700);}

/* ===== Sync centre ===== */
.sc-head{display:flex;flex-direction:column;gap:2px;padding:12px 14px;margin:0 0 12px;border:1px solid var(--border);border-radius:var(--r-md);background:var(--surface);box-shadow:inset 4px 0 0 var(--grey-700);}
.sc-head span{color:var(--text-2);font-size:14px;}
.sc-head.s-synced{box-shadow:inset 4px 0 0 var(--pasture-700);}
.sc-head.s-pending,.sc-head.s-syncing{box-shadow:inset 4px 0 0 var(--blue-700);}
.sc-head.s-offline,.sc-head.s-unreachable,.sc-head.s-signin{box-shadow:inset 4px 0 0 var(--amber-700);}
.sc-head.s-conflict,.sc-head.s-problem{box-shadow:inset 4px 0 0 var(--red-700);}
.sc-wait{margin-top:4px;color:var(--text-2);font-size:14px;}
.t-arrange{margin-top:2px;}
.t-headacts{display:flex;flex-wrap:wrap;gap:4px 16px;align-items:center;}
.t-speak{display:inline-flex;align-items:center;gap:6px;margin-top:2px;}
.t-speak[aria-pressed="true"]{font-weight:700;}
.arr-list{list-style:none;margin:0 0 14px;padding:0;display:grid;gap:6px;}
.arr-list li{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;padding:6px 10px;border:1px solid var(--border);border-radius:var(--r-sm);background:var(--surface);}
.arr-list .check-row{flex:1 1 200px;}
.arr-move{display:flex;gap:6px;margin-left:auto;}
.arr-move .btn{min-height:44px;min-width:64px;}
.sc-table{width:100%;min-width:0;}
.sc-table td{vertical-align:top;overflow-wrap:anywhere;}
.sc-table td:first-child{width:8.5em;font-weight:600;color:var(--text-2);}
table.sheet.sc-table{min-width:0;table-layout:auto;} table.sheet.sc-table td{white-space:normal;max-width:none;}

/* ===== Inventory (app/v4/stockui.js) ===== */
.stk-cell{font-variant-numeric:tabular-nums;font-weight:600;}
.stk-cell.unknown{color:var(--text-2);font-weight:400;font-style:italic;}
.stk-cell.neg{color:var(--red-700);}
.stk-panel{border:1px solid var(--border);border-radius:var(--r-md);padding:12px 14px;margin:6px 0 14px;background:var(--surface-2);}
.stk-qty{font-size:22px;margin:0 0 2px;font-variant-numeric:tabular-nums;}
.stk-qty.neg strong{color:var(--red-700);}
.stk-qty:not(.neg){font-size:22px;}
.stk-actions{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0 4px;}
.stk-actions .btn{min-height:44px;}
.stk-hh{font-size:14px;margin:12px 0 6px;}
.stk-hist{list-style:none;margin:0;padding:0;display:grid;gap:4px;}
.stk-hist li{display:flex;flex-wrap:wrap;justify-content:space-between;gap:2px 10px;padding:6px 8px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r-sm);font-size:14.5px;}
/* "(optional)" inside a label is words, not an option button */
.field label .opt, label.check .opt, .acct .opt{display:inline;border:0;background:none;padding:0;min-height:0;box-shadow:none;font-weight:400;color:var(--text-2);cursor:inherit;}   /* "(optional)" and hints are words, not the option buttons that share the class name (the sign-in hint looked like a box) */
/* the "Saved on this device" flash is not shown over an open dialog (it covered the dialog's close button);
   saving a form closes the dialog with its own message */
body.modal-open #savedFlash{display:none;}

/* ===== Jobs (app/v4/jobs.js) ===== */
.job-extra{border-top:1px solid var(--border);margin-top:6px;padding-top:6px;}
.job-rep{margin:8px 0;}
.job-ck{list-style:none;margin:0 0 8px;padding:0;display:grid;gap:4px;}
.job-ck li{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:2px 10px;padding:2px 8px;border:1px solid var(--border);border-radius:var(--r-sm);background:var(--surface);}
.job-ck input:checked + span{text-decoration:line-through;color:var(--text-2);}
.job-add{display:flex;gap:8px;margin:4px 0 6px;} .job-add input{flex:1;min-width:0;min-height:44px;} .job-add .btn{min-height:44px;}
.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;}

/* ===== Machinery (app/v4/machines.js) ===== */
.mach-hours{font-size:20px;margin:8px 0;}
.mach-plan{list-style:none;margin:0 0 8px;padding:0;display:grid;gap:6px;}
.mach-plan li{padding:8px 10px;border:1px solid var(--border);border-radius:var(--r-sm);background:var(--surface);display:grid;gap:2px;}
.mach-plan li > div:first-child{display:flex;flex-wrap:wrap;gap:6px 8px;align-items:center;}
.mach-add{display:flex;flex-wrap:wrap;gap:8px;align-items:flex-end;margin:4px 0;}
.mach-add label{display:flex;flex-direction:column;gap:4px;font-weight:600;font-size:14px;flex:1 1 120px;}
.mach-add input,.mach-add select{min-height:44px;}
.mach-add .btn{min-height:44px;}

/* ===== Photos and documents on a record (app/v4/files.js) ===== */
.file-list{list-style:none;margin:0 0 8px;padding:0;display:grid;gap:6px;}
.file-list li{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;padding:8px 10px;border:1px solid var(--border);border-radius:var(--r-sm);background:var(--surface);}
.file-ico{font:700 11px var(--font-ui);color:var(--red-700);border:1.5px solid var(--red-700);border-radius:4px;padding:2px 4px;}
.file-name{flex:1 1 140px;min-width:0;overflow-wrap:anywhere;font-weight:600;}
.file-list .btn{min-height:44px;}

/* ===== Work reports (app/v4/reports.js) ===== */
.rp-sec{margin:18px 0 8px;}
.rp-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:0 0 6px;}
.rp-head h2{font-size:18px;margin:0;}
table.sheet.rp-table{min-width:0;width:100%;}
.rp-table td.num{text-align:right;font-variant-numeric:tabular-nums;}
.rp-tag{display:inline-block;font-size:11px;font-weight:600;padding:0 5px;border-radius:999px;margin-left:4px;vertical-align:1px;border:1px solid var(--border);color:var(--text-2);}
.rp-tag.rp-w{color:var(--blue-700);border-color:color-mix(in srgb, var(--blue-700) 40%, transparent);}
.rp-tag.rp-e{color:var(--amber-700);border-color:color-mix(in srgb, var(--amber-700) 40%, transparent);}
table.sheet.rp-table thead th{background:var(--surface-2);color:var(--text);white-space:normal;vertical-align:bottom;font-size:13px;line-height:1.3;border-bottom:2px solid var(--border-strong);}
table.sheet.rp-table td{white-space:normal;}
.rp-tag{display:block;width:max-content;margin:3px 0 0;}
.tl-f input{min-height:44px;}

/* ===== Notification bell (app/v4/notices.js) ===== */
.bell-btn{position:relative;}
.bell-count{position:absolute;top:2px;right:0;min-width:18px;height:18px;padding:0 5px;border-radius:999px;background:var(--red-700);color:#fff;font:700 11px/18px var(--font-ui);text-align:center;}
.bell-btn.has-new::after{content:"";position:absolute;top:6px;right:6px;width:8px;height:8px;border-radius:50%;background:var(--blue-700);}
.t-row.is-new{border-color:var(--border-strong);}
/* narrow phones (≤ 380 px): the header keeps search, the bell, sync status (with its word) and the account;
   Ask moves to the More sheet ("Ask the farm") */
@media (max-width:380px){ .appbar-actions .flc-btn{display:none;} .appbar-actions{gap:2px;} }
/* Check the records (data health, F19) */
.dh-sum{margin:6px 0 4px;font-size:15px;}
.dh-sec{margin:18px 0 6px;} .dh-sec h2{font-size:17px;margin:0 0 8px;}
.dh-list{list-style:none;margin:0;padding:0;display:grid;gap:8px;}
.dh-item{display:grid;grid-template-columns:1fr auto;gap:12px;align-items:center;padding:12px 12px 12px 16px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r-sm);box-shadow:inset 4px 0 0 var(--grey-700);}
.dh-item.tone-urgent{box-shadow:inset 4px 0 0 var(--red-700);} .dh-item.tone-attention{box-shadow:inset 4px 0 0 var(--orange-700);} .dh-item.tone-info{box-shadow:inset 4px 0 0 var(--blue-700);}
.dh-txt{display:grid;gap:3px;min-width:0;} .dh-txt strong{overflow-wrap:anywhere;} .dh-txt span{color:var(--text-2);font-size:14px;}
.dh-side{display:flex;flex-direction:column;align-items:flex-end;gap:6px;} .dh-more{font-size:12px;color:var(--text-2);}
@media (max-width:480px){ .dh-item{grid-template-columns:1fr;} .dh-side{flex-direction:row;flex-wrap:wrap;align-items:center;} }
/* a button hidden for this person's role stays hidden (the button classes set display) */
.btn[hidden], button[hidden]{display:none !important;}

/* ---------- Weather (10 Nov, master prompt Part 4) ----------
   Official MetService warnings use the warning's own colour level (yellow watch / orange / red), each with an icon and
   the word; Farm Ledger's advisories are drawn quieter (a left rule, no fill) so they never look official. */
.wx-grid{display:grid;gap:16px;grid-template-columns:1fr;}
@media (min-width:1024px){ .wx-grid{grid-template-columns:repeat(2,minmax(0,1fr));} .wx-grid > .wx-sec:first-child{grid-column:1 / -1;} }
.wx-meta,.wx-src{color:var(--text-2);font-size:13px;margin:6px 0 0;}
.wx-notes{color:var(--text-2);font-size:13px;margin:4px 0 0;padding-left:18px;}
.wx-foot{margin-top:16px;}
.wx-err{color:var(--orange-700);}
.wx-banner{display:flex;gap:10px;align-items:flex-start;padding:12px 14px;border-radius:var(--r-md);margin:0 0 16px;font-size:15px;}
.wx-banner .ico{flex:none;margin-top:2px;}
.wx-old{background:var(--orange-100);color:var(--orange-700);border:1px solid color-mix(in srgb, var(--orange-700) 35%, transparent);}
.wx-old b{color:inherit;}
.wx-now-main{display:flex;gap:14px;align-items:center;}
.wx-big{font-size:48px;line-height:1;font-weight:750;letter-spacing:-.02em;}
.wx-big small{font-size:20px;font-weight:600;margin-left:2px;color:var(--text-2);}
.wx-desc{color:var(--text-2);font-size:15px;margin-top:4px;}
.wx-cells{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1px;background:var(--border);border:1px solid var(--border);border-radius:var(--r-md);overflow:hidden;margin-top:14px;}
@media (min-width:600px){ .wx-cells{grid-template-columns:repeat(4,minmax(0,1fr));} }
.wx-cell{background:var(--surface);padding:10px 12px;display:grid;gap:2px;min-width:0;}
.wx-cell span{font-size:12px;color:var(--text-2);}
.wx-cell b{font-size:15px;font-weight:650;overflow-wrap:anywhere;}
.wx-warn{border-radius:var(--r-md);padding:12px 14px;margin:0 0 10px;border:1px solid;}
.wx-warn p{margin:6px 0 0;}
.wx-warn-h{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:16px;}
.wx-warn-area,.wx-warn-when{font-size:14px;}
.wx-warn-do{font-weight:600;}
.wx-watch{background:var(--amber-100);border-color:color-mix(in srgb, var(--amber-700) 40%, transparent);color:var(--text);}
.wx-attention{background:var(--orange-100);border-color:color-mix(in srgb, var(--orange-700) 45%, transparent);color:var(--text);}
.wx-urgent{background:var(--red-100);border-color:color-mix(in srgb, var(--red-700) 45%, transparent);color:var(--text);}
.badge.wx-b-watch{background:var(--amber-700);color:var(--surface);} .badge.wx-b-attention{background:var(--orange-700);color:var(--surface);} .badge.wx-b-urgent{background:var(--red-700);color:var(--surface);}
.wx-adv{list-style:none;margin:10px 0 0;padding:0;display:grid;gap:8px;}
.wx-adv li{display:grid;grid-template-columns:110px 1fr;gap:2px 12px;padding:8px 0 8px 12px;border-left:3px solid var(--border-strong);}
.wx-adv li.wx-adv-attention{border-left-color:var(--orange-700);}
.wx-adv li.wx-adv-watch{border-left-color:var(--amber-700);}
.wx-adv li > span:last-child{grid-column:2;color:var(--text-2);font-size:14px;}
.wx-adv-day{font-weight:650;color:var(--text-2);font-size:14px;}
@media (max-width:480px){ .wx-adv li{grid-template-columns:1fr;} .wx-adv li > span:last-child{grid-column:1;} }
.wx-nowrap{white-space:nowrap;} .wx-tm{display:block;margin:0 !important;}
.wx-adv-sm li{grid-template-columns:90px 1fr;padding:4px 0 4px 10px;}
.wx-jobs{margin:6px 0 0;padding-left:18px;} .wx-jobs li{margin:4px 0;}
.wx-table{width:100%;border-collapse:collapse;font-size:14px;margin-top:4px;font-variant-numeric:tabular-nums;}
.wx-table th{text-align:left;font-size:12px;color:var(--text-2);font-weight:600;padding:6px 6px;border-bottom:1px solid var(--border);}
.wx-table td{padding:6px;border-bottom:1px solid var(--border);vertical-align:middle;}
.wx-table small{color:var(--text-2);font-size:12px;margin-left:3px;}
.wx-table .wx-ic svg{display:block;}
.wx-days{list-style:none;margin:0;padding:0;}
.wx-days li{display:grid;grid-template-columns:34px minmax(0,1fr) auto auto;grid-template-areas:"i n t r" "i x x x";gap:2px 12px;align-items:center;padding:10px 0;border-bottom:1px solid var(--border);font-variant-numeric:tabular-nums;}
.wx-days li:last-child{border-bottom:0;}
.wx-d-ic{grid-area:i;} .wx-d-name{grid-area:n;font-weight:650;min-width:0;} .wx-d-t{grid-area:t;white-space:nowrap;} .wx-d-t span{color:var(--text-2);margin-left:4px;}
.wx-d-r{grid-area:r;color:var(--blue-700);white-space:nowrap;text-align:right;min-width:92px;} .wx-d-x{grid-area:x;font-size:13px;color:var(--text-2);}
.wx-bars{display:flex;align-items:flex-end;gap:3px;height:52px;margin-top:10px;border-bottom:1px solid var(--border);}
.wx-bars span{flex:1;background:var(--blue-700);border-radius:2px 2px 0 0;min-width:4px;opacity:.85;}
.wx-limits{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:10px;margin-top:10px;}
.wx-limit-list{margin:8px 0 0;padding-left:18px;}
details.wx-sec > summary{cursor:pointer;list-style:none;min-height:44px;display:flex;align-items:center;}
details.wx-sec > summary h2{margin:0;font-size:17px;}
details.wx-sec > summary::-webkit-details-marker{display:none;}
details.wx-sec > summary::after{content:"Show";margin-left:auto;font-size:14px;color:var(--blue-700);}
details.wx-sec[open] > summary::after{content:"Hide";}
/* the Today card */
.t-wx-now{display:flex;gap:12px;align-items:center;margin:4px 0 6px;}
.t-wx-temp{font-size:24px;font-weight:750;}
.wx-pill{display:flex;gap:8px;align-items:center;width:100%;text-align:left;border-radius:var(--r-md);padding:10px 12px;margin:0 0 8px;border:1px solid;font:inherit;font-weight:650;cursor:pointer;min-height:44px;}
.wx-pill small{margin-left:auto;font-weight:500;color:var(--text-2);}
html[data-contrast="high"] .wx-warn, html[data-contrast="high"] .wx-pill{border-width:2px;border-color:currentColor;}

/* ---------- Contacts & emergency (10 Nov) ---------- */
.ct-grid{display:grid;gap:16px;grid-template-columns:1fr;}
@media (min-width:1024px){ .ct-grid{grid-template-columns:minmax(0,5fr) minmax(0,7fr);align-items:start;} }
.ct-emerg{border-color:color-mix(in srgb, var(--red-700) 35%, var(--border));}
.btn.ct-111{background:var(--red-700);border-color:var(--red-700);color:var(--surface);font-size:18px;min-height:52px;width:100%;justify-content:center;gap:10px;margin:2px 0 12px;}
.btn.ct-111:hover{filter:brightness(.95);}
.ct-farm{background:var(--surface-2);border:1px solid var(--border);border-radius:var(--r-md);padding:10px 12px;margin-bottom:12px;}
.ct-farm p{margin:6px 0 0;white-space:pre-line;}
.ct-pos{font-size:1.25rem;line-height:1.5;margin:8px 0 0;}
.ct-list{list-style:none;margin:0;padding:0;display:grid;gap:10px;}
.ct-card{border:1px solid var(--border);border-radius:var(--r-md);padding:10px 12px;display:grid;gap:6px;background:var(--surface);}
.ct-main{display:flex;flex-wrap:wrap;gap:4px 10px;align-items:center;}
.ct-org{color:var(--text-2);}
.ct-calls{display:flex;flex-wrap:wrap;gap:8px;}
.ct-call{min-height:44px;}
.ct-line{font-size:14px;overflow-wrap:anywhere;}
.ct-notes{color:var(--text-2);white-space:pre-line;}
.ct-card .linkish{justify-self:start;min-height:36px;}

/* ---------- Calendar (10 Nov) ----------
   One colour per kind of entry, always with its word (the badge in the list) — never colour alone. */
.k-job{--k:var(--blue-700);} .k-repeat{--k:var(--grey-700);} .k-service{--k:var(--purple-700);} .k-paperwork{--k:var(--amber-700);} .k-withholding{--k:var(--orange-700);} .k-weather{--k:var(--soil-700);} .k-booking{--k:var(--forest-700);} .k-note{--k:var(--grey-700);} .k-roster{--k:var(--pasture-700);} .k-season{--k:var(--pasture-700);} .k-holiday{--k:var(--red-700);}
.cal-bar{display:flex;flex-wrap:wrap;gap:10px 16px;align-items:center;justify-content:space-between;margin:0 0 10px;}
.cal-nav{display:flex;gap:6px;align-items:center;flex-wrap:wrap;}
.cal-nav .btn{min-width:44px;min-height:44px;font-size:18px;}
.cal-title{font-size:18px;margin:0 0 0 6px;}
.cal-seg{display:inline-flex;border:1px solid var(--border-strong);border-radius:var(--r-md);overflow:hidden;}
.cal-seg .seg{background:var(--surface);border:0;padding:10px 14px;min-height:44px;font:inherit;font-weight:600;color:var(--text);cursor:pointer;}
.cal-seg .seg + .seg{border-left:1px solid var(--border-strong);}
.cal-seg .seg.on{background:var(--primary);color:var(--on-primary);}
.cal-filter{margin:0 0 12px;} .cal-filter summary{cursor:pointer;min-height:40px;display:flex;align-items:center;color:var(--blue-700);font-weight:600;}
.cal-chips{display:flex;flex-wrap:wrap;gap:8px;margin-top:6px;}
.cal-chip{display:inline-flex;gap:6px;align-items:center;border:1px solid var(--border);border-left:4px solid var(--k);border-radius:999px;padding:6px 12px;min-height:40px;background:var(--surface);}
.cal-grid{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-md);overflow:hidden;margin-bottom:16px;}
.cal-wd{display:grid;grid-template-columns:repeat(7,1fr);background:var(--surface-2);border-bottom:1px solid var(--border);}
.cal-wd span{font-size:12px;font-weight:650;color:var(--text-2);padding:6px 8px;text-align:left;}
.cal-cells{display:grid;grid-template-columns:repeat(7,1fr);}
.cal-cell{position:relative;display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-height:58px;padding:6px;border:0;border-right:1px solid var(--border);border-bottom:1px solid var(--border);background:var(--surface);font:inherit;color:var(--text);text-align:left;cursor:pointer;min-width:0;}
.cal-cell:nth-child(7n){border-right:0;}
.cal-cell.out{background:var(--surface-2);color:var(--text-2);}
.cal-cell.is-today .cal-n{background:var(--primary);color:var(--on-primary);border-radius:999px;}
.cal-cell.is-picked{box-shadow:inset 0 0 0 2px var(--focus);}
.cal-n{font-weight:650;font-size:14px;min-width:26px;height:26px;display:inline-flex;align-items:center;justify-content:center;font-variant-numeric:tabular-nums;}
.cal-dots{display:flex;gap:3px;align-items:center;flex-wrap:wrap;}
.cal-dots i{width:8px;height:8px;border-radius:999px;background:var(--k);display:block;}
.cal-dots i.is-late{outline:2px solid var(--red-700);outline-offset:1px;}
.cal-dots b{font-size:11px;color:var(--text-2);}
.cal-peek{display:none;}
@media (min-width:1024px){
  .cal-cell{min-height:104px;}
  .cal-dots{display:none;}
  .cal-peek{display:grid;gap:2px;width:100%;}
  .cal-peek span{font-size:12px;line-height:1.3;padding:2px 6px;border-radius:4px;background:color-mix(in srgb, var(--k) 14%, transparent);border-left:3px solid var(--k);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
  .cal-peek span.is-done{text-decoration:line-through;opacity:.7;}
  .cal-peek .more{background:none;border:0;color:var(--text-2);}
}
.cal-list{list-style:none;margin:0 0 10px;padding:0;display:grid;gap:8px;}
.cal-item{display:flex;gap:10px;align-items:center;width:100%;text-align:left;border:1px solid var(--border);border-left:4px solid var(--k);border-radius:var(--r-md);background:var(--surface);padding:10px 12px;min-height:48px;font:inherit;color:var(--text);cursor:pointer;}
.cal-item .cal-t{display:grid;gap:2px;flex:1;min-width:0;} .cal-item .cal-t span{color:var(--text-2);font-size:13px;}
.cal-item.is-done strong{text-decoration:line-through;opacity:.75;}
/* V10 #348: jobs coloured by person */
.cal-item.by-p{border-left:8px solid var(--calp);} .cal-peek .by-p, .cal-legend i{border-left:6px solid var(--calp);padding-left:4px;} .cal-legend{display:flex;flex-wrap:wrap;gap:6px 12px;margin:6px 0;font-size:13px;list-style:none;padding:0;} .cal-legend i{display:inline-block;width:0;height:14px;vertical-align:middle;margin-right:4px;}
.cal-item.is-projected{border-style:dashed;border-left-style:solid;}
.cal-item.is-projected strong{font-style:italic;font-weight:600;}
.cal-kind{flex:none;}
.cal-week{display:grid;gap:12px;}
@media (min-width:1024px){ .cal-week{grid-template-columns:repeat(7,minmax(0,1fr));} .cal-week .cal-item{flex-direction:column;align-items:flex-start;} }
.cal-wday h2{font-size:15px;margin:0 0 8px;} .cal-wday.is-today{border-color:var(--primary);}

/* ---------- Today as the control centre (10 Nov) ---------- */
.t-area{display:inline-block;margin-left:6px;padding:1px 8px;border-radius:999px;background:var(--farm);color:#fff;font-size:12px;font-weight:700;letter-spacing:.02em;vertical-align:1px;}
.t-farm{font-weight:650;color:var(--text);}
.t-glance{padding:10px;margin:0 0 16px;}
.t-coming .cal-item{min-height:40px;padding:8px 10px;}
.t-glance-row{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;}
@media (max-width:480px){ .t-tile{min-height:64px;padding:8px;} .t-tile .n{font-size:22px;} .t-tile .l{font-size:12px;line-height:1.25;} }
@media (min-width:1024px){ .t-glance-row{grid-template-columns:repeat(6,minmax(0,1fr));} }
.t-tile{display:grid;gap:2px;justify-items:start;text-align:left;border:1px solid var(--border);border-radius:var(--r-md);background:var(--surface-2);padding:10px 12px;min-height:72px;font:inherit;color:var(--text);cursor:pointer;}
.t-tile .n{font-size:28px;line-height:1;font-weight:750;font-variant-numeric:tabular-nums;}
.t-tile .l{font-size:13px;color:var(--text-2);font-weight:600;}
.t-tile .s{font-size:12px;color:var(--text-2);}
.t-tile.is-zero .n{color:var(--text-2);opacity:.8;}
.t-tile.tone-urgent{background:var(--red-100);border-color:color-mix(in srgb, var(--red-700) 35%, transparent);} .t-tile.tone-urgent .n{color:var(--red-700);}
.t-tile.tone-attention{background:var(--orange-100);border-color:color-mix(in srgb, var(--orange-700) 35%, transparent);} .t-tile.tone-attention .n{color:var(--orange-700);}
.t-tile.tone-info{background:var(--blue-100);border-color:color-mix(in srgb, var(--blue-700) 30%, transparent);} .t-tile.tone-info .n{color:var(--blue-700);}
html[data-contrast="high"] .t-tile{border-width:2px;border-color:currentColor;}
.t-coming{list-style:none;margin:0 0 8px;padding:0;display:grid;gap:10px;}
.t-coming > li{display:grid;grid-template-columns:96px 1fr;gap:8px;align-items:start;}
.t-coming .when{font-weight:650;font-size:14px;color:var(--text-2);padding-top:12px;}
.t-coming ul{list-style:none;margin:0;padding:0;display:grid;gap:6px;}
@media (max-width:480px){ .t-coming > li{grid-template-columns:1fr;} .t-coming .when{padding-top:0;} }
.t-big{font-size:15px;margin:0 0 8px;} .t-big b{font-size:26px;font-weight:750;}
.t-mobs{list-style:none;margin:0 0 8px;padding:0;display:grid;gap:6px;}
.t-mobs li{display:flex;justify-content:space-between;gap:10px;border-bottom:1px solid var(--border);padding:6px 0;}
.t-mobs li span{color:var(--text-2);text-align:right;}
.badge.watch{background:var(--soil-100);color:var(--soil-700);}

/* ---------- Farm diary and paddock rest (10 Nov) ---------- */
.dy-tools{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0 4px;}
.dy-search{flex:1 1 260px;display:flex;align-items:center;gap:8px;min-height:44px;padding:0 12px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text-2);}
.dy-search:focus-within{border-color:var(--primary);box-shadow:0 0 0 3px color-mix(in srgb,var(--primary) 25%,transparent);}
.dy-search input{flex:1;min-width:0;border:0;background:transparent;color:var(--text);font:inherit;font-size:16px;outline:none;}
#dyKind{min-height:44px;padding:0 10px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text);font:inherit;font-size:15px;}
.dy-count{margin:6px 0 10px;color:var(--text-2);font-size:14px;}
.dy-day h2{font-size:15px;}
.dy-day .cal-kind{white-space:nowrap;}
.t-sub{margin:14px 0 6px;font-size:14px;font-weight:700;color:var(--text-2);}
.t-rest{margin-top:8px;}
.t-rest summary{min-height:44px;display:flex;align-items:center;cursor:pointer;color:var(--primary);font-weight:600;}
.t-rest .linkish{min-height:0;padding:0;margin-left:6px;}

/* ---------- the Calendar's month for the shed wall (V10 #352) ---------- */
.cal-print{display:none;}
@media print{
  @page calmonth{size:A4 landscape;margin:10mm;}   /* a named page: other printouts keep their own page */
  body.print-cal > *:not(#calPrint){display:none !important;}
  body.print-cal #calPrint{page:calmonth;display:block;color:#000;background:#fff;font:9pt/1.25 var(--font-ui);}
  #calPrint h1{font-size:16pt;margin:0 0 6pt;}
  #calPrint table{width:100%;border-collapse:collapse;table-layout:fixed;}
  #calPrint th{border:1pt solid #000;padding:2pt;font-size:10pt;}
  #calPrint td{border:1pt solid #000;padding:2pt 3pt;vertical-align:top;height:26mm;overflow:hidden;}
  #calPrint td.out{color:#666;} #calPrint td b{font-size:11pt;display:block;}
  #calPrint td div{font-size:8pt;line-height:1.2;} #calPrint td i{font-style:normal;font-weight:700;}
  #calPrint .cal-print-foot{font-size:8pt;margin-top:4pt;}
}
/* ---------- the printed emergency sheet (10 Nov) ---------- */
.em-print{display:none;}
@media print{
  body.print-emerg > *:not(#emPrint){display:none !important;}
  body.print-emerg #emPrint{display:block;color:#000;background:#fff;font:12pt/1.4 var(--font-ui);}
  #emPrint h1{font-size:20pt;margin:0 0 8pt;} #emPrint h2{font-size:14pt;margin:14pt 0 4pt;border-bottom:1pt solid #000;}
  #emPrint .em-111{font-size:28pt;margin:6pt 0 10pt;} #emPrint .em-111 b{font-size:40pt;}
  #emPrint .em-addr{font-size:14pt;font-weight:700;}
  #emPrint table{width:100%;border-collapse:collapse;} #emPrint th,#emPrint td{border:1pt solid #000;padding:4pt 6pt;text-align:left;vertical-align:top;font-size:12pt;}
  #emPrint td:nth-child(3),#emPrint td:nth-child(4){font-size:14pt;font-weight:700;white-space:nowrap;}
  #emPrint .em-foot{margin-top:14pt;font-size:9pt;}
}

/* machine page: this season's fuel and costs (10 Nov) */
.mach-use{display:grid;grid-template-columns:max-content 1fr;gap:4px 14px;margin:4px 0 6px;}
.mach-use dt{color:var(--text-2);} .mach-use dd{margin:0;font-weight:600;}

/* Today: your other farms (10 Nov) */
.t-farms{list-style:none;margin:0;padding:0;display:grid;gap:10px;}
.t-farms li{padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:var(--surface-2);}
.t-farm-h{display:flex;align-items:center;gap:8px;} .t-farms p{margin:6px 0 8px;}

/* calendar (10 Nov review fixes): late jobs in the desktop peek; a week day's heading opens it */
.cal-peek .is-late{color:var(--red-700);font-weight:700;}
.cal-wday-open{min-height:44px;padding:0;font:inherit;font-weight:700;color:inherit;text-decoration:underline;text-underline-offset:3px;}

/* touch targets of at least 44 px on a phone (10 Nov, reviewer 1) */
@media (pointer: coarse), (max-width: 699px){
  .linkish{min-height:44px;}
  .t-arrange, .t-speak, .mach-del, .ct-card .linkish, .t-rest .linkish{min-height:44px;padding:0 6px;}
  .cal-chip{min-height:44px;}
}

/* the records an at-a-glance number counted (10 Nov) */
.t-tlist{list-style:none;margin:0;padding:0;display:grid;gap:6px;}
.t-tlist-item{width:100%;min-height:52px;text-align:left;display:flex;flex-direction:column;gap:2px;padding:8px 12px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text);font:inherit;cursor:pointer;}
.t-tlist-item span{color:var(--text-2);font-size:14px;}
.t-tlist-item:focus-visible{outline:3px solid var(--primary);outline-offset:2px;}

/* two short fields side by side (Move stock: date and time) */
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-pair > .field { min-width: 0; }

/* round 3 (reviewer 7): V3 text coloured --pasture-dark was a dark green on the dark card (1.1:1) — readable now */
html[data-theme="dark"] .quick-pick, html[data-theme="dark"] .ai-body b, html[data-theme="dark"] .paddock-name, html[data-theme="dark"] .spark-name,
html[data-theme="dark"] tfoot td.lbl, html[data-theme="dark"] .wx-place, html[data-theme="dark"] .qr-card .qn, html[data-theme="dark"] .onboard-card h2 { color: var(--text); }
html[data-theme="dark"] .quick-pick:hover { background: var(--paper, #1D201B); }

/* round 3 (reviewers 1 and 7): with Larger text on a 360 px phone the diary's period buttons, its search box and the
   Problems filter chips pushed the page sideways (and the tab bar off screen) */
.cal-seg{flex-wrap:wrap;max-width:100%;}
.dy-search{min-width:0;flex-basis:200px;}
nav.subtabs.chips{max-width:100%;min-width:0;}
.page-head, .dy-tools, .cal-head{min-width:0;max-width:100%;flex-wrap:wrap;}
html[data-text="large"] .cal-seg .seg{padding:10px 10px;}
#issuesHost nav.chips{flex-wrap:wrap;overflow:visible;}
.season-pick{max-width:100%;flex-wrap:wrap;} .season-pick select{max-width:100%;min-width:0;} .toolbar{flex-wrap:wrap;min-width:0;}
/* round 3 (reviewer 7): a skip link, shown only when it has keyboard focus */
.skip-link{position:absolute;left:8px;top:-60px;z-index:200;background:var(--surface);color:var(--text);padding:10px 14px;border:2px solid var(--focus,#1A5FB4);border-radius:8px;font-weight:600;}
.skip-link:focus{top:8px;}
main:focus{outline:none;}

/* round 4: a device not on New Zealand time (dates, times and withholding would be wrong) */
.zone-banner{margin:0;padding:12px 16px;background:var(--red-700, #9b1c1c);color:#fff;font-size:15px;line-height:1.4;}
.zone-banner strong{display:block;margin-bottom:2px;}

/* round 4: a Delete waiting for its second tap */
[data-rfdel].armed{background:var(--red-700, #9b1c1c) !important;color:#fff !important;}
/* round 4 (R4-9-5): failed or overdue automatic backup, owners only */
.t-backup-warn{margin:0 0 12px;padding:10px 14px;border-radius:8px;background:var(--red-50, #fdecec);color:var(--red-800, #7f1d1d);border:1px solid var(--red-300, #f2a7a7);font-size:15px;line-height:1.4;}
.t-backup-warn strong{display:block;margin-bottom:2px;}
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .t-backup-warn{background:#3b1414;color:#ffd7d7;border-color:#7f1d1d;} }
:root[data-theme="dark"] .t-backup-warn{background:#3b1414;color:#ffd7d7;border-color:#7f1d1d;}

/* ===== V5: Owner Control Centre ===== */
.cc-sub{color:var(--text-2);margin:4px 0 0;max-width:70ch;}
.cc-tabs{display:flex;gap:4px;overflow-x:auto;border-bottom:1px solid var(--border);margin:12px 0 16px;scrollbar-width:thin;}
.cc-tabs button{flex:0 0 auto;min-height:44px;padding:0 14px;border:0;background:none;color:var(--text-2);font:inherit;font-weight:600;border-bottom:3px solid transparent;cursor:pointer;}
.cc-tabs button[aria-current="page"]{color:var(--text);border-bottom-color:var(--primary);}
.cc-tabs button:focus-visible{outline:2px solid var(--focus);outline-offset:-2px;}
.cc-body{display:grid;grid-template-columns:minmax(0,1fr);gap:16px;}   /* (V10: a card never widens the page past the phone; wide tables scroll in their own box) */
.cc-card{min-width:0;background:var(--surface);border:1px solid var(--border);border-radius:var(--r-md);padding:14px 16px;}
.cc-card h2{font-size:1.05rem;margin:0 0 10px;display:flex;align-items:baseline;gap:8px;}
.cc-attn{border-color:var(--amber-700);background:var(--amber-100);}
.cc-attn ul{margin:0;padding-left:18px;display:grid;gap:6px;}
.cc-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:space-between;}
.cc-count{font-weight:500;color:var(--text-2);font-size:.9em;}
.cc-note{margin:0 0 8px;color:var(--text-2);font-size:.95rem;}
.cc-table{width:100%;border-collapse:collapse;font-size:.95rem;}
.cc-table th,.cc-table td{text-align:left;padding:8px 6px;border-top:1px solid var(--border);vertical-align:top;}
.cc-table th{color:var(--text-2);font-weight:600;border-top:0;}
/* V5 (§10): on a phone each row of a Control Centre list is a small labelled block — the person (or the copy's date) first,
   then "Position: …", "Access: …" — instead of five unlabelled lines */
@media (max-width:600px){
  .cc-table:not(.cc-kv) thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);}
  .cc-table:not(.cc-kv), .cc-table:not(.cc-kv) tbody, .cc-table:not(.cc-kv) tr, .cc-table:not(.cc-kv) td{display:block;width:100%;box-sizing:border-box;}
  .cc-table:not(.cc-kv) tr{padding:10px 0;border-top:1px solid var(--border);}
  .cc-table:not(.cc-kv) td{border:0;padding:2px 0;}
  .cc-table:not(.cc-kv) td:first-child{font-weight:600;}
  .cc-table:not(.cc-kv) td[data-label]::before{content:attr(data-label) ': ';color:var(--text-2);font-weight:600;}
  .cc-table:not(.cc-kv) td:empty{display:none;}
}
.cc-pill{display:inline-block;padding:2px 10px;border-radius:999px;font-size:.85rem;font-weight:600;white-space:nowrap;}
.cc-ok{background:var(--pasture-100);color:var(--pasture-700);} .cc-warn{background:var(--amber-100);color:var(--amber-700);}
.cc-bad{background:var(--red-100);color:var(--red-700);} .cc-mute{background:var(--grey-100);color:var(--grey-700);}
.cc-chips{display:flex;flex-wrap:wrap;gap:6px;}
.cc-chips button{min-height:44px;padding:0 12px;border-radius:999px;border:1px solid var(--border-strong);background:var(--surface);color:var(--text);font:inherit;cursor:pointer;}
.cc-chips button[aria-pressed="true"]{background:var(--primary);border-color:var(--primary);color:var(--on-primary);}
.cc-chips button[aria-pressed="true"] .cc-count{color:inherit;}
.cc-people{list-style:none;margin:0;padding:0;display:grid;gap:8px;}
.cc-person{display:flex;align-items:center;gap:10px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r-md);padding:4px 12px 4px 4px;}
.cc-person-main{flex:1;min-width:0;display:grid;gap:2px;text-align:left;background:none;border:0;padding:10px 8px;font:inherit;color:inherit;cursor:pointer;border-radius:var(--r-sm);min-height:44px;}
.cc-person-main:focus-visible{outline:2px solid var(--focus);}
.cc-name{font-weight:650;font-size:1.02rem;}
.cc-meta{display:block;color:var(--text-2);font-size:.92rem;overflow-wrap:anywhere;}
.cc-you{font-size:.8rem;font-weight:600;color:var(--text-2);border:1px solid var(--border);border-radius:999px;padding:0 6px;margin-left:4px;}
.cc-empty{padding:18px;color:var(--text-2);text-align:center;}
.cc-dl{display:grid;grid-template-columns:max-content 1fr;gap:8px 14px;margin:0 0 14px;}
.cc-dl dt{color:var(--text-2);font-weight:600;} .cc-dl dd{margin:0;}
@media (max-width:480px){.cc-dl{grid-template-columns:1fr;gap:2px;}.cc-dl dd{margin-bottom:8px;}}
.cc-btns{display:flex;flex-wrap:wrap;gap:8px;}
.cc-btns .btn{min-height:44px;}
.cc-err{color:var(--red-700);font-weight:600;min-height:1.2em;margin-top:8px;}
.cc-ok{font-weight:600;}
.cc-lead{margin:0 0 12px;}
.cc-help{display:block;color:var(--text-2);font-size:.9rem;margin:4px 0 0;}
.cc-h3{font-size:1rem;margin:16px 0 8px;}
/* V7: the owner's changes to the built-in roles, one block per farm */
.cc-defaults{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:12px;margin-top:10px;}
.cc-defarm{border:1px solid var(--border);border-radius:var(--r-md);padding:10px 12px;}
.cc-defarm ul{list-style:none;margin:6px 0 0;padding:0;}
.cc-defarm li{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;padding:8px 0;border-top:1px solid var(--border);}
.cc-defarm li > span:first-child{font-weight:600;min-width:9em;}
.cc-defarm li .cc-meta{display:inline;flex:1 1 auto;}
.cc-access{display:grid;gap:10px;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));}
.cc-farm{border:1px solid var(--border);border-radius:var(--r-md);padding:10px 12px;margin:0;}
.cc-farm legend{font-weight:650;padding:0 4px;}
.cc-farm select{width:100%;min-height:44px;margin:4px 0 8px;}
.cc-qr{max-width:320px;margin:8px auto;} .cc-qr svg{width:100%;height:auto;display:block;} .cc-qr-small{max-width:200px;} .cc-conf{width:100%;font-family:var(--font-mono);font-size:.8rem;}
.cc-link{display:flex;gap:8px;} .cc-link input{flex:1;min-width:0;min-height:44px;font-family:var(--font-mono);font-size:.85rem;}
.cc-matrix-wrap{max-width:100%;}
.cc-matrix{border-collapse:collapse;font-size:.9rem;min-width:720px;}
.cc-matrix th,.cc-matrix td{border:1px solid var(--border);padding:6px 8px;text-align:left;vertical-align:top;}
.cc-matrix thead th{background:var(--surface-2);position:sticky;top:0;}
.cc-matrix tbody th{font-weight:600;max-width:260px;background:var(--surface);}
.cc-matrix.cc-edit{min-width:600px;} .cc-matrix.cc-edit td{text-align:center;} .cc-matrix.cc-edit input{width:22px;height:22px;}
.cc-no{color:var(--border-strong);}
.cc-filters label{display:flex;gap:6px;align-items:center;} .cc-filters select{min-height:44px;}
.cc-audit{list-style:none;margin:0;padding:0;}
.cc-audit li{display:grid;grid-template-columns:minmax(150px,auto) 1fr;gap:4px 14px;padding:10px 0;border-top:1px solid var(--border);}
.cc-when{color:var(--text-2);font-size:.9rem;white-space:nowrap;}
@media (max-width:480px){.cc-audit li{grid-template-columns:1fr;}}
.link{background:none;border:0;padding:0;color:var(--blue-700);text-decoration:underline;font:inherit;cursor:pointer;min-height:24px;}
/* V5 backups tab */
.cc-scroll{overflow-x:auto;max-width:100%;}
.cc-steps{padding-left:1.3em;line-height:1.6;}
.cc-steps li{margin:6px 0;}
#ccRestoreCmd{width:100%;font-family:ui-monospace,Consolas,monospace;font-size:.9rem;min-height:44px;margin-top:4px;}
.cc-card code{overflow-wrap:anywhere;}
.btn.small{min-height:44px;padding:6px 12px;font-size:.92rem;}
.cc-kv th[scope=row]{width:11rem;color:var(--text);font-weight:600;}
@media (max-width:600px){.cc-kv tr{grid-template-columns:1fr auto;}.cc-kv th[scope=row]{width:auto;}.cc-kv td:nth-child(3){grid-column:1/-1;}}

/* ===== V5 readability and touch layer (R4-8-10, R4-8-11, R4-8-12, R4-8-14, R4-1-9) =====
   On phones no working text is smaller than 14 px (status words on the withholding board 16 px), every control is at
   least 44 × 44 px, dark mode keeps 4.5:1 contrast on the small coloured chips, and long diary entries wrap. Sizes are in
   rem so the phone's own text-size setting is honoured as well as the app's Larger text. */
.cal-dots i{width:10px;height:10px;font:700 8px/10px var(--font-ui);color:#fff;text-align:center;}
.cal-dots i.is-late{outline:2px solid var(--red-700);outline-offset:1px;}
.cal-item{min-width:0;max-width:100%;} .cal-item .cal-t, .cal-item .cal-t strong, .cal-item .cal-t span{overflow-wrap:anywhere;word-break:break-word;}
.dy-tools{display:flex;flex-wrap:wrap;gap:8px;} .dy-search{min-width:0;flex:1 1 200px;} .dy-search input{min-width:0;width:100%;}
html[data-theme="dark"] .bell-count{color:#000;}
/* V10 #163: "Clear" / warning labels on rows readable in dark mode (the light theme's dark green was 2.9:1 on the dark rows) */
html[data-theme="dark"] .ai-row.good .ai-ico{color:var(--pasture-700);} html[data-theme="dark"] .ai-row.warn .ai-ico{color:var(--amber-700);}
html[data-theme="dark"] .t-rest summary, html[data-theme="dark"] details > summary{color:var(--pasture-700, #9BE3B2);}
html[data-theme="dark"] .sub-btn .cnt, html[data-theme="dark"] .cnt{color:#000;}
/* V5: the phone readability and touch layer also applies to touch tablets (coarse pointer), whatever their width */
@media (max-width: 760px), (pointer: coarse){
  .field .help, .acct .help, .help, .pill, .badge, .hint, .rc-date, .rp-tag, .k, .iss-hist .k, .dh-more, .wx-cell span, .wx-table th, th, td, .cal-dots b, #footNote, .farm-id .farm-role, .field .hint, small,
  .t-stat .l, .t-area, .t-count, .btn.sm, .wx-src, .section-rule, .metric-label, .metric-sub, .empty-note, .rowcount, .lbl-short, .saved-flash, .dy-time, .cc-pill,
  .ai-body, .ai-ico, .sheet, .sheet *, .tab, .legend, .legend *, .whp-board *, .t-row *, .cal-wd span, .t-tile .l, .t-tile .s, .brief-txt, .brief-txt *, .t-row span, .cal-item .cal-t span, .t-tlist-item span{font-size:max(0.875rem, 14px) !important;}
  .cal-filter summary{min-height:46px;}
  .status-legend span, kbd, .task-card .tt, .task-card .tm, .task-card .when, .task-col h4, .task-col h4 span, .alert-tag, .alert-what, .alert-when, .chart-actions button, #activityList li span, .cal-peek span, .cal-peek .more{font-size:max(0.875rem, 14px) !important;}
  .view-switch .opt, .photo-btn, .del-btn, .chart-actions button{min-height:44px;min-width:44px;}
  .sync-pill{height:44px;font-size:max(0.875rem, 14px);}
  .chips .sub-btn{min-height:44px;}
  #view-dairy .pill, #dashWhp .pill, #view-dairy .whp-state, #dashWhp .whp-state{font-size:max(1rem, 16px) !important;}
  .bell-count, .icon-btn .count, .nav-item .count, .tab .count{font-size:max(0.875rem, 14px) !important;min-width:22px;height:22px;line-height:22px;}
  .icon-btn, .x-btn, .sub-btn, .seg, .cal-chip, .linkish, button.link, summary, .chip, .opt{min-height:44px;min-width:44px;}
  summary{display:list-item;padding:10px 4px;min-height:46px;}
  .appbar-actions .icon-btn{min-width:44px;}
  input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea{min-height:44px;font-size:max(1rem, 16px);}
  input[type=checkbox], input[type=radio]{width:24px;height:24px;flex:none;}   /* (V10 #163: a long label beside it no longer squeezes it narrower) */
  label:has(> input[type=checkbox]), label:has(> input[type=radio]){min-height:44px;display:inline-flex;align-items:center;gap:8px;}
}
@media (prefers-reduced-motion: reduce){ *, *::before, *::after{animation-duration:.001ms !important;animation-iteration-count:1 !important;transition-duration:.001ms !important;scroll-behavior:auto !important;} }
html[data-theme="dark"] .sub-btn .cnt, html[data-theme="dark"] .chips .cnt{background:#9BE3B2;color:#000;}
/* V5: a message never covers a dialog's buttons — with a dialog open it is shown at the top of the screen */
body.modal-open #toastBar{top:max(12px, env(safe-area-inset-top));bottom:auto !important;}
#toastBar{pointer-events:none;} #toastBar button{pointer-events:auto;min-height:44px;}

/* V5 (§10): on a phone the withholding board is a stack of cards — milk and meat dates one under the other, nothing to
   scroll sideways to (before, "Meat clear from" was off the right edge at 390 px). Desktop and tablets keep the table. */
@media (max-width: 760px){
  .whp-board{min-width:0 !important;border:0;}
  .whp-board thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;}
  .whp-board, .whp-board tbody, .whp-board tr, .whp-board td{display:block;width:100%;box-sizing:border-box;}
  .whp-board tr{border:1px solid var(--border);border-left:4px solid var(--orange-700, #B4530A);border-radius:var(--r-md);background:var(--surface);margin:0 0 10px;padding:4px 0;}
  .whp-board td{border:0 !important;padding:6px 12px !important;white-space:normal !important;}
  .whp-board td[data-label]::before{content:attr(data-label);display:block;font-size:14px;font-weight:600;color:var(--text-2);margin-bottom:2px;}
  .whp-board td:first-child b{font-size:18px !important;}
  .sheet-wrap:has(> .whp-board){overflow:visible;border:0;}
}

.foot-more summary{cursor:pointer;color:var(--text-2);font-size:14px;padding:10px 0;}
.foot-more[open] summary{color:var(--text);}
.foot-more p{margin:4px 0 0;}

/* V5 round 5 (reviewer 9). V5R-9-3: the role editor — a tick box fills its cell; on a phone each area is a card. */
.cr-cell{display:flex;align-items:center;justify-content:center;gap:8px;min-height:44px;min-width:44px;cursor:pointer;margin:-6px -8px;padding:0 8px;}
.cr-act{display:none;}
@media (max-width: 760px){
  .cc-matrix.cc-edit{min-width:0 !important;width:100%;border:0;}
  .cc-matrix.cc-edit thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;}
  .cc-matrix.cc-edit, .cc-matrix.cc-edit tbody, .cc-matrix.cc-edit tr{display:block;width:100%;box-sizing:border-box;}
  .cc-matrix.cc-edit tr{border:1px solid var(--border);border-radius:var(--r-md);margin:0 0 8px;padding:6px 10px;display:flex;flex-wrap:wrap;gap:0 14px;}
  .cc-matrix.cc-edit th{display:block;width:100%;border:0;padding:4px 0;background:none;max-width:none;}
  .cc-matrix.cc-edit td{display:block;border:0;padding:0;text-align:left;}
  .cc-matrix.cc-edit td:empty{display:none;}
  .cc-matrix.cc-edit .cr-cell{justify-content:flex-start;margin:0;padding:0 4px 0 0;}
  .cc-matrix.cc-edit .cr-act{display:inline;font-size:16px;}
  .cc-matrix.cc-edit input{width:24px;height:24px;}
  .sheet-wrap:has(> .cc-matrix.cc-edit){overflow:visible;border:0;}
}
/* V5R-9-2: the screens the first touch pass missed — map tools, sign-in and account, Sync & people, contacts */
@media (max-width: 760px), (pointer: coarse){
  .fm-tools button, .fm-tools select, .fm-tools input{font-size:14px !important;min-height:44px !important;}
  .fm-side .btnrow .btn, .fm-side .btn, .fm-side select{min-height:44px !important;}
  .fm-side, .fm-side *:not(h3), .fm-status, .fm-offline-note, .fm-layers, .fm-layers *, .fm-basefail{font-size:max(0.875rem, 14px) !important;}
  .acct .opt, span.opt, .wx-loading{font-size:max(0.875rem, 14px);}
  .notice, .sess .s-sub, .sess .this, .evlist, .evlist *, .acct .ferr, .acct .help, .acct .meter-label{font-size:max(1em, 14px) !important;}
  .fm-side input[type=range]{min-height:44px;}
  .activity .a-when, .activity .a-tag, .paddock-meta{font-size:14px !important;}
  .acct .pw-toggle{font-size:15px;top:2px;bottom:2px;min-width:64px;min-height:44px;}
  .acct .linkbtn{min-height:44px;}
  .acct .meter-label, .acct .help, .acct small{font-size:14px;}
  .ppl-card .pc-sub, .ppl-card .pc-farm, .st{font-size:14px !important;}
  .ppl-card .pc-actions .btn, #view-admin .btn, #view-admin .chip, #view-admin button{min-height:44px;}
  .cc-tabs button, .cc-meta, .cc-help, .cc-you{font-size:max(0.875rem, 14px);}
}
/* V5R-9-6: on a phone the Control Centre sections wrap onto more rows — none hidden off the right edge */
@media (max-width: 760px){
  .cc-tabs{flex-wrap:wrap;overflow-x:visible;}
  .cc-tabs button{flex:1 1 auto;}
  a[href^="mailto:"], a[href^="tel:"]{display:inline-flex;align-items:center;min-height:44px;padding:0 2px;}
}

/* V9 fix list #69: costs that don't say whether they include GST */
.gst-note{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:0 0 8px;padding:6px 10px;border-radius:8px;background:var(--orange-100);border:1px solid color-mix(in srgb, var(--orange-700) 35%, transparent);font-size:14px;}
.gst-note span{flex:1 1 240px;}
.gst-list{margin:4px 0 0;padding-left:18px;font-size:13px;color:var(--text-2);}
/* V9 staff app: pairing a phone (Control Centre) */
.cc-qr{display:flex;justify-content:center;margin:8px 0;}
.cc-qr svg{width:220px;height:220px;max-width:70vw;max-height:70vw;border:8px solid #fff;border-radius:8px;box-shadow:0 0 0 1px var(--border);}
.cc-warn{background:var(--orange-100);border:1px solid color-mix(in srgb, var(--orange-700) 35%, transparent);border-radius:8px;padding:8px 10px;}
.cc-steps{padding-left:20px;display:grid;gap:6px;}
/* V9 fuel tanks */
.ft-tanks{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:12px;}
.ft-tank{border:1px solid var(--border);border-radius:var(--r-md);padding:12px;background:var(--surface-2);}
.ft-tank h2{font-size:1.05rem;margin:0 0 4px;} .ft-tank h2 small{font-weight:500;color:var(--text-2);}
.ft-bal{margin:0;font-size:1.6rem;font-variant-numeric:tabular-nums;} .ft-known{font-size:13px;font-weight:600;color:var(--text-2);margin-left:6px;}
.ft-known.k-estimated{color:var(--orange-700);}
.ft-gauge{height:10px;border-radius:5px;background:var(--grey-100);overflow:hidden;margin:6px 0;} .ft-gauge span{display:block;height:100%;background:var(--blue-700);}
.ft-warn{color:var(--red-700);font-weight:600;} .ft-rec{margin-top:16px;} .ft-recbar{display:flex;gap:10px;flex-wrap:wrap;margin:6px 0;}
.ft-diff th,.ft-diff td{font-weight:700;} .ft-flags{color:var(--orange-700);}
.inv-actions{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 8px;} .inv9-take input{width:7em;min-height:40px;}

/* V9: the Spanish / English switch in the top bar */
.lang-btn{font:700 14px var(--font-ui,system-ui);letter-spacing:.4px;color:inherit;min-width:44px !important}
/* the language menu under the top-bar button, and the choice in Settings and Account (7 languages, each in its own words) */
.lang-menu{position:fixed;z-index:120;min-width:190px;padding:6px;border-radius:12px;background:var(--surface);border:1px solid var(--border);box-shadow:var(--shadow-pop);display:flex;flex-direction:column;gap:2px}
.lang-menu button{min-height:44px;padding:0 14px;border:0;border-radius:8px;background:none;color:var(--text);font:600 16px var(--font-ui,system-ui);text-align:left;cursor:pointer}
.lang-menu button:hover,.lang-menu button:focus-visible{background:var(--grey-100)}
.lang-menu button[aria-checked="true"]{background:var(--primary);color:#fff}
.lang-pick{display:flex;flex-wrap:wrap;gap:8px}
.lang-pick .opt{min-height:44px;font-size:16px}
/* Chinese and Japanese: the phone's own fonts for those scripts (nothing downloaded), a little more line height */
html[data-lang="zh"] body{font-family:"PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans CJK SC","Noto Sans SC","Source Han Sans SC",var(--font-ui,system-ui),sans-serif;line-height:1.55}
html[data-lang="ja"] body{font-family:"Hiragino Sans","Hiragino Kaku Gothic ProN","Yu Gothic UI","Yu Gothic","Meiryo","Noto Sans CJK JP","Noto Sans JP",var(--font-ui,system-ui),sans-serif;line-height:1.6}
[lang="zh-CN"]{font-family:"PingFang SC","Microsoft YaHei","Noto Sans CJK SC","Noto Sans SC",sans-serif}
[lang="ja-JP"]{font-family:"Hiragino Sans","Yu Gothic UI","Meiryo","Noto Sans CJK JP","Noto Sans JP",sans-serif}
/* V10 (Improvements #61, #94): "My day" on Today — one big button to start or finish the day */
.md-card .md-big{width:100%;min-height:56px;font-size:1.1rem;margin:8px 0;}
.md-card .md-now{margin:4px 0;}
.md-card .md-shifts{margin:6px 0;}
.md-card .md-btns .secondary{width:100%;min-height:44px;margin:0 0 8px;}
.md-card .md-break{margin:6px 0;padding:8px 10px;border-radius:8px;background:var(--amber-100);color:var(--amber-700);border-left:4px solid var(--amber-700);}
/* V10 (#64): Since you were last here, on Today */
.t-since{margin:0 0 10px;padding:8px 10px;border-radius:var(--r-md);background:var(--surface-2);}

/* V10 (#92, #93): emergency plan, hazards, SOS drill */
.ct-plan p{margin:.3em 0;} .ct-planedit summary{cursor:pointer;font-weight:600;margin-top:6px;} .ct-hz ul,.ct-drills{margin:.3em 0;padding-left:18px;} .ct-drills li{margin:.2em 0;}
/* V10 (#175): server logs in the Owner Control Centre */
.cc-logbar{display:flex;flex-wrap:wrap;gap:8px 14px;align-items:center;margin:12px 0 6px;} .cc-log{max-height:60vh;overflow:auto;background:var(--surface-2);border:1px solid var(--border);border-radius:var(--r-md);padding:8px 10px;font-size:12px;line-height:1.45;white-space:pre-wrap;word-break:break-word;}

/* V10 (Improvements #164): one-hand mode on phones (Settings › Appearance › Phone layout). The top bar sits just above the
   bottom tabs, its search list opens upwards, and the page's main button (+ Add entry, Report a problem, Add a contact)
   floats above them on the right. --tabbar-h grows by the bar's height, so everything that keeps clear of the tabs keeps
   clear of the bar too; nothing is pinned to the top any more (--appbar-h 0). Larger screens are not changed. */
@media (max-width:640px){
  html[data-hand="one"]{--appbar-h:0px;--tabbar-h:120px;}
  html[data-hand="one"] .tabbar{height:calc(64px + env(safe-area-inset-bottom));}
  html[data-hand="one"] .appbar{position:fixed;top:auto;left:0;right:0;bottom:calc(64px + env(safe-area-inset-bottom));height:56px;z-index:56;border-top:1px solid var(--border);border-bottom:0;}
  html[data-hand="one"] .appbar .search-drop{top:auto;bottom:100%;max-height:min(60vh,420px);}
  html[data-hand="one"] .toolbar > .btn[data-add], html[data-hand="one"] .page-head > .btn:not(.ghost){
    position:fixed;right:12px;bottom:calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom));z-index:54;border-radius:999px;min-height:52px;padding:0 20px;box-shadow:var(--shadow-pop);}
  html[data-hand="one"] body.ff-sharing .toolbar > .btn[data-add], html[data-hand="one"] body.ff-sharing .page-head > .btn:not(.ghost){bottom:calc(var(--tabbar-h) + 84px + env(safe-area-inset-bottom));}
  html[data-hand="one"] body.modal-open .appbar{display:none;}
  html[data-hand="one"] section.view.active{animation:none;}   /* (its moving-in effect would carry the floating button with it for a moment) */
}
/* V10 (#147): Settings in groups */
.set-jump{position:sticky;top:calc(var(--appbar-h) + 4px);z-index:5;background:var(--bg);padding:6px 0;margin-bottom:4px;}
.set-group{margin-top:22px;scroll-margin-top:calc(var(--appbar-h) + 56px);} .set-group:first-of-type{margin-top:6px;}
.set-h{font-size:20px;font-weight:750;margin:0 0 2px;color:var(--text);}
/* V10 (#181): moving a job to another day on the calendar */
.cal-li-move{display:flex;gap:6px;align-items:stretch;} .cal-li-move > .cal-item{flex:1;min-width:0;} .cal-movebtn{flex:none;align-self:center;}
.cal-moving{position:sticky;top:calc(var(--appbar-h) + 4px);z-index:4;background:var(--amber-100);color:var(--amber-700);font-weight:600;border-radius:var(--r-sm);padding:8px 12px;display:flex;gap:10px;align-items:center;flex-wrap:wrap;}
.cal-drop{outline:3px dashed var(--forest-700);outline-offset:-3px;}
.ct-drill-due{color:var(--red-700);font-weight:600;margin:6px 0;}   /* (V10: 14 px or more on phones — UX9-2) */
.acct-sheets{border:0;padding:0;margin:8px 0;}
.inv9-cam{width:100%;max-height:50vh;background:#000;border-radius:8px;}
.t-onlist .t-on{display:flex;flex-wrap:wrap;gap:4px 10px;align-items:baseline;padding:6px 0;}
/* V10 Improvements #10: on touch screens every button, choice and box is at least 48 px high (Android's and Apple's guidance for
   fingers; 44 px elsewhere stays). The Android app also follows the phone's own text size (MainActivity setTextZoom). */
@media (pointer:coarse){
  .btn, .opt, .nav-item, .sub-btn, .icon-btn, .quick-pick, .check-row, .t-row, .t-job-main,
  input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]), select, textarea, .field select, .field textarea, .toolbar .filter, .tl-f select, .tl-f input{min-height:48px;}
  .ow-table .btn.sm{min-height:44px;}   /* (buttons inside table rows: 44 px, so a row stays one line) */
}

/* V10 #151: no connection, said plainly at the top */
.offline-banner{margin:0 0 10px;padding:8px 12px;border-radius:var(--r-md);background:var(--amber-100,#fff3cd);color:var(--text);border:1px solid var(--amber-700,#b7791f);font-size:14px;}
/* V10 #70: today's briefing */
.br-card .br-text{white-space:pre-wrap;margin:6px 0;line-height:1.45;}
/* V10 #132: compliance calendar */
.cc10{margin-top:14px;} .cc10-list{list-style:none;padding:0;margin:0 0 8px;} .cc10-list li{padding:6px 0;border-bottom:1px solid var(--line);display:flex;flex-wrap:wrap;gap:6px;align-items:center;}
.cc10-d{min-width:7.5em;font-variant-numeric:tabular-nums;} .cc10-late .cc10-d{color:var(--red-700);font-weight:600;}
/* V10 #191: crop timeline */
.crt{margin-top:14px;} .crt-col{min-width:180px;width:40%;} .crt-track{position:relative;height:14px;background:var(--surface-2);border:1px solid var(--border);border-radius:7px;}
.crt-bar{position:absolute;top:3px;height:8px;border-radius:4px;background:var(--amber-700);opacity:.55;} .crt-bar.done{background:var(--pasture-700);opacity:.8;}
.crt-h{position:absolute;top:0;width:3px;height:14px;margin-left:-1px;background:var(--pasture-700);}
/* V10 #116: the feed wedge on a phone — one paddock a line */
.wedge-m-key{display:flex;flex-wrap:wrap;gap:10px;font-size:.85rem;margin:4px 0 8px;} .wedge-m-key i{display:inline-block;width:3px;height:12px;margin-right:4px;vertical-align:middle;}
.wedge-m-list{list-style:none;margin:0;padding:0;} .wedge-m-list li{display:grid;grid-template-columns:minmax(64px,30%) 1fr 3.2em;gap:6px;align-items:center;padding:3px 0;}
.wm-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;} .wm-val{text-align:right;font-variant-numeric:tabular-nums;font-weight:600;}
.wm-track{position:relative;height:16px;background:var(--surface-2);border:1px solid var(--border);border-radius:3px;}
.wm-bar{position:absolute;left:0;top:0;bottom:0;background:#3B6480;} .wm-bar.old{background:#9DB3A3;} .wm-bar.est{background:transparent;border:1px dashed #3B6480;}
.wm-track .wm-pre,.wm-track .wm-res,.wm-track .wm-dem{position:absolute;top:-2px;bottom:-2px;width:2px;margin-left:-1px;}
.wm-pre,.wedge-m-key .wm-pre{background:#2F4A3C;} .wm-res,.wedge-m-key .wm-res{background:#A8461F;} .wm-dem,.wedge-m-key .wm-dem{background:#C0392B;}
.wm-track .wm-dem{width:4px;margin-left:-2px;height:6px;top:5px;bottom:auto;border-radius:2px;}
/* V10 #292: a card whose heading opens it */
.cc-sumh{cursor:pointer;min-height:44px;display:flex;align-items:center;}
.cc-sumh h2{display:inline;margin:0;}
.cc-steps li{margin:6px 0;}
.cc-fp{word-break:break-all;font-size:.85em;}
