:root {
  --green: #2e6b3a;
  --green-dark: #1f4d29;
  --green-light: #e8f3de;
  --bg: #f6f8f4;
  --card: #fff;
  --text: #1d261f;
  --muted: #5d6b60;
  --line: #dfe5dc;
  --danger: #b3261e;
  --warn: #9a6700;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 4px 14px rgba(0, 0, 0, .06);
  --top-h: 52px;
  --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--green); }
i.sci, .sci { font-style: italic; }
h2 { font-size: 1.15rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.stack > * + * { margin-top: .75rem; }

/* ---------- app chrome ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 1000;
  height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) .75rem 0;
  display: flex; align-items: center; gap: .75rem;
  background: var(--green); color: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
}
.brand { display: flex; align-items: center; gap: .4rem; color: #fff; text-decoration: none; font-weight: 700; }
.brand img { border-radius: 6px; }
.topbar h1 { flex: 1; margin: 0; font-size: 1rem; font-weight: 500; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.net-status { font-size: .75rem; background: #fff3; padding: .15rem .5rem; border-radius: 99px; }

#view {
  position: absolute; left: 0; right: 0;
  top: calc(var(--top-h) + var(--safe-t));
  bottom: calc(var(--tab-h) + var(--safe-b));
  overflow-y: auto; -webkit-overflow-scrolling: touch; outline: none;
  z-index: 0; /* own stacking context: Leaflet panes/controls stay under the bars */
}
body.no-tabs #view { bottom: 0; }
.page { max-width: 860px; margin: 0 auto; padding: .9rem .9rem 2rem; }
.page.wide { max-width: 1200px; }

.banner {
  position: fixed; z-index: 999; left: 0; right: 0; top: calc(var(--top-h) + var(--safe-t));
  background: #fff4d6; color: #5c4400; padding: .45rem .9rem; font-size: .9rem;
  display: flex; gap: .6rem; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #ecd9a0;
}
body.has-banner #view { top: calc(var(--top-h) + var(--safe-t) + 40px); }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 1000;
  height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: stretch;
  background: #fff; border-top: 1px solid var(--line);
}
.tabbar a, .tabbar .fab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: .7rem; color: var(--muted); text-decoration: none; cursor: pointer; user-select: none;
}
.tabbar svg { width: 24px; height: 24px; fill: currentColor; }
.tabbar a.active { color: var(--green); font-weight: 600; }
.tabbar .fab { color: var(--green); font-weight: 600; }
.tabbar .fab svg {
  width: 52px; height: 52px; padding: 13px; margin-top: -22px; border-radius: 50%;
  background: var(--green); fill: #fff; box-shadow: 0 3px 10px rgba(46, 107, 58, .45);
  border: 3px solid #fff;
}
.tabbar .fab:active svg { transform: scale(.94); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  min-height: 42px; padding: .5rem 1rem; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font: inherit; font-weight: 500; cursor: pointer;
  text-decoration: none; touch-action: manipulation;
}
.btn:hover { background: #f2f5f0; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.btn.danger { color: var(--danger); border-color: #e9c4c1; }
.btn.small { min-height: 34px; padding: .3rem .7rem; font-size: .88rem; }
.btn.block { width: 100%; }
.btn.icon { padding: .45rem .6rem; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.link-btn { background: none; border: 0; padding: 0; color: var(--green); font: inherit; cursor: pointer; text-decoration: underline; }

.field { display: block; }
.field > span:first-child, .field-label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: .25rem; }
.field .help { display: block; font-size: .78rem; color: var(--muted); margin-top: .2rem; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=tel],
input[type=datetime-local], input[type=date], select, textarea {
  width: 100%; min-height: 44px; padding: .55rem .7rem; border: 1px solid #cbd3c8; border-radius: 10px;
  background: #fff; color: var(--text); font: inherit; font-size: 16px; /* 16px avoids iOS zoom */
}
textarea { min-height: 90px; resize: vertical; }
select:disabled { background: #f1f3f0; color: #98a39a; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(46, 107, 58, .35); border-color: var(--green); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.field .error { color: var(--danger); font-size: .8rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
@media (max-width: 420px) { .grid3 { grid-template-columns: 1fr 1fr; } }
.checks { display: flex; flex-wrap: wrap; gap: .4rem; }
.check {
  display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .7rem; border: 1px solid var(--line);
  border-radius: 99px; background: #fff; cursor: pointer; font-size: .9rem; user-select: none;
}
.check input { margin: 0; accent-color: var(--green); }
.check:has(input:checked) { background: var(--green-light); border-color: #a9cf98; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; }
.card + .card, .card + section, section + .card { margin-top: .9rem; }
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.section-title { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 1.2rem 0 .4rem; font-weight: 700; }

.tabs { display: flex; gap: .3rem; overflow-x: auto; padding-bottom: .2rem; scrollbar-width: none; }
.tabs button {
  flex: 0 0 auto; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: .4rem .85rem;
  font: inherit; font-size: .9rem; cursor: pointer; color: var(--muted);
}
.tabs button.active { background: var(--green); color: #fff; border-color: var(--green); }

.chip {
  display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .65rem; border-radius: 99px;
  background: var(--green-light); color: var(--green-dark); font-size: .85rem;
}
.chip button { border: 0; background: none; padding: 0 0 0 .2rem; cursor: pointer; font-size: 1rem; line-height: 1; color: inherit; }
.badge { display: inline-block; padding: .05rem .45rem; border-radius: 6px; font-size: .75rem; font-weight: 600; background: #eef1ec; color: var(--muted); }
.badge.warn { background: #fff1cc; color: var(--warn); }
.badge.good { background: var(--green-light); color: var(--green-dark); }
.badge.danger { background: #fbe3e1; color: var(--danger); }

/* ---------- lists ---------- */
.items { list-style: none; margin: 0; padding: 0; }
.items > li { border-bottom: 1px solid var(--line); }
.items > li:last-child { border-bottom: 0; }
.item {
  display: flex; gap: .75rem; align-items: center; padding: .65rem .2rem;
  color: inherit; text-decoration: none;
}
.item .thumb { width: 56px; height: 56px; flex: 0 0 56px; border-radius: 10px; object-fit: cover; background: var(--green-light); }
.item .thumb.empty { display: flex; align-items: center; justify-content: center; color: #8fb486; }
.item .thumb.empty svg { width: 28px; height: 28px; fill: currentColor; }
.item .title { font-weight: 600; }
.item .sub { font-size: .85rem; color: var(--muted); }
.empty-state { text-align: center; color: var(--muted); padding: 2rem 1rem; }

table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: .45rem .4rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: .75rem; text-transform: uppercase; color: var(--muted); font-weight: 700; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td:first-child { min-width: 9rem; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover { background: #f4f8f1; }
.table-wrap { overflow-x: auto; }

/* ---------- maps ---------- */
.map-full { position: absolute; inset: 0; }
.map-box { height: 260px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); isolation: isolate; }
.map-box.tall { height: 46vh; min-height: 280px; }
.leaflet-container { font: inherit; background: #dfe8dc; }
.map-tools { position: absolute; z-index: 500; right: 10px; display: flex; flex-direction: column; gap: 8px; }
.map-tools.top { top: 10px; }
.map-tools.bottom { bottom: 30px; }
.map-tool {
  width: 44px; height: 44px; border-radius: 10px; border: 0; background: #fff; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.map-tool svg { width: 22px; height: 22px; fill: var(--green-dark); }
.map-tool.on { background: var(--green); }
.map-tool.on svg { fill: #fff; }
.map-search {
  position: absolute; z-index: 500; left: 10px; right: 64px; top: 10px; max-width: 420px;
}
.map-search .chip { box-shadow: var(--shadow); background: #fff; padding: .45rem .8rem; }
.map-count { position: absolute; z-index: 500; left: 10px; bottom: 30px; background: #fffd; padding: .2rem .6rem; border-radius: 8px; font-size: .8rem; box-shadow: var(--shadow); }
.dot-icon { background: none; border: 0; }
.dot-icon span {
  display: block; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35);
}
.dot-icon.star span { width: 20px; height: 20px; outline: 2px solid #f0b400; }
.you-icon span { display: block; width: 18px; height: 18px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-shadow: 0 0 0 1px #1a73e8, 0 0 10px rgba(26, 115, 232, .6); }
.pin-icon svg { width: 34px; height: 44px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
.vertex-icon span { display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid #d35400; }
.popup { min-width: 180px; }
.popup img { width: 100%; max-height: 140px; object-fit: cover; border-radius: 8px; margin-bottom: .35rem; display: block; }
.popup .title { font-weight: 600; }
.leaflet-popup-content { margin: 10px 12px; }
.legend { background: #fffe; padding: .4rem .6rem; border-radius: 8px; font-size: .78rem; box-shadow: var(--shadow); line-height: 1.6; }
.legend i { display: inline-block; width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; border-radius: 3px; }
.fc-heat-canvas { position: absolute; top: 0; left: 0; pointer-events: none; }

/* ---------- desktop flora explorer ---------- */
.explore-shell { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(286px, 330px) minmax(0, 1fr); background: #e7ece3; }
.explore-sidebar { z-index: 20; min-width: 0; overflow-y: auto; overscroll-behavior: contain; background: #fbfcf9; border-right: 1px solid var(--line); box-shadow: 2px 0 12px rgba(27, 45, 28, .08); }
.explore-sidebar-head { padding: 1.35rem 1.25rem 1rem; border-bottom: 1px solid var(--line); background: linear-gradient(145deg, #f3f8ed, #fbfcf9 72%); }
.explore-eyebrow { display: flex; align-items: center; gap: .4rem; color: var(--green); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 750; }
.explore-eyebrow svg { width: 16px; height: 16px; fill: currentColor; }
.explore-sidebar-head h2 { margin: .55rem 0 .25rem; font-size: 1.42rem; letter-spacing: -.025em; }
.explore-sidebar-head p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.45; }
.explore-section { padding: 1rem 1.15rem; border-bottom: 1px solid var(--line); }
.explore-label { display: block; margin: 0 0 .5rem; color: #647166; font-size: .73rem; font-weight: 750; text-transform: uppercase; letter-spacing: .075em; }
.explore-search-wrap { position: relative; }
.explore-search-wrap input[type=search] { min-height: 44px; padding-left: 2.45rem; border-color: #d3ddd0; border-radius: 11px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23738376' d='M15.5 14h-.8l-.3-.3A6.5 6.5 0 1 0 14 15.5l.3.3v.8l5 5 1.5-1.5-5-5zm-6 0a4.5 4.5 0 1 1 0-9 4.5 4.5 0 0 1 0 9z'/%3E%3C/svg%3E") no-repeat .8rem center / 18px; box-shadow: 0 2px 5px #1f4d2910; }
.explore-search-wrap input[type=search]:focus { box-shadow: 0 0 0 3px #2e6b3a18; }
.explore-search-results { position: absolute; z-index: 1000; top: calc(100% + 5px); left: 0; right: 0; max-height: 310px; margin: 0; padding: 4px; list-style: none; overflow-y: auto; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: 0 10px 24px #1d261f24; }
.explore-search-results li { display: flex; justify-content: space-between; align-items: center; gap: .45rem; padding: .6rem .55rem; border-radius: 7px; cursor: pointer; font-size: .88rem; }
.explore-search-results li:hover, .explore-search-results li:focus { outline: none; background: #f0f6ec; }
.explore-search-results .explore-no-result { color: var(--muted); cursor: default; }
.explore-rank { flex: 0 0 auto; padding: .1rem .35rem; border-radius: 5px; background: #eef2eb; color: #6b776c; font-size: .67rem; text-transform: uppercase; }
.explore-taxon-chip { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 42px; padding: .45rem .65rem; border: 1px solid #c5dbb9; border-radius: 10px; background: #eff7e9; color: var(--green-dark); font-size: .86rem; }
.explore-taxon-chip button { flex: 0 0 auto; border: 0; background: none; color: inherit; font-size: 1.25rem; cursor: pointer; }
.explore-mode-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border: 1px solid #e0e6dc; border-radius: 11px; background: #eff2ed; }
.explore-mode { display: flex; min-width: 0; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; min-height: 60px; padding: .35rem .15rem; border: 0; border-radius: 8px; background: transparent; color: #657166; font: inherit; font-size: .72rem; font-weight: 650; cursor: pointer; }
.explore-mode svg { width: 20px; height: 20px; fill: currentColor; }
.explore-mode:hover { background: #fff8; }
.explore-mode.active { background: #fff; color: var(--green-dark); box-shadow: 0 1px 5px #1721161a; }
.explore-toggle { display: flex; align-items: center; gap: .55rem; min-height: 35px; color: #39453c; font-size: .87rem; cursor: pointer; }
.explore-toggle input { width: 16px; height: 16px; margin: 0; accent-color: var(--green); }
.explore-date-range { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: .45rem 0; }
.explore-date-range label { min-width: 0; }
.explore-date-range label span { display: block; margin-bottom: .2rem; color: var(--muted); font-size: .72rem; }
.explore-date-range input[type=date] { min-height: 38px; padding: .35rem .42rem; border-radius: 8px; font-size: .8rem; }
.explore-stats { display: flex; align-items: baseline; gap: .55rem; padding: .9rem 1.2rem .8rem; background: #f2f7ed; border-bottom: 1px solid #e0e9db; }
.explore-stat-number { color: var(--green-dark); font-size: 1.52rem; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.explore-stat-note { color: var(--muted); font-size: .82rem; }
.explore-recent-section { padding-top: .9rem; }
.explore-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: .4rem; }
.explore-section-title > span { color: #8a958a; font-size: .69rem; text-transform: uppercase; letter-spacing: .06em; }
.explore-observation { display: flex; width: 100%; align-items: center; gap: .65rem; padding: .63rem .15rem; border: 0; border-bottom: 1px solid #e9eee6; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.explore-observation:hover { background: #f3f7f0; }
.explore-observation:last-child { border-bottom: 0; }
.explore-observation-dot { flex: 0 0 11px; width: 11px; height: 11px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #34423770; }
.explore-observation-copy { display: grid; flex: 1; min-width: 0; gap: .04rem; }
.explore-observation-copy b { overflow: hidden; font-size: .86rem; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.explore-observation-copy i { overflow: hidden; color: var(--muted); font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.explore-notable-mark { color: #b4811b; font-size: .9rem; }
.explore-empty { margin: .2rem 0; color: var(--muted); font-size: .85rem; }
.explore-map-panel { position: relative; min-width: 0; min-height: 0; overflow: hidden; isolation: isolate; }
.explore-map-canvas { position: absolute; inset: 0; outline: none; }
.explore-map-count { position: absolute; z-index: 500; right: 14px; bottom: 14px; max-width: min(60%, 420px); padding: .42rem .7rem; border: 1px solid #ffffffc9; border-radius: 9px; background: #fffffff0; box-shadow: var(--shadow); color: #526055; font-size: .76rem; }
.explore-legend { display: grid; gap: .25rem; min-width: 130px; padding: .5rem .65rem; border: 1px solid #ffffffc9; border-radius: 9px; background: #fffffff0; box-shadow: var(--shadow); color: #465349; font-size: .72rem; }
.explore-legend > b { margin-bottom: .1rem; font-size: .72rem; }
.explore-legend-item { display: inline-flex; align-items: center; gap: .3rem; }
.explore-legend-item i { width: 11px; height: 11px; border: 1px solid #17211630; border-radius: 3px; }
.explore-legend-star { display: inline-flex; align-items: center; justify-content: center; border: 0 !important; color: #b4811b; }
.explore-heat-gradient { display: block; width: 150px; height: 10px; border-radius: 99px; background: linear-gradient(90deg, #239b57, #f7d345, #f4852b, #cf3030); }
.explore-legend-range { display: flex; justify-content: space-between; gap: .55rem; color: var(--muted); font-size: .68rem; }

/* ---------- specimen form & detail ---------- */
.photo-strip { display: flex; gap: .5rem; overflow-x: auto; padding: .1rem 0 .4rem; scroll-snap-type: x mandatory; }
.photo-strip figure { position: relative; margin: 0; flex: 0 0 auto; max-width: 100%; scroll-snap-align: start; }
.photo-strip img { display: block; height: 150px; width: auto; max-width: 260px; object-fit: cover; border-radius: 10px; background: var(--green-light); }
.photo-strip.big img { height: 240px; max-width: 100%; }
.photo-strip figcaption { position: absolute; left: 6px; bottom: 6px; background: #000a; color: #fff; font-size: .72rem; padding: .05rem .4rem; border-radius: 6px; }
.photo-strip .remove { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: #000a; color: #fff; font-size: 1.1rem; cursor: pointer; }
.photo-strip select { position: absolute; left: 6px; bottom: 6px; width: auto; min-height: 30px; padding: .1rem .3rem; font-size: .8rem; border-radius: 6px; }
.add-photo {
  flex: 0 0 auto; width: 120px; height: 150px; border: 2px dashed #b8c8b2; border-radius: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: var(--green); font-size: .85rem; cursor: pointer; text-align: center; padding: .4rem;
}
.add-photo svg { width: 30px; height: 30px; fill: currentColor; }
.loc-status { display: flex; align-items: center; gap: .5rem; font-size: .9rem; }
.loc-dot { width: 10px; height: 10px; border-radius: 50%; background: #c9c9c9; flex: 0 0 10px; }
.loc-dot.good { background: #2e9d48; }
.loc-dot.fair { background: #e0a100; }
.loc-dot.poor { background: #d35400; }
.loc-dot.wait { background: #9bb; animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .3; } }

.taxon-levels { display: grid; gap: .55rem; }
.taxon-level { display: grid; grid-template-columns: 1fr; gap: .15rem; }
.taxon-level .lvl-head { display: flex; align-items: center; gap: .4rem; }
.taxon-level .lvl-num { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: var(--green-light); color: var(--green-dark); font-size: .75rem; font-weight: 700; align-items: center; justify-content: center; flex: 0 0 22px; }
.taxon-level .lvl-name { font-weight: 600; font-size: .9rem; }
.taxon-level .help { font-size: .75rem; color: var(--muted); }
.taxon-guide-link { margin-left: auto; padding: 0; font-size: .73rem; white-space: nowrap; }
.rank-guide > p:first-child { margin: 0 0 .75rem; }
.rank-guide h3 { margin: .85rem 0 .35rem; }
.rank-guide ul { margin: 0; padding-left: 1.25rem; }
.rank-guide li { margin: .35rem 0; }
.rank-guide-tip { margin: .85rem 0 0; padding: .7rem .8rem; border-radius: 9px; background: var(--green-light); color: var(--green-dark); font-size: .85rem; }
.taxon-level.italic select { font-style: italic; }
.search-results { list-style: none; margin: .3rem 0 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; max-height: 300px; overflow-y: auto; }
.search-results li { padding: .5rem .7rem; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; gap: .5rem; align-items: center; justify-content: space-between; }
.search-results li:last-child { border-bottom: 0; }
.search-results li:hover { background: #f4f8f1; }
.search-results .group { background: #f4f6f3; font-size: .75rem; font-weight: 700; text-transform: uppercase; color: var(--muted); cursor: default; }
.lineage { display: flex; flex-wrap: wrap; gap: .15rem .35rem; font-size: .82rem; color: var(--muted); }
.lineage span + span::before { content: "›"; margin-right: .35rem; color: #aab5ab; }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem .9rem; margin: 0; }
dl.facts dt { color: var(--muted); font-size: .88rem; }
dl.facts dd { margin: 0; }
.taxo-table td:first-child { color: var(--muted); width: 40%; }

/* ---------- analysis ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .55rem; }
.stat { background: #f4f7f2; border-radius: 10px; padding: .55rem .7rem; }
.stat b { display: block; font-size: 1.35rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: .75rem; color: var(--muted); }
.stat[title] { cursor: help; }
.bars { display: grid; gap: .3rem; }
.bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .1rem .5rem; font-size: .85rem; }
.bar .track { grid-column: 1 / -1; height: 7px; border-radius: 4px; background: #eef1ec; overflow: hidden; }
.bar .track i { display: block; height: 100%; background: var(--green); border-radius: 4px; }
.bar .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.months { display: flex; align-items: flex-end; gap: 2px; height: 70px; }
.months i { flex: 1; background: #8fbf82; border-radius: 2px 2px 0 0; min-height: 2px; }
.crumbs { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; font-size: .9rem; margin-bottom: .5rem; }
.crumbs button { border: 0; background: none; color: var(--green); padding: .1rem .2rem; cursor: pointer; font: inherit; text-decoration: underline; }
.crumbs span.sep { color: #aab5ab; }

/* ---------- misc ---------- */
#toasts { position: fixed; z-index: 3000; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab-h) + var(--safe-b) + 12px); display: grid; gap: .4rem; width: min(92vw, 420px); }
.toast { background: #263229; color: #fff; padding: .65rem .9rem; border-radius: 10px; box-shadow: var(--shadow); font-size: .92rem; animation: toast-in .2s ease-out; }
.toast.error { background: var(--danger); }
.install-offer { position: fixed; z-index: 1100; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 10px); transform: translateX(-50%); display: flex; align-items: center; gap: .55rem; width: min(94vw, 460px); padding: .65rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 5px 24px #17211630; }
.install-offer-copy { display: grid; flex: 1; min-width: 0; gap: .08rem; }
.install-offer-copy b { font-size: .87rem; }
.install-offer-copy span { color: var(--muted); font-size: .74rem; line-height: 1.3; }
.install-dismiss { flex: 0 0 auto; min-height: 34px; padding: .3rem .45rem; }
.install-card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.install-card-head h2 { margin: 0; }
.install-badge { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border-radius: 10px; background: var(--green-light); color: var(--green); }
.install-badge svg { width: 20px; height: 20px; fill: currentColor; }
.install-help p { margin: 0 0 .75rem; }
.install-help-steps { padding: .75rem; border-radius: 9px; background: #f1f6ed; color: var(--green-dark); }

@media (min-width: 1000px) {
  .topbar { left: 82px; padding-left: 1.15rem; }
  #view { left: 82px; bottom: 0; }
  body.has-banner #view { top: calc(var(--top-h) + var(--safe-t) + 40px); }
  .banner { left: 82px; }
  .tabbar { inset: calc(var(--top-h) + var(--safe-t)) auto 0 0; width: 82px; height: auto; padding: 8px 0 0; grid-template-columns: 1fr; grid-template-rows: repeat(5, minmax(76px, 1fr)); border-top: 0; border-right: 1px solid var(--line); }
  .tabbar a, .tabbar .fab { gap: 4px; font-size: .67rem; }
  .tabbar svg { width: 23px; height: 23px; }
  .tabbar .fab svg { width: 46px; height: 46px; padding: 11px; margin-top: 0; border-width: 2px; }
  .no-tabs .topbar, .no-tabs #view { left: 0; }
  .no-tabs .banner { left: 0; }
  #toasts { bottom: 16px; }
  .install-offer { left: auto; right: 14px; bottom: 62px; transform: none; width: min(420px, calc(100vw - 120px)); }
}

@media (min-width: 1000px) and (max-width: 1199px) {
  .explore-shell { grid-template-columns: 290px minmax(0, 1fr); }
  .explore-sidebar-head { padding: 1.15rem 1rem .9rem; }
  .explore-section { padding-right: .9rem; padding-left: .9rem; }
}
.toast.ok { background: var(--green-dark); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.modal-back { position: fixed; inset: 0; z-index: 2000; background: #0007; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .modal-back { align-items: center; } }
.modal { background: #fff; width: min(100%, 560px); max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 1rem 1rem calc(1rem + var(--safe-b)); }
@media (min-width: 640px) { .modal { border-radius: 16px; } }
.modal h2 { margin-bottom: .8rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.lightbox { position: fixed; inset: 0; z-index: 2500; background: #000e; display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 100vw; max-height: 100vh; object-fit: contain; }
.lightbox button { position: absolute; top: calc(10px + var(--safe-t)); right: 10px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff3; color: #fff; font-size: 1.5rem; cursor: pointer; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--green-light); border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; margin: 1.5rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.login-wrap { max-width: 400px; margin: 0 auto; padding: 2rem 1rem; }
.login-logo { text-align: center; margin-bottom: 1rem; }
.login-logo img { width: 72px; height: 72px; border-radius: 16px; }
.login-logo h2 { margin-top: .5rem; font-size: 1.5rem; }
.menu-list a, .menu-list button {
  display: flex; align-items: center; gap: .75rem; width: 100%; padding: .9rem .4rem; border: 0; border-bottom: 1px solid var(--line);
  background: none; font: inherit; color: inherit; text-decoration: none; cursor: pointer; text-align: left;
}
.menu-list svg { width: 22px; height: 22px; fill: var(--green); flex: 0 0 22px; }
.sticky-actions { position: sticky; bottom: 0; z-index: 1; background: linear-gradient(transparent, var(--bg) 30%); padding: 1rem 0 .3rem; display: flex; gap: .5rem; }
.sticky-actions .btn { flex: 1; }
