:root {
  --accent: #0096db;      /* SBEP bright blue */
  --header: #00236f;      /* SBEP navy header */
  --brand-coral: #ff8576; /* SBEP coral accent */
  --panel: #ffffff;
  --text: #12242e;
  --muted: #5b6b73;
  --border: #dce4e8;
  --bg: #eef3f5;
  --shadow: 0 6px 24px rgba(16, 42, 56, 0.14);
  --radius: 10px;
  --topbar-h: 60px;
  --sidebar-w: 320px;
}

* { box-sizing: border-box; }

/* App icons (SBEP Coastal Line suite). Mono icons use a CSS mask so they inherit
   the element's text color (adapt to hover/active/dark surfaces); brand icons keep
   their designed navy/blue/coral colors. */
.appicon {
  display: inline-block; width: 20px; height: 20px; flex: 0 0 auto;
  background-color: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat;
  mask: var(--i) center / contain no-repeat;
  vertical-align: -4px;
}
.appicon-img { display: inline-block; width: 20px; height: 20px; flex: 0 0 auto; vertical-align: -4px; object-fit: contain; }
/* Buttons that aren't flex containers need a little gap after a leading icon. */
.btn .appicon, .btn .appicon-img, .seg-reset .appicon { margin-right: 6px; margin-left: -2px; }
html, body { height: 100%; margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

#app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "top top" "side map";
  height: 100vh;
}
#app.sidebar-collapsed { grid-template-columns: 0 1fr; }

/* Top bar */
#topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: var(--header);
  border-bottom: 3px solid var(--brand-coral);
  z-index: 20;
}
#app-logo { height: 40px; width: auto; flex: 0 0 auto; display: block; }
#titles { min-width: 0; }
#app-title { font-size: 18px; margin: 0; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #ffffff; font-weight: 700; letter-spacing: 0.01em; }
#app-subtitle { font-size: 12px; margin: 2px 0 0; color: rgba(255,255,255,0.75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#toolbar { margin-left: auto; display: flex; gap: 6px; }

.tool, .icon-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.tool:hover, .icon-btn:hover { border-color: var(--accent); }
.tool.active { background: var(--accent); color: #fff; border-color: var(--accent); }
/* Sidebar toggle sits on the navy header — make it blend */
.icon-btn { font-size: 16px; padding: 6px 10px; background: rgba(255,255,255,0.12); color: #fff; border-color: rgba(255,255,255,0.35); }
.icon-btn:hover { background: rgba(255,255,255,0.22); border-color: #fff; }

/* Sidebar */
#sidebar {
  grid-area: side;
  background: var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 15;
}
.sidebar-collapsed #sidebar { display: none; }
.panel { padding: 16px; }
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 10px; }
.intro { font-size: 13px; color: var(--muted); line-height: 1.45; margin: 0 0 14px; }

/* Seagrass time-series control */
.sg-control { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 10px; background: #f4fbfa; }
.sg-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.sg-head input { width: 15px; height: 15px; accent-color: #14ad8e; }
.sg-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.sg-row input[type=range] { flex: 1; accent-color: #14ad8e; }
.sg-year { font-size: 13px; font-weight: 700; color: #12705f; width: 34px; text-align: right; }
.sg-ticks { display: flex; justify-content: space-between; font-size: 9px; color: var(--muted); margin-top: 2px; }
.sg-legend { display: flex; align-items: center; gap: 12px; margin-top: 8px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.sg-key { display: inline-flex; align-items: center; gap: 5px; }
.sg-key i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sg-src { margin-left: auto; font-style: italic; }

/* Bay-segment profiles (fly-tos) */
.seg-control { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 10px; background: #f2f8fc; }
.seg-head { font-size: 13px; font-weight: 600; color: var(--header); display: flex; align-items: center; gap: 7px; }
.seg-intro { font-size: 11px; color: var(--muted); line-height: 1.4; margin: 6px 0 8px; }
.seg-btns { display: flex; flex-direction: column; gap: 4px; }
.seg-btn {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  border: 1px solid var(--border); background: #fff; border-radius: 7px;
  padding: 7px 9px; cursor: pointer; font-size: 13px; color: var(--text);
}
.seg-btn:hover { border-color: var(--accent); }
.seg-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.seg-btn.active .seg-num { background: rgba(255,255,255,0.25); color: #fff; }
.seg-num {
  flex: 0 0 20px; height: 20px; display: grid; place-items: center;
  background: var(--header); color: #fff; border-radius: 50%; font-size: 11px; font-weight: 700;
}
.seg-name { flex: 1; }
.seg-reset { margin-top: 8px; width: 100%; border: 1px solid var(--border); background: #fff; border-radius: 7px; padding: 6px; cursor: pointer; font-size: 12px; color: var(--muted); }
.seg-reset:hover { border-color: var(--accent); color: var(--text); }

/* Segment profile card (slideover) */
#segment-panel .seg-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); font-weight: 700; margin-bottom: 2px; }
#segment-panel h2 { color: var(--header); margin: 0 0 8px; font-size: 20px; }
.seg-blurb { font-size: 13px; line-height: 1.5; color: var(--text); margin: 0 0 14px; }
.seg-hl { margin: 0 0 14px; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.seg-hl li { font-size: 12.5px; line-height: 1.45; color: #33454d; }
.seg-hl li b { color: var(--header); }
.seg-foot { font-size: 11px; color: var(--muted); line-height: 1.4; border-top: 1px solid var(--border); padding-top: 10px; margin: 0 0 14px; }
.seg-nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 6px; }
.seg-nav { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-chip { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 5px 10px; font-size: 12px; cursor: pointer; color: var(--text); }
.seg-chip:hover { border-color: var(--accent); }
.seg-chip.active { background: var(--header); color: #fff; border-color: var(--header); }

/* "State of the Bay" report card inside a segment profile */
.rc-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin: 0 0 16px; background: #f7fbfd; }
.rc-head { display: flex; align-items: center; gap: 8px; }
.rc-eyebrow { flex: 1; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.rc-badge { color: #fff; font-size: 11px; font-weight: 800; padding: 3px 10px; border-radius: 999px; letter-spacing: 0.02em; white-space: nowrap; }
.rc-scorerow { display: flex; align-items: baseline; gap: 10px; margin: 8px 0 2px; }
.rc-score { font-size: 30px; font-weight: 800; color: var(--header); line-height: 1; }
.rc-score .rc-max { font-size: 13px; font-weight: 600; color: var(--muted); }
.rc-trend { font-size: 12px; font-weight: 700; }
.rc-trend.rc-up { color: #2e8b57; }
.rc-trend.rc-down { color: #d6392b; }
.rc-trend.rc-flat { color: var(--muted); font-weight: 600; }
.rc-year { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--muted); }
.rc-spark { margin: 6px 0 4px; }
.rc-note { font-size: 11px; color: var(--muted); line-height: 1.4; margin: 2px 0 8px; }
.rc-inds-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 4px; }
.rc-inds { display: flex; flex-wrap: wrap; gap: 5px; }
.rc-ind { font-size: 11px; color: #33454d; background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 3px 9px; cursor: help; }
.rc-src { display: inline-block; margin-top: 10px; font-size: 11px; color: var(--accent); text-decoration: none; }
.rc-src:hover { text-decoration: underline; }

/* Loads / habitat cards inside a segment profile */
.ld-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0 6px; }
.ld-cell { background: #fff; border: 1px solid var(--border); border-radius: 7px; padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.ld-cell b { font-size: 14px; color: var(--header); font-variant-numeric: tabular-nums; }
.ld-cell span { font-size: 10.5px; color: var(--muted); line-height: 1.3; }
.ld-cell.up b { color: #2e8b57; }
.ld-cell.down b { color: #d6392b; }
.ld-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: #e5ecf0; margin: 4px 0 6px; }
.ld-bar span { display: block; height: 100%; }
.ld-keys { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.ld-key { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: #33454d; }
.ld-key i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* Habitat Plan targets card (sidebar) */
.tg-control { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 10px; background: #fdf7f1; }
.tg-control summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--header); }
.tg-control summary::-webkit-details-marker { display: none; }
.tg-control summary .tg-count { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--muted); }
.tg-row { margin-top: 9px; }
.tg-label { display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text); }
.tg-label .tg-obj { color: var(--muted); font-size: 10px; white-space: nowrap; }
.tg-bar { position: relative; height: 8px; border-radius: 4px; background: #e9e2d8; margin: 4px 0 2px; overflow: hidden; }
.tg-bar .done { position: absolute; left: 0; top: 0; bottom: 0; background: #2e8b57; }
.tg-bar .prog { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(45deg, #f0a35e 0 4px, #f7c99a 4px 8px); }
.tg-val { font-size: 10.5px; color: var(--muted); }
.tg-val b { color: var(--text); }
.tg-foot { font-size: 10.5px; color: var(--muted); margin-top: 8px; line-height: 1.35; }
.tg-foot a { color: var(--accent); }

/* Search */
.search-wrap { position: relative; margin: 0 0 10px; }
.search-wrap input { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px 8px 30px; font: inherit; font-size: 13px; }
.search-wrap::before { content: ''; position: absolute; left: 10px; top: 50%; width: 12px; height: 12px; margin-top: -7px; border: 2px solid var(--muted); border-radius: 50%; box-sizing: border-box; }
.search-wrap::after { content: ''; position: absolute; left: 19px; top: 50%; width: 6px; height: 2px; margin-top: 3px; background: var(--muted); transform: rotate(45deg); }
.search-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); max-height: 260px; overflow-y: auto; margin-top: 4px; }
.search-results button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; cursor: pointer; font-size: 13px; border-bottom: 1px solid #f0f4f6; }
.search-results button:hover, .search-results button:focus { background: #f2f7f9; outline: none; }
.search-results .sr-layer { display: block; font-size: 10.5px; color: var(--muted); }
.search-results .sr-empty { padding: 8px 10px; font-size: 12px; color: var(--muted); }

/* About panel */
#about-panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 18px 0 6px; }
#about-panel p { font-size: 13px; line-height: 1.5; margin: 0 0 8px; }
#about-panel ul { padding-left: 18px; margin: 0; font-size: 12.5px; line-height: 1.45; }
#about-panel .src-list { font-size: 12px; }
#about-panel .src { padding: 6px 0; border-top: 1px solid var(--border); }
#about-panel .src-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
#about-panel .src-name { font-weight: 600; color: var(--header); overflow-wrap: anywhere; }
#about-panel .asof { color: var(--muted); font-size: 11px; }
#about-panel .src-layers { color: var(--text, inherit); line-height: 1.4; margin-top: 2px; overflow-wrap: anywhere; }
.mobile-hint { display: none; }
@media (max-width: 760px) {
  .mobile-hint { display: block; position: absolute; top: calc(var(--topbar-h) + 8px); left: 12px; z-index: 12; background: #12242e; color: #fff; font-size: 12px; padding: 7px 10px; border-radius: 8px; box-shadow: var(--shadow); }
  .mobile-hint.hidden { display: none; }
}

/* Class legend for classified layers (choropleth / categories / creek hierarchy) */
.class-legend { list-style: none; margin: -2px 0 2px 40px; padding: 4px 0 2px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.cl-key { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; color: var(--muted); }
.cl-key i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; flex: 0 0 auto; border: 1px solid rgba(0,0,0,0.12); }

#layer-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

/* "Other green areas" toggle nested inside the Recreation & Access group */

/* Collapsible layer groups */
.lgroup { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.lgroup > summary {
  list-style: none; cursor: pointer; padding: 9px 10px;
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; background: #f7fafb;
}
.lgroup > summary::-webkit-details-marker { display: none; }
.lgroup > summary::before {
  content: '▸'; color: var(--muted); font-size: 10px; transition: transform 0.15s;
}
.lgroup[open] > summary::before { transform: rotate(90deg); }
.lgroup .grp-name { flex: 1; }
.lgroup .grp-count { font-size: 11px; color: var(--muted); font-weight: 400; }
.lgroup .grp-master { width: 15px; height: 15px; accent-color: var(--accent); }
.grp-layers { list-style: none; margin: 0; padding: 4px; display: flex; flex-direction: column; gap: 2px; }
.layer-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: 8px; cursor: pointer;
}
.layer-row:hover { background: #f2f7f9; }
.layer-row .swatch { flex: 0 0 18px; height: 18px; display: grid; place-items: center; }
.layer-row .name-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.layer-row .name { font-size: 14px; }
.layer-row .src { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-row .asof { color: #7c8b98; }
.layer-row .note { font-size: 10px; color: #6b7a86; line-height: 1.3; margin-top: 2px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.layer-row .count { font-size: 11px; color: var(--muted); }
.layer-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.layer-row.off .name { color: var(--muted); }

/* Map */
#map { grid-area: map; position: relative; overflow: hidden; }

/* Dynamic on-map legend — mirrors the currently-visible layers */
#map-legend {
  position: absolute;
  right: 10px;
  bottom: 30px; /* clear the attribution control */
  z-index: 5;
  width: 232px;
  max-width: calc(100% - 20px);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: var(--shadow);
  overflow: hidden;
  font-size: 12px;
}
#map-legend .ml-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 0; background: var(--header); color: #fff; cursor: pointer;
  padding: 8px 11px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase; text-align: left;
}
#map-legend .ml-title { flex: 1; }
#map-legend .ml-count {
  font-weight: 600; font-size: 11px; letter-spacing: 0;
  background: rgba(255,255,255,0.22); border-radius: 999px; padding: 1px 7px;
}
#map-legend .ml-caret { font-size: 10px; transition: transform 0.15s; }
#map-legend.collapsed .ml-caret { transform: rotate(-90deg); }
#map-legend.collapsed .ml-body { display: none; }
#map-legend .ml-body {
  padding: 8px 10px; max-height: 42vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 7px;
}
.ml-item { line-height: 1.25; }
.ml-row { display: flex; align-items: center; gap: 8px; }
.ml-row .ml-sw { flex: 0 0 18px; height: 18px; display: grid; place-items: center; }
.ml-row .ml-name { flex: 1; min-width: 0; color: var(--text); }
.ml-item.classified .ml-name { font-weight: 600; }
.ml-classes { display: flex; flex-wrap: wrap; gap: 3px 9px; margin: 3px 0 0 2px; }
.ml-ckey { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--muted); }
.ml-ckey i { width: 11px; height: 11px; border-radius: 2px; flex: 0 0 auto; display: inline-block; border: 1px solid rgba(0,0,0,0.12); }
.ml-src { margin-left: auto; }

/* Print frame — shows the exact area that will be exported */
#print-frame {
  position: absolute;
  border: 2px dashed rgba(18, 36, 46, 0.9);
  box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.28);
  pointer-events: none;
  z-index: 6;
  border-radius: 2px;
}
#print-frame .pf-label {
  position: absolute;
  top: -1px; left: -1px;
  transform: translateY(-100%);
  background: rgba(18, 36, 46, 0.9);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px 4px 4px 0;
  white-space: nowrap;
}
.maplibregl-popup { max-width: 300px !important; font-size: 13px; }
.popup-title { font-weight: 700; margin-bottom: 4px; }
.popup-body { color: #33454d; line-height: 1.4; max-height: 220px; overflow: auto; }
.popup-body a { color: var(--accent); text-decoration: underline; word-break: break-word; }
.popup-body a:hover { color: var(--header); }
.popup-body .pf { display: grid; grid-template-columns: minmax(84px, 38%) 1fr; gap: 0 8px; padding: 3px 0; border-top: 1px solid #edf2f4; }
.popup-body .pf:first-child { border-top: 0; }
.popup-body .pf-k { font-size: 11px; color: var(--muted); }
.popup-body .pf-v { font-size: 12.5px; color: var(--text); word-break: break-word; }
.popup-src { margin-top: 8px; font-size: 10.5px; color: var(--muted); font-style: italic; }
.popup-meta { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 8px; }
.popup-meta > span { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #eef3f5; color: #33454d; display: inline-flex; align-items: center; gap: 5px; }
.popup-meta .pm-type i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 1px rgba(0,0,0,0.18); }
.popup-meta .pm-status { font-weight: 700; }
.popup-meta .pm-completed { background: #e2f0e4; color: #1e6b34; }
.popup-meta .pm-planned { background: #fdeede; color: #a5560c; }

/* Menus & slideovers */
.hidden { display: none !important; }
.menu {
  position: absolute; top: calc(var(--topbar-h) + 6px); right: 16px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 6px; z-index: 40; min-width: 200px;
}
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.menu button:hover { background: #f2f7f9; }
.menu button.active { color: var(--accent); font-weight: 600; }

.slideover {
  position: absolute; top: var(--topbar-h); right: 0; bottom: 0;
  width: 360px; background: #fff; border-left: 1px solid var(--border);
  box-shadow: var(--shadow); z-index: 40; overflow-y: auto; padding: 18px;
}
.slideover.wide { width: 420px; }
.slideover h2 { margin: 0 0 4px; font-size: 16px; }
.slideover .hint { font-size: 12px; color: var(--muted); margin: 0 0 16px; line-height: 1.4; }
.slideover .close { position: absolute; top: 12px; right: 14px; border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--muted); }

/* Form controls */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field input[type=text], .field textarea, .field select, .field input[type=number] {
  width: 100%; border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; font: inherit; font-size: 13px;
}
.field textarea { resize: vertical; min-height: 56px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.inline { display: flex; align-items: center; gap: 8px; }
.inline input[type=color] { width: 36px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: #fff; }
.inline input[type=range] { flex: 1; accent-color: var(--accent); }

.btn {
  border: 0; border-radius: 8px; padding: 9px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; background: var(--accent); color: #fff;
}
.btn.secondary { background: #eef3f5; color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: #c0392b; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

/* Editor accordion */
.acc { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.acc > summary { padding: 10px 12px; cursor: pointer; font-weight: 600; font-size: 13px; list-style: none; display: flex; align-items: center; gap: 8px; }
.acc > summary::-webkit-details-marker { display: none; }
.acc[open] > summary { border-bottom: 1px solid var(--border); background: #f7fafb; }
.acc .acc-body { padding: 12px; }

/* Saved views */
.view-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.view-item .vname { font-weight: 600; font-size: 14px; }
.view-item .vmeta { font-size: 11px; color: var(--muted); margin: 2px 0 8px; }

/* Toast */
.toast {
  position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #12242e; color: #fff; padding: 10px 16px; border-radius: 8px;
  font-size: 13px; z-index: 60; box-shadow: var(--shadow);
}

/* Export panel on phones: a bottom sheet instead of a full-screen slide-over, so the
   print frame stays visible on the map above it. */
@media (max-width: 760px) {
  #export-panel.slideover {
    top: auto; bottom: 0; left: 0; right: 0; width: 100%; max-height: 46vh;
    border-left: 0; border-top: 1px solid var(--border); border-radius: 14px 14px 0 0;
    padding: 12px 16px 16px;
  }
  #export-panel .hint { margin-bottom: 10px; }
  #export-panel .field { margin-bottom: 9px; }
}

@media (max-width: 760px) {
  #app { grid-template-columns: 0 1fr; }
  #sidebar { position: absolute; top: var(--topbar-h); bottom: 0; width: 88%; max-width: 340px; z-index: 30; }
  #app:not(.sidebar-open) #sidebar { display: none; }
  #toolbar .tool span { display: none; }
  #app-subtitle { display: none; }
  /* Icon-only, tighter top bar: all six tools (incl. Edit) fit down to 360 px. */
  #topbar { gap: 8px; padding: 0 8px; }
  #toolbar { gap: 3px; flex-shrink: 0; }
  #toolbar .tool { padding: 7px; }
  #toolbar .tool .appicon-img { width: 18px; height: 18px; }
  #btn-sidebar { padding: 6px 8px; flex-shrink: 0; }
  #app-logo { height: 32px; }
  #app-title { font-size: 15px; }
  .slideover { width: 100%; }
  #map-legend { width: 190px; bottom: 26px; }
  #map-legend .ml-body { max-height: 34vh; }
}
@media (max-width: 420px) {
  #titles { display: none; } /* the logo carries the name; the tools need the room */
}

/* Fallback when a link can't be copied automatically (no Clipboard API off HTTPS) */
.link-box {
  position: absolute; left: 50%; top: calc(var(--topbar-h) + 16px); transform: translateX(-50%);
  width: min(460px, calc(100% - 24px)); z-index: 70; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px;
}
.link-box .lb-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.link-box .hint { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.link-box input { width: 100%; border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; font: inherit; font-size: 13px; }

/* Editor: drag to set draw order */
.acc > summary .drag-handle { cursor: grab; color: var(--muted); font-size: 14px; line-height: 1; letter-spacing: -1px; user-select: none; }
.acc > summary .drag-handle:active { cursor: grabbing; }
.acc.dragging { opacity: 0.45; }
.acc.drop-above { box-shadow: inset 0 3px 0 0 var(--accent); }
.acc.drop-below { box-shadow: inset 0 -3px 0 0 var(--accent); }
