/* Farm platform web app. Colours and type match the RCL map portal. */
:root {
  --panel: #fbfcfb; --ink: #1b2a24; --ink-2: #4f5e57; --ink-3: #7a8780; --rule: #dde4df; --wash: #eef2ef;
  --accent: #231f20; --accent-ink: #ffffff; --brand: #fec956; --brand-ink: #231f20; --bad: #b3261e; --good: #1e7a3c;
  --shadow: 0 6px 24px rgba(18, 32, 26, 0.18);
  --f-ui: "Barlow", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-head: "Barlow Semi Condensed", "Barlow", "Segoe UI", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --panel: #18211d; --ink: #e7eeea; --ink-2: #b3c0b9; --ink-3: #85938c; --rule: #2c3833; --wash: #212d28;
    --accent: #fec956; --accent-ink: #231f20; --bad: #ff8f85; --good: #7fd69a; --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}
:root[data-theme="dark"] {
  --panel: #18211d; --ink: #e7eeea; --ink-2: #b3c0b9; --ink-3: #85938c; --rule: #2c3833; --wash: #212d28;
  --accent: #fec956; --accent-ink: #231f20; --bad: #ff8f85; --good: #7fd69a; --shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }

[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--wash); color: var(--ink); font: 15.5px/1.45 var(--f-ui); -webkit-text-size-adjust: 100%; }
button, input { font: inherit; color: inherit; }
.loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--ink-2); margin: 0; }

/* sign-in, password and farm list */
.screen { min-height: 100%; display: flex; align-items: center; justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }
.card { width: 100%; max-width: 400px; background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); padding: 28px 24px 22px; }
.card.wide { max-width: 560px; }
.org { display: flex; justify-content: space-between; align-items: center; }
.logo { height: 30px; display: block; }
.logo-dark { display: none; }
.card h1 { font-family: var(--f-head); font-weight: 650; font-size: 30px; line-height: 1.1; margin: 18px 0 20px; }
.card form { display: grid; gap: 8px; }
.card label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.card input { width: 100%; padding: 11px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); font-size: 16px; }
.card button[type="submit"] { margin-top: 6px; padding: 11px 14px; border: 0; border-radius: 8px; background: var(--accent);
  color: var(--accent-ink); font-weight: 600; cursor: pointer; font-size: 15.5px; }
.card button[disabled] { opacity: 0.6; cursor: default; }
.link { background: none; border: 0; color: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; padding: 2px 0; font-size: 13.5px; }
.card .link { justify-self: start; }
.help { margin: 2px 0 4px; color: var(--ink-2); font-size: 14px; }
.msg { min-height: 1.4em; margin: 12px 0 0; color: var(--bad); font-size: 14px; }
.msg.ok { color: var(--good); }
.fine { margin: 14px 0 0; font-size: 12.5px; color: var(--ink-3); }
.farm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.farm-list button { width: 100%; text-align: left; border: 1px solid var(--rule); background: var(--panel); border-radius: 10px;
  padding: 14px 16px; cursor: pointer; display: grid; gap: 2px; }
.farm-list button:hover { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.farm-list b { font-family: var(--f-head); font-size: 19px; font-weight: 650; }
.farm-list span { font-size: 13.5px; color: var(--ink-2); }

/* the map */
.map-screen { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; }
.panel { position: absolute; z-index: 2; top: max(12px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left));
  width: 300px; max-width: calc(100vw - 80px); max-height: calc(100% - 60px); display: flex; flex-direction: column;
  background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.panel-toggle { display: flex; justify-content: space-between; align-items: center; gap: 8px; width: 100%; padding: 12px 14px 8px;
  background: none; border: 0; cursor: pointer; text-align: left; font-family: var(--f-head); font-weight: 650; font-size: 21px; line-height: 1.15; }
.chev { font-size: 14px; transition: transform .15s; }
.panel.closed .chev { transform: rotate(-90deg); }
.panel.closed .panel-body { display: none; }
.panel-body { overflow-y: auto; padding: 0 14px 12px; }
.sub { margin: -4px 0 10px; color: var(--ink-2); font-size: 13.5px; }
.basemaps { display: inline-flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; margin-bottom: 10px; }
.basemaps button { border: 0; background: none; padding: 6px 12px; cursor: pointer; font-size: 13.5px; }
.basemaps button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.layer-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.layer-list li { border-bottom: 1px solid var(--rule); }
.layer-list .group { padding: 12px 0 2px; font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--ink-3); text-transform: uppercase; }
.layer-list label { display: grid; grid-template-columns: 22px 1fr; gap: 6px; padding: 8px 0; cursor: pointer; align-items: start; }
.layer-list input { margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--brand); }
.layer-list b { display: block; font-weight: 600; font-size: 14.5px; }
.layer-list small { display: block; color: var(--ink-3); font-size: 12.5px; line-height: 1.3; }
.panel-foot { margin-top: 10px; }
.map-msg { position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0; padding: 12px 16px;
  background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }

/* land unit labels: white text, no box, a soft shadow (RCL map style) */
.lu-label { pointer-events: none; text-align: center; color: #fff; line-height: 1.1;
  text-shadow: 0 0 3px rgba(0,0,0,.85), 0 1px 2px rgba(0,0,0,.7); font-family: var(--f-head); }
.lu-label b { display: block; font-size: 17px; font-weight: 700; }
.lu-label span { display: block; font-size: 12.5px; font-weight: 600; max-width: 140px; }

/* tap details */
.maplibregl-popup-content { background: var(--panel); color: var(--ink); border-radius: 10px; box-shadow: var(--shadow); padding: 12px 14px; }
.maplibregl-popup-tip { border-top-color: var(--panel) !important; border-bottom-color: var(--panel) !important; }
.maplibregl-popup-close-button { font-size: 20px; padding: 0 8px; color: var(--ink-2); }
.pop h3 { margin: 0 18px 2px 0; font-family: var(--f-head); font-size: 18px; font-weight: 650; line-height: 1.2; }
.pop-layer { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.pop-q { margin: 4px 0 0; font-size: 13px; color: var(--ink-2); font-style: italic; }
.pop-photo { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: 6px; margin-top: 8px; background: var(--wash); min-height: 60px; }
.pop dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 8px 0 0; font-size: 13px; max-height: 220px; overflow-y: auto; }
.pop dt { color: var(--ink-3); text-transform: capitalize; }
.pop dd { margin: 0; word-break: break-word; }
.pop-attr { margin: 8px 0 0; font-size: 11.5px; color: var(--ink-3); }
