:root {
  --bg: #0d1611; --bg2: #121f17; --card: rgba(27, 43, 33, .78); --card2: #1d3024; --line: rgba(232, 220, 196, .09);
  --text: #efe6d2; --muted: #a9ad9b; --dim: #6f7a6b;
  --moss: #8fb069; --moss2: #5d7e45; --amber: #d9944a; --amber2: #b56a2a; --rust: #c25b3c; --sky: #7fb2c9;
  --r: 18px; --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --serif: "Fraunces", Georgia, serif; --sans: "Inter", system-ui, -apple-system, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--sans); }
body { min-height: 100vh; overflow-x: hidden; }
#bg { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(1200px 600px at 110% -10%, rgba(217, 148, 74, .16), transparent 60%),
    radial-gradient(900px 500px at -20% 10%, rgba(143, 176, 105, .14), transparent 60%),
    radial-gradient(800px 800px at 50% 120%, rgba(30, 60, 40, .7), transparent 70%),
    linear-gradient(180deg, #0f1b14, #0b130e); }
#bg::after { content: ""; position: absolute; inset: 0; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"); }

a { color: var(--amber); text-decoration: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: -.01em; margin: 0; }
h1 { font-size: 30px; line-height: 1.1; }
h2 { font-size: 21px; }
h3 { font-size: 16px; font-family: var(--sans); font-weight: 600; }
small, .muted { color: var(--muted); }
.dim { color: var(--dim); }

#top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; backdrop-filter: blur(14px);
  background: linear-gradient(180deg, rgba(13, 22, 17, .92), rgba(13, 22, 17, .55)); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; }
.brand img { width: 36px; height: 36px; border-radius: 10px; box-shadow: 0 4px 14px rgba(0, 0, 0, .4); }
.brand b { font-family: var(--serif); font-size: 18px; display: block; line-height: 1; }
.brand small { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
#netpill { font-size: 12px; padding: 5px 10px; border-radius: 99px; background: rgba(194, 91, 60, .2); color: #f0b39f;
  border: 1px solid rgba(194, 91, 60, .4); }

main { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(110px + var(--safe-b)); }
.page-in { animation: rise .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- bottom tabs */
#tabs { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--safe-b)); z-index: 30;
  display: flex; align-items: center; gap: 2px; padding: 6px; width: min(440px, calc(100% - 24px));
  background: rgba(20, 33, 25, .86); backdrop-filter: blur(18px); border: 1px solid var(--line); border-radius: 26px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .5); }
#tabs[hidden], #netpill[hidden] { display: none; }
#tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 5px;
  color: var(--dim); font-size: 10.5px; font-weight: 600; border-radius: 18px; transition: .2s; }
#tabs a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#tabs a.on { color: var(--text); background: rgba(239, 230, 210, .06); }
#tabs a.on svg { stroke: var(--amber); }
#tabs a.fab { flex: 0 0 58px; height: 58px; margin: -22px 4px 0; border-radius: 20px; justify-content: center;
  background: linear-gradient(145deg, #e3a35c, #b56a2a); color: #1b0f05; box-shadow: 0 10px 24px rgba(181, 106, 42, .5); }
#tabs a.fab svg { width: 28px; height: 28px; stroke: #1b0f05; stroke-width: 2.6; }

/* ---------- cards & layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px;
  box-shadow: var(--shadow); backdrop-filter: blur(10px); }
.card + .card, .stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 2px 10px; }
.section-title h2 { font-size: 19px; }
.section-title a { font-size: 13px; font-weight: 600; }
.eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--amber); font-weight: 700; }

/* ---------- hero */
.hero { position: relative; overflow: hidden; border-radius: 24px; padding: 22px 18px 18px; border: 1px solid var(--line);
  background:
    radial-gradient(400px 220px at 100% 0%, rgba(217, 148, 74, .35), transparent 70%),
    linear-gradient(160deg, #1f3a28 0%, #142219 60%, #101b14 100%); box-shadow: var(--shadow); }
.hero::before { content: ""; position: absolute; right: -30px; bottom: -40px; width: 230px; height: 230px; opacity: .13;
  background: url("/static/icon.svg") center/contain no-repeat; filter: grayscale(.2); transform: rotate(-8deg); }
.hero h1 { font-size: 28px; }
.hero p { margin: 6px 0 16px; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; position: relative; }
.kpi { background: rgba(10, 18, 13, .45); border: 1px solid var(--line); border-radius: 14px; padding: 10px 10px 9px; }
.kpi b { display: block; font-family: var(--serif); font-size: 26px; line-height: 1.05; }
.kpi span { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.kpi.accent b { color: var(--amber); }
.kpi.moss b { color: var(--moss); }
.hero-actions { display: flex; gap: 10px; margin-top: 16px; position: relative; }

/* ---------- buttons */
.btn { appearance: none; border: 0; cursor: pointer; font: 600 15px var(--sans); border-radius: 14px; padding: 13px 16px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--text);
  background: rgba(239, 230, 210, .08); border: 1px solid var(--line); transition: transform .12s, background .2s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(145deg, #e3a35c, #b56a2a); color: #1b0f05; border: 0;
  box-shadow: 0 8px 20px rgba(181, 106, 42, .35); }
.btn.moss { background: linear-gradient(145deg, #9cbf73, #5d7e45); color: #0e1a0b; border: 0; }
.btn.danger { background: rgba(194, 91, 60, .15); color: #f0a48c; border-color: rgba(194, 91, 60, .4); }
.btn.block { width: 100%; }
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 11px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn { width: 40px; height: 40px; padding: 0; border-radius: 12px; }

/* ---------- list items */
.day { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; background: var(--card);
  border: 1px solid var(--line); color: var(--text); transition: transform .15s; }
.day:active { transform: scale(.985); }
.day + .day { margin-top: 8px; }
.datebadge { flex: 0 0 52px; height: 56px; border-radius: 13px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; background: linear-gradient(160deg, #2a4532, #1a2c20); border: 1px solid var(--line); }
.datebadge b { font-family: var(--serif); font-size: 22px; line-height: 1; }
.datebadge span { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--amber); font-weight: 700; }
.day .info { flex: 1; min-width: 0; }
.day .info h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day .info small { display: block; }
.tally { text-align: right; }
.tally b { font-family: var(--serif); font-size: 22px; color: var(--amber); }
.tally small { display: block; font-size: 11px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: rgba(239, 230, 210, .07); color: var(--muted); border: 1px solid var(--line); }
.tag.private { color: #e7b8f2; background: rgba(170, 110, 200, .12); border-color: rgba(170, 110, 200, .3); }
.tag.frost { color: #bfe3f2; background: rgba(127, 178, 201, .13); border-color: rgba(127, 178, 201, .3); }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }

/* ---------- forms */
label.f { display: block; margin-top: 14px; }
label.f > span, .flabel { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px; }
input, select, textarea { width: 100%; font: 16px var(--sans); color: var(--text); background: rgba(8, 14, 10, .55);
  border: 1px solid rgba(232, 220, 196, .14); border-radius: 13px; padding: 12px 13px; outline: none; transition: border .2s, box-shadow .2s; }
input:focus, select:focus, textarea:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(217, 148, 74, .18); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a9ad9b' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
textarea { min-height: 80px; resize: vertical; }
.pin-input { letter-spacing: .6em; text-align: center; font-size: 26px; font-family: var(--serif); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { font: 600 13.5px var(--sans); padding: 9px 13px; border-radius: 99px; border: 1px solid rgba(232, 220, 196, .14);
  background: rgba(8, 14, 10, .4); color: var(--muted); cursor: pointer; transition: .15s; user-select: none; }
.chip.on { background: linear-gradient(145deg, rgba(227, 163, 92, .95), rgba(181, 106, 42, .95)); color: #1b0f05; border-color: transparent; }
.chip.auto { position: relative; }
.chip.auto::after { content: "auto"; position: absolute; top: -7px; right: -4px; font-size: 9px; padding: 1px 5px; border-radius: 99px;
  background: var(--sky); color: #0b1a22; font-weight: 800; letter-spacing: .04em; }

.stepper { display: flex; align-items: center; background: rgba(8, 14, 10, .5); border: 1px solid rgba(232, 220, 196, .14);
  border-radius: 15px; overflow: hidden; }
.stepper button { width: 46px; height: 50px; border: 0; background: transparent; color: var(--amber); font-size: 24px; cursor: pointer; }
.stepper button:active { background: rgba(217, 148, 74, .15); }
.stepper input { border: 0; background: transparent; text-align: center; font: 700 22px var(--serif); padding: 0; height: 50px; box-shadow: none !important; }
.counter { text-align: center; }
.counter .flabel { margin-bottom: 6px; }

.bird { position: relative; padding: 12px; border-radius: 15px; background: rgba(8, 14, 10, .35); border: 1px solid var(--line); }
.bird + .bird { margin-top: 8px; }
.bird .num { position: absolute; top: 10px; right: 12px; font: 700 12px var(--sans); color: var(--dim); }
.bird .x { position: absolute; top: 6px; right: 34px; background: none; border: 0; color: var(--dim); font-size: 20px; cursor: pointer; }

.weather-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.wcell { background: rgba(127, 178, 201, .08); border: 1px solid rgba(127, 178, 201, .18); border-radius: 12px; padding: 8px 6px; text-align: center; }
.wcell b { display: block; font-family: var(--serif); font-size: 18px; color: #d6ecf5; }
.wcell span { font-size: 10.5px; color: var(--muted); }

.mic { width: 100%; padding: 16px; border-radius: 18px; border: 1px dashed rgba(217, 148, 74, .5); background: rgba(217, 148, 74, .07);
  color: var(--text); font: 600 15px var(--sans); display: flex; gap: 12px; align-items: center; cursor: pointer; }
.mic .dot { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 44px;
  background: linear-gradient(145deg, #e3a35c, #b56a2a); }
.mic .dot svg { width: 22px; height: 22px; stroke: #1b0f05; fill: none; stroke-width: 2.2; stroke-linecap: round; }
.mic.rec { border-style: solid; border-color: var(--rust); background: rgba(194, 91, 60, .12); }
.mic.rec .dot { background: var(--rust); animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(194, 91, 60, .6); } 100% { box-shadow: 0 0 0 16px rgba(194, 91, 60, 0); } }
.mic small { display: block; font-weight: 500; }

.notice { padding: 12px 14px; border-radius: 14px; font-size: 14px; background: rgba(127, 178, 201, .1); border: 1px solid rgba(127, 178, 201, .25); }
.notice.warn { background: rgba(217, 148, 74, .1); border-color: rgba(217, 148, 74, .35); }
.notice.err { background: rgba(194, 91, 60, .12); border-color: rgba(194, 91, 60, .4); color: #f3b9a6; }

.savebar { position: sticky; bottom: calc(96px + var(--safe-b)); margin-top: 18px; z-index: 5; }

/* ---------- map */
.map { height: 300px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.map.tall { height: 380px; }
.leaflet-container { background: #142019; font: 13px var(--sans); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #1d3024; color: var(--text); }
.leaflet-popup-content b { font-family: var(--serif); font-size: 15px; }
.pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center;
  background: linear-gradient(145deg, #e3a35c, #b56a2a); border: 2px solid #1b0f05; box-shadow: 0 4px 10px rgba(0, 0, 0, .5); }
.pin span { transform: rotate(45deg); font: 800 11px var(--sans); color: #1b0f05; }
.pin.private { background: linear-gradient(145deg, #c79be0, #8a55a8); }
.layer-toggle { position: absolute; z-index: 500; top: 10px; right: 10px; }

/* ---------- stats */
.chartbox { position: relative; height: 220px; }
.bars .bar { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin-top: 10px; }
.bars .track { grid-column: 1 / -1; height: 9px; border-radius: 9px; background: rgba(239, 230, 210, .06); overflow: hidden; }
.bars .fill { height: 100%; border-radius: 9px; background: linear-gradient(90deg, var(--moss2), var(--moss)); }
.bars .bar:nth-child(1) .fill { background: linear-gradient(90deg, var(--amber2), var(--amber)); }
.seg { display: inline-flex; background: rgba(8, 14, 10, .5); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); font: 600 13px var(--sans); padding: 7px 11px; border-radius: 9px; cursor: pointer; }
.seg button.on { background: rgba(217, 148, 74, .2); color: var(--amber); }

/* ---------- auth */
.auth { max-width: 420px; margin: 6vh auto 0; }
.auth .logo { width: 92px; height: 92px; display: block; margin: 0 auto 14px; border-radius: 26px; box-shadow: 0 14px 40px rgba(0, 0, 0, .55); }
.auth h1 { text-align: center; font-size: 32px; }
.auth p.lead { text-align: center; color: var(--muted); margin: 8px 0 22px; }

#toast { position: fixed; left: 50%; bottom: calc(110px + var(--safe-b)); transform: translate(-50%, 20px); opacity: 0; z-index: 60;
  background: #f3ead6; color: #1b140c; font-weight: 600; padding: 11px 16px; border-radius: 14px; box-shadow: var(--shadow);
  transition: .25s; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.empty img { width: 70px; opacity: .55; margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }
.backlink { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.copybox { display: flex; gap: 8px; }
.copybox input { font-size: 13px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

@media (min-width: 700px) {
  .kpis { grid-template-columns: repeat(6, 1fr); }
  h1 { font-size: 34px; }
}
