:root {
  --green: #2f5d3a; --green-dark: #23452b; --bg: #f5f4ef; --card: #ffffff; --text: #1f2a22; --muted: #6b7570;
  --border: #dfe3dd; --accent: #d9822b; --danger: #b33a3a;
  --none: #d7d9d3; --weak: #f2d06b; --good: #ef9a3c; --strong: #c8322f;
  --tabs-h: 58px; --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }
body { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
#topbar { background: var(--green); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); flex: 0 0 auto; }
.brand { font-weight: 700; font-size: 17px; display: flex; gap: 8px; align-items: center; }
.topbar-right { display: flex; gap: 10px; align-items: center; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #999; display: inline-block; }
.dot.ok { background: #7dd67d; } .dot.busy { background: #ffd24d; animation: pulse 1s infinite; } .dot.err { background: #ff6b6b; }
@keyframes pulse { 50% { opacity: .4; } }
main { flex: 1 1 auto; position: relative; overflow: hidden; }
.view { display: none; position: absolute; inset: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
.view.active { display: block; }
#view-map { overflow: hidden; }
#map { position: absolute; inset: 0; background: #e8e6df; }
#map-controls { position: absolute; top: 8px; left: 0; right: 0; z-index: 800; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
#map-controls .chips { pointer-events: auto; }
.chips { display: flex; gap: 6px; padding: 0 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; border: 1px solid var(--border); background: #fff; color: var(--text); border-radius: 999px; padding: 6px 12px; font-size: 13px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.1); white-space: nowrap; }
.chip.active { background: var(--green); color: #fff; border-color: var(--green); }
.chip.small { padding: 3px 9px; font-size: 12px; }
.chip.forecast { border-style: dashed; }
#map-buttons { position: absolute; right: 10px; bottom: 60px; z-index: 800; display: flex; flex-direction: column; gap: 10px; }
.fab { width: 46px; height: 46px; border-radius: 50%; border: none; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); font-size: 20px; cursor: pointer; }
.fab.primary { background: var(--green); color: #fff; font-size: 26px; }
.legend { position: absolute; left: 10px; bottom: 36px; z-index: 800; background: rgba(255,255,255,.92); border-radius: 8px; padding: 6px 8px; font-size: 12px; display: flex; gap: 6px; align-items: center; }
.legend-scale { display: flex; flex-direction: column; width: 150px; }
.legend-bar { height: 10px; border-radius: 5px; border: 1px solid rgba(0,0,0,.15); }
.legend-ticks { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-top: 1px; }
.banner { position: absolute; left: 10px; right: 10px; top: 90px; z-index: 800; background: #fff8e1; border: 1px solid #f0d58c; border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.hidden { display: none !important; }
.page { padding: 12px 12px calc(12px + var(--safe-b)); max-width: 760px; margin: 0 auto; }
h2 { margin: 6px 0 8px; font-size: 20px; } h3 { margin: 16px 0 8px; font-size: 16px; }
.hint { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.btn { border: none; background: var(--green); color: #fff; border-radius: 8px; padding: 10px 14px; font-size: 14px; cursor: pointer; display: inline-block; text-align: center; }
.btn.secondary { background: #e9ede8; color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; }
.icon-btn { border: none; background: transparent; font-size: 18px; cursor: pointer; padding: 4px 8px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin: 8px 0; }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; }
.item .grow { flex: 1 1 auto; min-width: 0; }
.item .title { font-weight: 600; }
.item .sub { color: var(--muted); font-size: 13px; }
.item .actions { display: flex; gap: 4px; }
.form label { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-size: 13px; color: var(--muted); }
.form input, .form select, .form textarea { font-size: 15px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--text); width: 100%; }
.form textarea { min-height: 60px; }
.form .inline { display: flex; gap: 6px; align-items: center; }
.form .inline input { flex: 1 1 auto; min-width: 0; }
.form .check { flex-direction: row; align-items: center; gap: 8px; }
.form .check input { width: auto; }
.form .quad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.form .tri { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.form .duo { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.months { display: flex; gap: 4px; flex-wrap: wrap; }
.months .m { width: 30px; height: 30px; border-radius: 6px; border: 1px solid var(--border); background: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 12px; }
.months .m.on { background: var(--green); color: #fff; border-color: var(--green); }
.months .m.peak { outline: 2px solid var(--accent); }
.hab-row { display: flex; align-items: center; gap: 8px; margin: 3px 0; font-size: 13px; }
.hab-row span.lab { width: 130px; flex: 0 0 auto; }
.hab-row input[type=range] { flex: 1 1 auto; }
.hab-row .val { width: 34px; text-align: right; }
.pre { white-space: pre-wrap; font-size: 13px; background: #f7f7f3; border-radius: 8px; padding: 10px; }
.progress { margin-top: 10px; background: #e6e9e4; border-radius: 6px; height: 22px; position: relative; overflow: hidden; }
.progress .bar { background: var(--green); height: 100%; width: 0; transition: width .3s; }
.progress .label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; }
#tabs { flex: 0 0 auto; display: flex; background: #fff; border-top: 1px solid var(--border); height: calc(var(--tabs-h) + var(--safe-b)); padding-bottom: var(--safe-b); }
#tabs button { flex: 1; border: none; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11px; cursor: pointer; }
#tabs button span { font-size: 20px; }
#tabs button.active { color: var(--green); font-weight: 600; }
.sheet { position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + var(--safe-b)); max-height: 62vh; background: #fff; border-radius: 16px 16px 0 0; box-shadow: 0 -4px 16px rgba(0,0,0,.2); z-index: 900; overflow: auto; padding: 6px 14px 14px; }
.sheet-handle { width: 40px; height: 4px; background: #ccc; border-radius: 2px; margin: 4px auto 8px; }
.sheet h3 { margin: 4px 0; font-size: 17px; }
.sheet .sub { color: var(--muted); font-size: 13px; }
.sheet .close { position: absolute; right: 8px; top: 6px; }
.kv { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; margin: 6px 0; }
.kv b { font-weight: 600; }
.cover-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin: 4px 0; }
.cover-bar div { height: 100%; }
.cover-leg { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.cover-leg i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 3px; vertical-align: middle; }
.sp-row { border-top: 1px solid var(--border); padding: 8px 0; }
.sp-head { display: flex; align-items: center; gap: 8px; }
.sp-head .name { flex: 1; font-weight: 600; }
.score { min-width: 40px; text-align: center; border-radius: 6px; padding: 2px 6px; color: #fff; font-weight: 700; font-size: 14px; }
.sp-expl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.factors { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.factor { font-size: 11px; border-radius: 4px; padding: 1px 6px; background: #eef1ec; }
.factor.low { background: #fde3c8; } .factor.bad { background: #f7c9c9; }
.spark { display: flex; gap: 2px; align-items: flex-end; height: 28px; margin-top: 4px; }
.spark div { flex: 1; border-radius: 2px 2px 0 0; min-height: 2px; }
.spark div.today { outline: 1px solid #333; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; display: flex; align-items: flex-end; justify-content: center; }
.modal-box { background: #fff; width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 16px 16px 0 0; padding: 10px 14px calc(14px + var(--safe-b)); }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 6px 0; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabs-h) + var(--safe-b) + 12px); background: #222; color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 1100; font-size: 14px; max-width: 90vw; }
.leaflet-container { font: inherit; }
.marker-spot { font-size: 22px; line-height: 22px; text-shadow: 0 0 3px #fff; }
.marker-find { font-size: 20px; line-height: 20px; text-shadow: 0 0 3px #fff; }
.pick-banner { position: absolute; top: 8px; left: 8px; right: 8px; z-index: 850; background: var(--green); color: #fff; border-radius: 8px; padding: 10px; display: flex; justify-content: space-between; align-items: center; }
.pick-banner button { background: #fff; color: var(--green); border: none; border-radius: 6px; padding: 6px 10px; }
.leaflet-control-layers { font-size: 13px; }
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; font-size: 13px; }
.status-grid b { display: block; font-size: 15px; }
@media (min-width: 700px) { .form .inline { max-width: 460px; } }

.leaflet-top.leaflet-right { margin-top: 84px; }
.leaflet-control-attribution { font-size: 10px; }
.profile-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; }
.profile-grid span { display: flex; flex-direction: column; align-items: center; font-size: 10px; color: var(--muted); }
.profile-grid input { padding: 4px 2px; font-size: 12px; text-align: center; -moz-appearance: textfield; }
.profile-grid input::-webkit-outer-spin-button, .profile-grid input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.prof-mini { display: inline-flex; align-items: flex-end; gap: 1px; height: 12px; vertical-align: middle; }
.prof-mini i { display: inline-block; width: 4px; background: var(--green); border-radius: 1px 1px 0 0; }
.species-panel { pointer-events: auto; margin: 0 8px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 4px 14px rgba(0,0,0,.2); max-height: 55vh; overflow: auto; max-width: 420px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; }
.panel-list { padding: 4px 0; }
.panel-row { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 14px; cursor: pointer; }
.panel-row:active { background: #f1f4ef; }
.panel-row input { width: 18px; height: 18px; }
.panel-row > span:first-of-type { flex: 1; }
.chip .moon { font-size: 11px; opacity: .85; }
.progress.bg .bar { background: #8aa88f; }

/* ---- accounts ---- */
body.no-admin [data-admin] { display: none !important; }
.auth-page { display: flex; min-height: 100%; align-items: center; justify-content: center; }
.auth-box { width: 100%; max-width: 380px; margin: 24px auto; }
.auth-box h2 { margin: 0 0 4px; }
.auth-box .logo { font-size: 26px; vertical-align: middle; }
.auth-switch { margin-top: 12px; text-align: center; }
.auth-switch a { color: var(--green); font-weight: 600; }
.error { color: var(--danger); font-size: 13px; margin: 6px 0; }
.badge { display: inline-block; background: var(--green); color: #fff; border-radius: 6px; padding: 1px 6px; font-size: 11px; vertical-align: middle; margin-left: 4px; }
