/* Crop finder page. No inline styles anywhere, so a strict CSP (style-src 'self') works. */
  :root {
  --bg:#f6f7f4; --panel:#ffffff; --ink:#1d2a1f; --muted:#5d6b5f; --line:#dfe4db;
  --accent:#2f6f3e; --accent-ink:#ffffff; --warn:#8a5a00; --warn-bg:#fff4d6; --err:#9b1c1c; --err-bg:#fde8e8;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#141a15; --panel:#1c241d; --ink:#e8efe8; --muted:#9fb0a1; --line:#2c372d;
    --accent:#5fb673; --accent-ink:#0e1a11; --warn:#f0c46a; --warn-bg:#3a2f12; --err:#ff9d9d; --err-bg:#3d1c1c;
  }
}
* { box-sizing:border-box; }
html,body { height:100%; margin:0; }
.mt6{margin-top:6px}.mt8{margin-top:8px}.mt10{margin-top:10px}.mt12{margin-top:12px}
[hidden]{display:none!important}
body { font:15px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; background:var(--bg); color:var(--ink); }
.app { display:grid; grid-template-columns:minmax(300px,420px) 1fr; height:100%; }
aside { background:var(--panel); border-right:1px solid var(--line); overflow:auto; padding:16px; display:flex; flex-direction:column; gap:14px; }
#map { height:100%; min-height:320px; }
h1 { font-size:19px; margin:0; }
h2 { font-size:15px; margin:0 0 6px; }
p { margin:0; }
.muted { color:var(--muted); font-size:13px; }
.row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
label { font-size:13px; color:var(--muted); }
input[type=date], input[type=password] { font:inherit; padding:6px 8px; border:1px solid var(--line); border-radius:6px; background:var(--bg); color:var(--ink); }
button { font:inherit; padding:9px 14px; border-radius:8px; border:1px solid var(--line); background:var(--bg); color:var(--ink); cursor:pointer; }
button.primary { background:var(--accent); color:var(--accent-ink); border-color:var(--accent); font-weight:600; }
button:disabled { opacity:.55; cursor:not-allowed; }
.box { border:1px solid var(--line); border-radius:10px; padding:12px; background:var(--bg); }
.notice { border-radius:8px; padding:8px 10px; font-size:13px; }
.notice.warn { background:var(--warn-bg); color:var(--warn); }
.notice.err { background:var(--err-bg); color:var(--err); }
.headline { display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; }
.crop { font-size:22px; font-weight:700; }
.pill { display:inline-block; font-size:12px; padding:2px 8px; border-radius:99px; border:1px solid var(--line); color:var(--muted); }
.sw { width:12px; height:12px; border-radius:3px; display:inline-block; margin-right:6px; vertical-align:-1px; }
table { border-collapse:collapse; width:100%; font-size:13px; }
td,th { text-align:left; padding:4px 6px; border-bottom:1px solid var(--line); vertical-align:top; }
th { color:var(--muted); font-weight:500; }
.bar { height:8px; background:var(--line); border-radius:4px; overflow:hidden; }
.bar > i { display:block; height:100%; background:var(--accent); }
.prob { display:grid; grid-template-columns:70px 1fr 40px; gap:8px; align-items:center; font-size:13px; margin:3px 0; }
.chart { display:flex; align-items:flex-end; gap:6px; height:70px; margin-top:6px; }
.chart div { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; height:100%; }
.chart i { width:100%; background:var(--accent); border-radius:3px 3px 0 0; min-height:2px; }
.chart span { font-size:10px; color:var(--muted); margin-top:2px; }
.spin { width:14px; height:14px; border:2px solid var(--line); border-top-color:var(--accent); border-radius:50%; animation:sp 0.8s linear infinite; display:inline-block; }
@keyframes sp { to { transform:rotate(360deg); } }
.leaflet-container { font:inherit; }
@media (max-width: 800px) {
  .app { grid-template-columns:1fr; grid-template-rows:55vh auto; height:auto; }
  #map { height:55vh; order:-1; }
  aside { border-right:0; border-top:1px solid var(--line); }
}

/* Google Maps drawing toolbar (map-google.js) */
.gm-bar { margin:10px; display:flex; flex-direction:column; align-items:stretch; gap:0; width:max-content; max-width:70vw;
  background:#fff; border-radius:2px; box-shadow:0 1px 4px rgba(0,0,0,.3); }
.gm-tool { background:#fff; border:0; border-bottom:1px solid #e3e6e9; padding:8px 14px 8px 10px; font:500 14px Roboto, Arial, sans-serif;
  cursor:pointer; color:#333; text-align:left; }
.gm-tool:last-of-type { border-bottom:0; }
.gm-tool:hover:not(:disabled) { background:#f1f3f5; }
.gm-tool.on { background:#e7f1ff; color:#0b5cad; }
.gm-tool:disabled { opacity:.45; cursor:default; }
.gm-hint { border-top:1px solid #e3e6e9; max-width:230px; padding: 6px 10px; font: 13px Roboto, Arial, sans-serif; color: #333; }
.gm-hint:empty { display: none; }
.map-error { display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; background: #f1f3f5; color: #c92a2a; }

.level { border-top:1px solid var(--line); margin-top:12px; padding-top:10px; }
.lvhead { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.lvhead h2 { margin:0; font-size:14px; }
.lvno { font-size:11px; font-weight:700; color:var(--accent-ink); background:var(--accent); border-radius:4px; padding:2px 6px; }
.lvcrop { display:flex; align-items:center; gap:8px; margin:8px 0 4px; font-weight:600; }
table.seasons th { width:64px; text-align:left; vertical-align:top; }

/* hover box over an analysed field (Leaflet tooltip and Google tip share it) */
.map-tip { background:#fff; color:#222; border:1px solid #cfd4da; border-radius:8px; padding:8px 10px; font:13px/1.4 system-ui,sans-serif;
  box-shadow:0 2px 8px rgba(0,0,0,.25); min-width:210px; white-space:normal; }
.map-tip .tip-title { font-weight:700; margin-bottom:4px; }
.map-tip .tip-row { display:flex; justify-content:space-between; gap:12px; padding:1px 0; }
.map-tip .tip-row span { color:#5c6670; }
.map-tip .tip-row b { text-align:right; font-weight:600; }
.gm-tip { position:absolute; z-index:5; pointer-events:none; }
.gm-tip[hidden] { display:none; }

/* Google: search box and buttons with icons */
.gm-tool { display:inline-flex; align-items:center; gap:6px; }
.gm-search { margin:10px; width:min(340px, 60vw); }
.gm-search-input { display:block; width:100%; }

/* Leaflet: icon + text on the draw toolbar (the sprite image cannot be widened, so plain glyphs are used) */
.leaflet-draw-toolbar a.leaflet-draw-draw-polygon, .leaflet-draw-toolbar a.leaflet-draw-draw-rectangle,
.leaflet-draw-toolbar a.leaflet-draw-edit-edit, .leaflet-draw-toolbar a.leaflet-draw-edit-remove {
  background-image:none !important; width:auto !important; min-width:30px; padding:0 12px; text-indent:0 !important;
  display:flex; align-items:center; gap:8px; height:30px; line-height:30px; white-space:nowrap; font:600 13px system-ui,sans-serif; color:#222; }
.leaflet-draw-toolbar a::after { content:attr(title); }
.leaflet-draw-toolbar a::before { font-size:16px; width:18px; text-align:center; }
.leaflet-draw-draw-polygon::before { content:"\2B20"; }
.leaflet-draw-draw-rectangle::before { content:"\25AD"; }
.leaflet-draw-edit-edit::before { content:"\270E"; }
.leaflet-draw-edit-remove::before { content:"\2715"; }
.leaflet-draw-toolbar a.leaflet-disabled { color:#999; }
.leaflet-draw-actions a::after, .leaflet-draw-actions a::before { content:none !important; }
