/* ============================================================
   MarinaSecure — application styles
   Light, calm, utilitarian. Palette derived from the wireframe
   set but tinted toward a harbor blue-gray for the real app.
   ============================================================ */

:root {
  --bg: #f3f4f2;
  --panel: #ffffff;
  --line: #d4d7d2;
  --line-lt: #e4e6e2;
  --ink: #23272a;
  --mute: #6d746f;
  --fill: #e9ebe7;

  --accent: #2f5d7c;
  --accent-ink: #ffffff;
  --accent-soft: #e3ecf2;
  --accent-hover: #274e69;

  --good: #4f7a49;
  --good-bg: #e5efe2;
  --warn: #a07a2c;
  --warn-bg: #f3e9d1;
  --bad: #a84f40;
  --bad-bg: #f4e0da;

  --radius: 8px;
  --shadow: 0 1px 2px rgba(30, 40, 45, 0.06), 0 2px 8px rgba(30, 40, 45, 0.04);
  --font:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

  --sidenav-w: 216px;
  --tabbar-h: 58px;
}

/* Dark palette — applied automatically when the system is dark, unless the
   user has explicitly picked Light via the toggle (data-theme="light" then
   wins over the media query); applied unconditionally when the user has
   explicitly picked Dark (data-theme="dark"), regardless of system
   preference. See main.tsx for the pre-paint class/attribute application
   that avoids a flash of the wrong theme, and MorePage for the toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1d1f;
    --panel: #232629;
    --line: #3b4045;
    --line-lt: #2d3134;
    --ink: #e7e9ea;
    --mute: #9aa1a5;
    --fill: #2b2f33;

    --accent: #6fa2c9;
    --accent-ink: #10181e;
    --accent-soft: #223540;
    --accent-hover: #8bb8d8;

    --good: #7ec178;
    --good-bg: #223324;
    --warn: #d3ab5c;
    --warn-bg: #392f1c;
    --bad: #e08b7a;
    --bad-bg: #3a251f;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.28);
  }
}
[data-theme="dark"] {
  --bg: #1a1d1f;
  --panel: #232629;
  --line: #3b4045;
  --line-lt: #2d3134;
  --ink: #e7e9ea;
  --mute: #9aa1a5;
  --fill: #2b2f33;

  --accent: #6fa2c9;
  --accent-ink: #10181e;
  --accent-soft: #223540;
  --accent-hover: #8bb8d8;

  --good: #7ec178;
  --good-bg: #223324;
  --warn: #d3ab5c;
  --warn-bg: #392f1c;
  --bad: #e08b7a;
  --bad-bg: #3a251f;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
}

a {
  color: var(--accent);
}

h1,
h2,
h3 {
  margin: 0;
}

/* ---------- Buttons & inputs ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 16px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover {
  background: var(--fill);
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  background: var(--accent-hover);
}
.btn-danger {
  color: var(--bad);
  border-color: var(--bad);
  background: var(--panel);
}
.btn-danger:hover {
  background: var(--bad-bg);
}
.btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--mute);
}
.btn-quiet:hover {
  background: var(--fill);
  color: var(--ink);
}
.btn-sm {
  padding: 5px 10px;
  font-size: 0.82rem;
  border-radius: 6px;
}
.btn-block {
  width: 100%;
}

/* ---------- Cards ---------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line-lt);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.card-kicker {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.card-title {
  font-size: 1.05rem;
  font-weight: 650;
}
.card-meta {
  color: var(--mute);
  font-size: 0.86rem;
}

/* ---------- Badges ---------- */

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 650;
  border-radius: 999px;
  padding: 2px 9px;
  background: var(--fill);
  color: var(--mute);
}
.badge-good {
  background: var(--good-bg);
  color: var(--good);
}
.badge-warn {
  background: var(--warn-bg);
  color: var(--warn);
}
.badge-bad {
  background: var(--bad-bg);
  color: var(--bad);
}
.badge-accent {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- App shell ---------- */

.shell {
  display: flex;
  min-height: 100%;
}

.sidenav {
  width: var(--sidenav-w);
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--line-lt);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidenav-brand {
  font-weight: 750;
  font-size: 1.02rem;
  padding: 18px 18px 6px;
}
.sidenav-marina {
  color: var(--mute);
  font-size: 0.8rem;
  padding: 0 18px 14px;
  border-bottom: 1px solid var(--line-lt);
}
.sidenav nav {
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
}
.sidenav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.94rem;
}
.sidenav-item:hover {
  background: var(--fill);
}
.sidenav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}
.sidenav-subnav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 2px 0 4px;
}
.sidenav-subitem {
  display: block;
  padding: 6px 10px 6px 26px;
  border-radius: 6px;
  color: var(--mute);
  text-decoration: none;
  font-size: 0.86rem;
}
.sidenav-subitem:hover {
  background: var(--fill);
  color: var(--ink);
}
.sidenav-subitem.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}
.sidenav-footer {
  border-top: 1px solid var(--line-lt);
  padding: 12px 14px;
  font-size: 0.86rem;
}
.sidenav-user {
  font-weight: 650;
  margin-bottom: 2px;
}
.sidenav-roles {
  color: var(--mute);
  font-size: 0.78rem;
  margin-bottom: 8px;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 22px 26px 80px;
  max-width: 1180px;
}

/* Mobile app bar + tab bar */

.appbar {
  display: none;
}

.tabbar {
  display: none;
}

@media (max-width: 899px) {
  .sidenav {
    display: none;
  }
  .main {
    padding: 14px 14px calc(var(--tabbar-h) + 24px);
  }
  .appbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--panel);
    border-bottom: 1px solid var(--line-lt);
    padding: 12px 16px;
    font-weight: 700;
  }
  .tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    background: var(--panel);
    border-top: 1px solid var(--line-lt);
    height: var(--tabbar-h);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.68rem;
    color: var(--mute);
    text-decoration: none;
  }
  .tab.active {
    color: var(--accent);
    font-weight: 650;
  }
  .tab-icon {
    font-size: 1.05rem;
    line-height: 1;
  }
}

/* ---------- Page scaffolding ---------- */

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.page-title {
  font-size: 1.35rem;
  font-weight: 720;
}
.page-sub {
  color: var(--mute);
  font-size: 0.9rem;
}

.grid-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 900px) {
  .grid-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.spread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.muted {
  color: var(--mute);
}
.small {
  font-size: 0.84rem;
}

.divider {
  border: 0;
  border-top: 1px solid var(--line-lt);
  margin: 14px 0;
}

/* ---------- Auth screens ---------- */

.auth-screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  gap: 20px;
}
.auth-brand {
  text-align: center;
}
.auth-brand .marina-name {
  font-size: 1.25rem;
  font-weight: 720;
}
.auth-brand .product {
  color: var(--mute);
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 2px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
}

/* User switch */

.session-list {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.session-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  font: inherit;
  background: var(--panel);
  border: 1px solid var(--line-lt);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  cursor: pointer;
}
.session-item:hover {
  border-color: var(--accent);
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Dashboard ---------- */

.dash-clock {
  font-size: 1.5rem;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
}
.dash-count {
  font-size: 1.5rem;
  font-weight: 720;
}
.card-edit-controls {
  display: flex;
  gap: 4px;
}
.card-hidden {
  opacity: 0.55;
  border-style: dashed;
}

/* ---------- Placeholder pages ---------- */

.placeholder {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  color: var(--mute);
}
.placeholder .big {
  font-size: 1.1rem;
  font-weight: 650;
  color: var(--ink);
  margin-bottom: 6px;
}

/* ---------- Config-missing screen ---------- */

.config-missing {
  max-width: 560px;
  margin: 10vh auto;
  padding: 0 20px;
}
.config-missing code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--fill);
  padding: 1px 5px;
  border-radius: 4px;
}
.config-missing pre {
  background: var(--panel);
  border: 1px solid var(--line-lt);
  border-radius: var(--radius);
  padding: 12px 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.82rem;
}

/* ---------- Chips / filters ---------- */

.chip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.chip {
  font: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--mute);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.chip:hover {
  background: var(--fill);
}
.chip.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Section titles & two-column layout ---------- */

.section-title {
  font-weight: 680;
  font-size: 1rem;
  margin-bottom: 10px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}
@media (min-width: 900px) {
  .grid-2 {
    grid-template-columns: 1.4fr 1fr;
  }
}

/* ---------- Tables ---------- */

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line-lt);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th,
.table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-lt);
  font-size: 0.9rem;
}
.table th {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 650;
  background: var(--fill);
}
.table tbody tr:last-child td {
  border-bottom: none;
}
.table tbody tr:hover {
  background: var(--fill);
}

@media (max-width: 899px) {
  .table-mobile-cards thead {
    display: none;
  }
  .table-mobile-cards,
  .table-mobile-cards tbody,
  .table-mobile-cards tr,
  .table-mobile-cards td {
    display: block;
    width: 100%;
  }
  .table-mobile-cards tr {
    border-bottom: 1px solid var(--line-lt);
    padding: 10px 0;
  }
  .table-mobile-cards td {
    border: none;
    padding: 2px 0;
  }
  .table-mobile-cards td::before {
    content: attr(data-label) ": ";
    font-weight: 650;
    color: var(--mute);
    font-size: 0.78rem;
  }
}

/* ---------- Forms ---------- */

.field {
  margin-bottom: 12px;
}
.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--mute);
  margin-bottom: 4px;
}
.field-value {
  font-size: 0.95rem;
}
.input,
.select,
.textarea {
  width: 100%;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
}
.textarea {
  resize: vertical;
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

/* ---------- Dialogs ---------- */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(30, 40, 45, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.dialog-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line-lt);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  max-height: 90vh;
  overflow-y: auto;
}

/* ---------- Checklist items ---------- */

.card-done {
  border-color: var(--good);
  background: var(--good-bg);
}

/* ---------- Collapsible location tree ---------- */

.tree-row {
  padding: 8px 12px;
}
.tree-match {
  border-color: var(--accent);
  background: var(--accent-soft);
}
/* The whole header row is the control — the chevron only indicates state. */
.tree-head {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}
.tree-head:hover .card-title {
  color: var(--accent);
}
.tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  width: 18px;
  flex-shrink: 0;
  color: var(--mute);
}

.gen-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 160px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--line-lt);
  border-radius: var(--radius);
}

/* ---------- Searchable location picker ---------- */

.picker {
  position: relative;
}
.picker-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.picker-option {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.88rem;
  padding: 7px 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--ink);
}
.picker-option:hover {
  background: var(--fill);
}
.picker-option.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}

/* ---------- Multi-select dialog ---------- */

.multiselect-scroll {
  max-height: 46vh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--line-lt);
  border-radius: var(--radius);
}
.multiselect-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  position: sticky;
  top: 0;
  background: var(--fill);
  border-bottom: 1px solid var(--line-lt);
}
.multiselect-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
}
.multiselect-option:hover {
  background: var(--fill);
}

/* ---------- Drag-to-reorder ---------- */

.reorder-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.reorder-dragging {
  opacity: 0.6;
}
.reorder-handle {
  flex: none;
  padding: 4px 6px;
  font-size: 1rem;
  line-height: 1;
  color: var(--mute);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: grab;
  touch-action: none;
}
.reorder-handle:hover {
  background: var(--fill);
}
.reorder-handle:focus-visible {
  border-color: var(--accent);
  outline: none;
}
.reorder-dragging .reorder-handle {
  cursor: grabbing;
}

/* ---------- Comms ---------- */

.comms-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}
@media (min-width: 900px) {
  .comms-columns {
    grid-template-columns: repeat(3, 1fr);
  }
}

.chat-scroll {
  max-height: 55vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0;
}
.chat-msg {
  max-width: 78%;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--fill);
  align-self: flex-start;
}
.chat-mine {
  align-self: flex-end;
  background: var(--accent-soft);
}
.chat-meta {
  font-size: 0.72rem;
  color: var(--mute);
  margin-bottom: 2px;
}
.chat-body {
  white-space: pre-wrap;
  font-size: 0.92rem;
}
.composer {
  margin-top: 12px;
}
.composer-locked {
  position: relative;
}
.composer-locked .btn {
  position: absolute;
  inset: 0;
  margin: auto;
  width: max-content;
  height: max-content;
}

/* Live-call panel: a right-side panel on desktop, bottom sheet on mobile. */
.call-panel {
  position: fixed;
  z-index: 60;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  overflow-y: auto;
}
@media (min-width: 900px) {
  .call-panel {
    top: 0;
    right: 0;
    width: 340px;
    height: 100vh;
    border-radius: 0;
  }
}
@media (max-width: 899px) {
  .call-panel {
    left: 0;
    right: 0;
    bottom: var(--tabbar-h);
    max-height: 70vh;
    border-radius: var(--radius) var(--radius) 0 0;
  }
}

.missed-badge {
  position: fixed;
  z-index: 55;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--accent-ink);
  background: var(--bad);
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
@media (max-width: 899px) {
  .missed-badge {
    bottom: calc(var(--tabbar-h) + 14px);
  }
}
.missed-badge-count {
  font-size: 0.95rem;
}

/* ---------- Admin: permission matrix ---------- */

.matrix-scroll {
  overflow-x: auto;
}
.matrix-table th:first-child,
.matrix-table td:first-child {
  position: sticky;
  left: 0;
  background: var(--panel);
  z-index: 1;
  min-width: 210px;
}
.matrix-table th:first-child {
  background: var(--fill);
}
.perm-cell {
  font: inherit;
  font-weight: 700;
  width: 34px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--mute);
  cursor: pointer;
}
.perm-cell:hover {
  border-color: var(--accent);
}
.perm-allow {
  background: var(--good-bg);
  border-color: var(--good);
  color: var(--good);
}
.perm-deny {
  background: var(--bad-bg);
  border-color: var(--bad);
  color: var(--bad);
}

/* ---------- Reservations: calendar ---------- */

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--line-lt);
  border: 1px solid var(--line-lt);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-head {
  background: var(--fill);
  font-size: 0.7rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  padding: 6px 8px;
  text-align: center;
}
.cal-cell {
  background: var(--panel);
  min-height: 72px;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
}
.cal-pad {
  background: var(--bg);
}
.cal-day {
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--mute);
}
.cal-chip {
  font: inherit;
  font-size: 0.68rem;
  border: none;
  cursor: pointer;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Weekly table */

.week-scroll {
  overflow-x: auto;
}
.week-table {
  min-width: 760px;
}
.week-table td {
  vertical-align: top;
}
.week-table td:not(:first-child) {
  min-width: 84px;
}

/* ---------- Locations: maps ---------- */

.map-canvas {
  position: relative;
  min-height: 340px;
  background: var(--panel);
  border: 1px solid var(--line-lt);
  border-radius: var(--radius);
  overflow: hidden;
}
.map-image {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
}
.map-schematic {
  min-height: 0;
}
.map-rect {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-weight: 650;
  text-align: center;
  white-space: nowrap;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-rect:hover {
  outline: 2px solid var(--accent);
}
.map-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 650;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  cursor: pointer;
  white-space: nowrap;
}
.map-pin:hover {
  outline: 2px solid var(--accent);
  z-index: 2;
}

/* ---------- Inline controls & collapsible sections ---------- */

.select-inline {
  width: auto;
  font-size: 0.82rem;
  padding: 4px 8px;
}
.section-collapse {
  border: 1px solid var(--line-lt);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 10px 12px;
}
.section-collapse > summary {
  cursor: pointer;
  list-style: none;
  margin-bottom: 0;
}
.section-collapse > summary::-webkit-details-marker {
  display: none;
}
.section-collapse > summary::after {
  content: "▸";
  float: right;
  color: var(--mute);
}
.section-collapse[open] > summary::after {
  content: "▾";
}
