/* Farm Ledger v3 — farm map */
#view-map{padding:0 !important;}
.fm-wrap{position:relative;isolation:isolate;z-index:0;display:grid;grid-template-columns:1fr 340px;height:calc(100vh - 205px);min-height:480px;border:1px solid var(--line);border-radius:6px;overflow:hidden;background:#dfe5df;}
.fm-map{position:relative;min-height:0;}
.fm-map .leaflet-container{height:100%;width:100%;font:13px var(--font-ui);}
.fm-side{background:var(--paper-raised);border-left:1px solid var(--line);overflow:auto;padding:12px 14px;}
.fm-side h3{font-family:var(--font-display);margin:4px 0 8px;font-size:18px;}
.fm-side .kv{display:grid;grid-template-columns:auto 1fr;gap:4px 10px;font-size:13px;margin:6px 0 10px;}
.fm-side .kv b{font-weight:600;}
.fm-side .btnrow{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0;}
.fm-side .btnrow .btn{min-height:40px;}
.fm-side ul{margin:4px 0 10px 18px;padding:0;font-size:12.5px;}
.fm-tools{position:absolute;z-index:500;top:10px;left:56px;display:flex;flex-wrap:wrap;gap:6px;max-width:calc(100% - 120px);}
.fm-tools button,.fm-tools select{background:#fff;border:1px solid #9aa;border-radius:6px;padding:7px 10px;min-height:40px;font:600 12.5px var(--font-ui);cursor:pointer;box-shadow:0 1px 3px rgba(0,0,0,.2);color:#222;}
.fm-tools button.on{background:#C98A2C;color:#111;border-color:#a06a1c;}
.fm-tools button:disabled{opacity:.45;cursor:default;}
.fm-status{position:absolute;z-index:500;bottom:26px;left:10px;background:rgba(255,255,255,.95);border-radius:6px;padding:6px 10px;font-size:12.5px;box-shadow:0 1px 3px rgba(0,0,0,.25);max-width:70%;color:#222;}
.fm-status:empty{display:none;}
.fm-legend{position:absolute;z-index:500;bottom:26px;right:10px;background:rgba(255,255,255,.95);border-radius:6px;padding:6px 10px;font-size:11.5px;box-shadow:0 1px 3px rgba(0,0,0,.25);color:#222;}
.fm-legend:empty{display:none;}
.fm-label{background:rgba(0,0,0,.5);border:0;border-radius:4px;padding:1px 5px;box-shadow:none;font:700 13px var(--font-ui);color:#fff;text-shadow:0 0 2px #000;white-space:nowrap;}
.fm-label small{display:block;font-weight:500;font-size:11.5px;}
/* V10 #173: overlapping names wait for room (map.js declutter): the bigger paddock's name first; at night (dark theme) the
   map pictures are dimmed so they don't glare, and the names stay bright */
.fm-label.fm-lbl-hid{visibility:hidden;}
html[data-theme="dark"] #fmCanvas .leaflet-tile-pane{filter:brightness(.72) contrast(1.05);}
html[data-theme="dark"] .fm-label{background:rgba(0,0,0,.66);color:#F4F1E8;}
.fm-label::before{display:none;}
.fm-icon{font-size:20px;line-height:22px;text-align:center;filter:drop-shadow(0 0 2px #fff) drop-shadow(0 0 1px #000);}
.fm-icon.proposed{opacity:.75;filter:drop-shadow(0 0 3px #C98A2C);}
.fm-layers{font-size:13px;}
.fm-layers label{display:flex;align-items:center;gap:8px;padding:4px 0;min-height:32px;}
.fm-chip{display:inline-block;width:12px;height:12px;border-radius:2px;vertical-align:middle;margin-right:4px;}
.fm-align-img{max-width:100%;border:1px solid var(--line);cursor:crosshair;display:block;}
.fm-offline-note{background:#FBF3D8;border:1px solid #E4BE72;border-radius:6px;padding:8px 10px;font-size:12.5px;margin:8px 0;color:#222;}
.fm-affine{position:absolute;left:0;top:0;transform-origin:0 0;pointer-events:none;max-width:none !important;}
@media (max-width:900px){
  /* phones: the map gets most of the screen; tools sit in ONE row that scrolls sideways */
  .fm-wrap{grid-template-columns:1fr;grid-template-rows:minmax(62vh,1fr) auto;height:auto;min-height:0;}
  .fm-map{height:62vh;}
  .fm-side{border-left:0;border-top:1px solid var(--line);max-height:none;}
  .fm-tools{left:50px;right:6px;top:8px;max-width:none;flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;padding-bottom:6px;scrollbar-width:thin;
    /* V5R-9-2: the strip scrolls sideways — its right edge fades and a scroll bar shows, so the hidden tools are findable */
    -webkit-mask-image:linear-gradient(to right,#000 82%,rgba(0,0,0,.25));mask-image:linear-gradient(to right,#000 82%,rgba(0,0,0,.25));}
  .fm-tools::-webkit-scrollbar{height:4px;}
  .fm-tools button,.fm-tools select,.fm-tools input{flex:0 0 auto;padding:6px 9px;font-size:12px;min-height:44px;}
  .fm-tools input[type=search]{width:110px !important;}
  .fm-status{max-width:calc(100% - 20px);}
}
@media print{
  header.top,.bottom-nav,.fab,.fm-tools,.fm-side .btnrow,.farm-band .fb-switch{display:none !important;}
  .fm-wrap{grid-template-columns:1fr;height:auto;border:0;}
  .fm-map{height:180mm;}
  .fm-side{border:0;max-height:none;}
}
/* labels, numbered points, print header */
.fm-labwrap{background:none;border:0;}
.fm-labwrap .fm-label{position:absolute;transform:translate(-50%,-50%);text-align:center;line-height:1.15;pointer-events:none;}
.fm-nolabels .fm-label:not(.fm-measure){display:none;}
.fm-label.fm-measure{background:rgba(0,0,0,.72);color:#ffeb3b;border-radius:4px;padding:2px 6px;text-shadow:none;}
.fm-icon.sel{transform:scale(1.35);filter:drop-shadow(0 0 4px #fff) drop-shadow(0 0 2px #C98A2C);}
.fm-pt{position:absolute;transform:translate(-50%,-50%);width:22px;height:22px;border-radius:50%;background:#C98A2C;color:#111;font:700 12px/22px var(--font-ui);text-align:center;border:2px solid #fff;box-shadow:0 0 3px #000;pointer-events:none;}
.fm-pt.pending{background:#fff;color:#C98A2C;border-color:#C98A2C;}
.fm-tools input[type=search]{font:600 12.5px var(--font-ui);box-shadow:0 1px 3px rgba(0,0,0,.2);background:#fff;color:#222;}
.fm-print-head{display:none;}
.fm-side .field{margin:6px 0;}
.fm-side .field label{display:block;font-size:12px;font-weight:600;margin-bottom:2px;}
.fm-side .field input:not([type=color]):not([type=checkbox]):not([type=radio]):not([type=range]),.fm-side .field select{width:100%;min-height:40px;box-sizing:border-box;}
.fm-side hr{border:0;border-top:1px solid var(--line);margin:8px 0;}
.fm-print-only,.fm-label .fm-print-only,.fm-print-table{display:none;}
@media print{ .fm-print-head{display:block;font:13px var(--font-ui);margin:0 0 6px;} .fm-status,.fm-layers{display:none !important;}
  .fm-print-only,.fm-label .fm-print-only{display:block;} .fm-print-table{display:block;break-before:page;font:12px var(--font-ui);color:#16201A;}
  .fm-print-table h2{font-size:15px;margin:0 0 6px;} .fm-print-table table{border-collapse:collapse;width:100%;}
  .fm-print-table th,.fm-print-table td{border:1px solid #D3DAD2;padding:3px 6px;text-align:left;} .fm-print-table .num{text-align:right;}
  .fm-print-table tr{break-inside:avoid;} .fm-print-src{color:#4A564E;font-size:11px;} }

/* V6 measurement gate: the live measurement bar */
.fm-mbar{margin-top:6px;padding:8px 10px;border:2px solid var(--border-strong, #9aa);border-radius:10px;background:var(--surface, #fff);color:var(--text, #111);font-size:13.5px;line-height:1.35;}
.fm-mbar .fm-mb-h{display:flex;flex-wrap:wrap;gap:4px 8px;align-items:center;font-weight:600;}
.fm-mbar .fm-mb-state{margin-left:auto;padding:2px 8px;border-radius:12px;font-size:12.5px;}
.fm-mbar .fm-mb-grid{display:grid;grid-template-columns:auto 1fr;gap:2px 10px;margin-top:4px;}
.fm-mbar .fm-mb-k{color:var(--text-2, #555);}
.fm-mbar .fm-mb-v{font-variant-numeric:tabular-nums;}
.fm-mbar .fm-mb-why{margin:4px 0 0;font-size:13px;}
.fm-mbar.is-draft{border-style:dashed;}
.fm-mbar.is-draft .fm-mb-state{background:var(--surface-2, #eee);}
.fm-mbar.is-valid{border-color:#2e7d32;}
.fm-mbar.is-valid .fm-mb-state{background:#2e7d32;color:#fff;}
.fm-mbar.is-attention{border-color:#b26a00;}
.fm-mbar.is-attention .fm-mb-state{background:#b26a00;color:#fff;}
.fm-mbar.is-refused{border-color:#c62828;}
.fm-mbar.is-refused .fm-mb-state{background:#c62828;color:#fff;}
/* finger-sized corner handles on touch screens (the visible dot stays small; the touch target is 32 px) */
@media (pointer: coarse){
  .marker-icon{width:22px !important;height:22px !important;margin:-11px 0 0 -11px !important;border-width:2px !important;box-shadow:0 0 0 6px rgba(51,136,255,.18);}
  .marker-icon-middle{width:16px !important;height:16px !important;margin:-8px 0 0 -8px !important;}
  /* (farm review F-7) the part a finger can hit is 44 px across (an invisible ring round each handle); the glow alone did not
     enlarge it */
  .marker-icon::after{content:"";position:absolute;left:50%;top:50%;width:44px;height:44px;margin:-22px 0 0 -22px;border-radius:50%;}
  .marker-icon-middle::after{width:36px;height:36px;margin:-18px 0 0 -18px;}
}
.marker-icon.marker-active, .marker-icon:focus{background:#3388ff !important;}
/* (farm review F-1) on a phone the measuring bar sits low on the map: taps on its text go through to the map (a corner can be
   placed or the first corner tapped under it); only its buttons take taps. Compact, and never more than a third of the map. */
@media (max-width:760px){
  .fm-status{pointer-events:none;left:6px;right:6px;bottom:6px;max-width:none;max-height:36%;overflow:hidden;padding:5px 8px;}
  .fm-status button,.fm-status a,.fm-status input,.fm-status select,.fm-status label{pointer-events:auto;}
  .fm-status .btn.sm{min-height:40px;}
  .fm-status .fm-mbar{margin-top:4px;padding:5px 8px;font-size:12.5px;background:rgba(255,255,255,.92);}
  .fm-status .fm-mb-grid{display:flex;flex-wrap:wrap;gap:0 10px;}
  .fm-status .fm-mb-k{font-size:11.5px;}
  .fm-status .fm-mb-why{font-size:12px;}
}
/* on every screen size: a tap or click on the bar's text reaches the map underneath; only its controls take clicks */
.fm-status{pointer-events:none;}
.fm-status button,.fm-status a,.fm-status input,.fm-status select,.fm-status label,.fm-status details,.fm-status summary{pointer-events:auto;}
/* phones: once the figures show, the instruction sentence gives way; buttons keep short labels in one row */
@media (max-width:760px){
  .fm-status .fm-long{display:none;}
  .fm-status .fm-mbar ~ .fm-hint-row .fm-hint-t{display:none;}
  .fm-status .fm-hint-row{margin-top:4px;}
  .fm-status .fm-hint-b{display:inline-flex;flex-wrap:wrap;gap:4px;}
  .fm-status .fm-hint-b .btn.sm{min-height:40px;padding:4px 10px;}
}
/* V10 (#31): "Where am I" on every map — big enough for a finger */
.fl-locate{width:44px;height:44px;font-size:22px;line-height:1;background:#fff;color:#1d2b22;border:2px solid rgba(0,0,0,.2);border-radius:6px;cursor:pointer;}
.fl-locate.busy{opacity:.6;}
/* V10 (#40): the plain background — the farm's own drawings on a soft pasture colour, no pictures from outside */
.fm-plainbase .leaflet-container, .leaflet-container.fl-plainbase, .fm-plainbase.leaflet-container{background:#E9EFE2;background-image:radial-gradient(rgba(47,74,60,.08) 1px, transparent 1px);background-size:16px 16px;}
html[data-theme="dark"] .fm-plainbase .leaflet-container, html[data-theme="dark"] .leaflet-container.fl-plainbase{background-color:#1D2620;background-image:radial-gradient(rgba(255,255,255,.06) 1px, transparent 1px);}
.fm-meetppl{border:0;padding:0;margin:0 0 8px;}

/* V10 #163: the map credit readable and easy to tap on a phone (it was 11 px, 15 px high, 4.2:1) */
.leaflet-container .leaflet-control-attribution{font-size:12px;line-height:24px;background:rgba(255,255,255,.95);color:#2A3A32;} .leaflet-container .leaflet-control-attribution a{color:#0B4F8C;display:inline-block;min-height:24px;line-height:24px;}
html[data-theme="dark"] .leaflet-container .leaflet-control-attribution{background:rgba(18,26,33,.95);color:#C9D6DF;} html[data-theme="dark"] .leaflet-container .leaflet-control-attribution a{color:#CFE3FF;}
