:root {
  --bg: #eef2ef;
  --ink: #14201a;
  --muted: #5d6b63;
  --line: #d5ddd7;
  --panel: #fbfcfb;
  --sidebar: #10231b;
  --sidebar-text: #d7e4dc;
  --accent: #0f7a4e;
  --accent-soft: #d9f0e4;
  --deny: #a33b3b;
  --allow: #0f7a4e;
  --radius: 14px;
  --shadow: 0 18px 40px rgba(16, 35, 27, 0.08);
  --font: "Poppins", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  color: var(--ink);
  font-family: var(--font);
  background:
    radial-gradient(circle at 12% -10%, #d8ebe1 0, transparent 42%),
    linear-gradient(160deg, #f5f7f5, var(--bg));
}

.app-shell {
  --sidebar-width: 260px;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  width: 100%;
  transition: grid-template-columns 220ms ease;
}
.app-shell.sidebar-collapsed {
  --sidebar-width: 0px;
  overflow-x: clip;
}

.sidebar {
  background: linear-gradient(180deg, #143126, var(--sidebar));
  color: var(--sidebar-text);
  padding: 1.4rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  width: 260px;
  z-index: 40;
  overflow: hidden;
  transition: transform 220ms ease, opacity 180ms ease, box-shadow 220ms ease;
}
.app-shell.sidebar-collapsed .sidebar {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

.sidebar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.sidebar-close {
  display: none;
  flex-shrink: 0;
}

.sidebar-backdrop {
  display: none;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: -0.35rem 0 1.15rem;
}
.topbar-title {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}
.topbar-title strong {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
}
.topbar-title span {
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 6px 16px rgba(16, 35, 27, 0.06);
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--accent-soft);
  border-color: #b7d8c7;
}
.icon-btn svg {
  width: 1.15rem;
  height: 1.15rem;
  stroke-width: 2;
}
.sidebar .icon-btn {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-color: rgba(255,255,255,0.14);
  box-shadow: none;
}
.sidebar .icon-btn:hover {
  background: rgba(255,255,255,0.14);
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  text-decoration: none;
  color: #fff;
  padding: 0.35rem 0.5rem;
  min-width: 0;
}
.brand-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
}
.brand-copy {
  min-width: 0;
}
.brand strong { display: block; font-size: 1rem; font-weight: 600; }
.brand small { color: #8eaa9a; font-size: 0.78rem; }

.sidebar nav { display: grid; gap: 0.25rem; }
.sidebar nav a {
  color: var(--sidebar-text);
  text-decoration: none;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
}
.sidebar nav a:hover,
.sidebar nav a.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.sidebar-logout {
  margin-top: auto;
  display: grid;
  gap: 0.6rem;
}
.admin-chip {
  font-size: 0.85rem;
  color: #9bb5a8;
  padding: 0 0.35rem;
}

.page-loader {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 70;
  height: 3px;
  overflow: hidden;
  pointer-events: none;
}
.page-loader[hidden] { display: none; }
.page-loader span {
  display: block;
  height: 100%;
  width: 35%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: page-loader 0.9s ease-in-out infinite;
}
@keyframes page-loader {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(380%); }
}
main.content.is-loading { opacity: 0.62; }
.is-busy { cursor: progress; opacity: 0.6; }
@media (max-width: 960px) {
  .page-loader { left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .page-loader span { animation: none; width: 100%; opacity: 0.85; }
}

.content {
  padding: 1.75rem clamp(1rem, 2.5vw, 2.5rem) 3rem;
  width: 100%;
  max-width: none;
  min-width: 0;
  overflow-x: clip;
}
.auth-content {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--shadow);
}

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}
.page-head h1, h1, h2, h3, h4 {
  font-family: var(--font);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0.15rem 0;
}
.page-head h1 { font-size: clamp(1.8rem, 2.4vw, 2.35rem); font-weight: 700; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0;
  font-weight: 600;
}
.muted { color: var(--muted); }

.btn, button {
  font: inherit;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
  background: var(--ink);
  color: #fff;
  font-weight: 500;
}
.btn.primary, button.primary { background: var(--accent); }
.btn.ghost, button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.sm, button.sm { padding: 0.4rem 0.75rem; font-size: 0.85rem; }
.row-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.4rem;
}
.stats div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}
.stats strong {
  display: block;
  font-size: 1.85rem;
  line-height: 1;
  font-weight: 700;
}
.stats span { color: var(--muted); font-size: 0.88rem; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.2rem;
  min-width: 0;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}
.panel-head a { color: var(--accent); text-decoration: none; font-size: 0.9rem; font-weight: 500; }

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1rem;
}
.grid-2.wide { grid-template-columns: 0.9fr 1.1fr; }
@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .app-shell.sidebar-collapsed {
    --sidebar-width: 0px;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    height: 100vh;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    opacity: 1;
    pointer-events: none;
    box-shadow: none;
  }
  .app-shell.sidebar-collapsed .sidebar {
    transform: translateX(-105%);
    opacity: 1;
  }
  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
    pointer-events: auto;
    box-shadow: 18px 0 40px rgba(0, 0, 0, 0.28);
  }
  .sidebar-close { display: inline-grid; }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(10, 18, 14, 0.45);
    backdrop-filter: blur(2px);
    border: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
  }
  .app-shell.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .app-shell.sidebar-open {
    overflow: hidden;
  }
  .grid-2, .grid-2.wide, .map-layout, .onboard-layout { grid-template-columns: 1fr; }
  .content { padding-top: 1.1rem; }
  .topbar { margin-bottom: 1rem; position: sticky; top: 0; z-index: 20; padding: 0.35rem 0; background: linear-gradient(180deg, rgba(247,250,248,0.96), rgba(247,250,248,0.88)); backdrop-filter: blur(8px); }
}

@media (min-width: 961px) {
  .topbar-title { display: none; }
  .sidebar-backdrop { display: none !important; }
}

.list-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.list-cards a {
  display: grid;
  gap: 0.15rem;
  text-decoration: none;
  color: inherit;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: #f3f6f4;
}
.list-cards span, .list-cards em { color: var(--muted); font-size: 0.86rem; font-style: normal; }

.house-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  width: 100%;
}
.house-grid.full {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
.house-card {
  display: grid;
  gap: 0.7rem;
  padding: 1.2rem;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 160ms ease, border-color 160ms ease;
  min-height: 210px;
}
.house-card.static { cursor: default; }
.house-card.static:hover { transform: none; }
.house-card.inactive { opacity: 0.65; }
.house-card-top { display: flex; justify-content: space-between; gap: 0.5rem; }
.house-card h3 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.house-card > p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.house-card .type-line {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0;
}
.house-card-foot {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
  font-size: 0.82rem;
  color: var(--muted);
}
.pill {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  height: fit-content;
  white-space: nowrap;
}
.flat-preview { display: grid; gap: 0.4rem; }
.flat-chip {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  background: #f3f6f4;
  font-size: 0.84rem;
}
.flat-chip.more, .flat-chip.muted-chip { color: var(--muted); }
.meta { font-size: 0.78rem; color: var(--accent); font-weight: 500; }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.5);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}
.form-grid.tight { margin-top: 0.85rem; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.onboard-layout label,
form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
  font-weight: 500;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font: inherit;
  background: #fff;
  font-weight: 400;
}
textarea { resize: vertical; }
.check { display: flex !important; align-items: center; gap: 0.5rem; font-weight: 500; }
.check input { width: auto; }

.contact-slot {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  margin-top: 0.5rem;
}
.contact-slot h3, .contact-slot h4 { font-size: 0.95rem; margin-bottom: 0.75rem; }
.contact-mini { margin-bottom: 0.75rem; }
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.65rem 0 0;
}
.panel.stack-form > .btn,
.panel.stack-form > button[type="submit"],
.stack-form > .btn,
.stack-form > button[type="submit"] {
  align-self: flex-end;
  width: auto;
  min-width: 7.5rem;
  margin-top: 0.5rem;
  justify-content: center;
}
.auth-card .stack-form > .btn,
.auth-card .stack-form > button[type="submit"] {
  align-self: stretch;
  width: 100%;
  margin-top: 0.35rem;
}
.nested { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.add-flat { margin-top: 1.5rem; padding: 1rem; background: #f3f6f4; border-radius: 12px; border-top: 0; }
.mt { margin-top: 1.4rem; }

.flat-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: #fff;
}
.flat-block-head { margin-bottom: 0.75rem; }
.flat-block h3 { font-size: 1.05rem; }

.resident-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.resident-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  border-radius: 12px;
  background: #f3f6f4;
}
.resident-list div { display: grid; gap: 0.15rem; }
.resident-list span, .resident-list small { color: var(--muted); font-size: 0.86rem; font-weight: 400; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
th, td {
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; background: #f4f7f5; }
table.compact th, table.compact td { padding: 0.55rem 0.65rem; font-size: 0.86rem; }
.allowed { color: var(--allow); font-weight: 700; }
.denied { color: var(--deny); font-weight: 700; }
a { color: var(--accent); }

.flash {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid #b7dfc8;
  margin-bottom: 1rem;
}
.flash.error { background: #f8e8e8; border-color: #e3b6b6; color: var(--deny); }

.map-frame {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: clamp(200px, 40vw, 280px);
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #dfe8e2;
  position: relative;
  z-index: 0;
}
.map-frame.tall {
  height: clamp(240px, 52vw, 420px);
}
.map-frame.hero {
  height: clamp(240px, 58vh, 640px);
  min-height: 220px;
}
.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.8fr);
  gap: 1rem;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
}
.map-side {
  max-height: min(70vh, 640px);
  overflow: auto;
  min-width: 0;
}
.map-teaser .map-frame {
  height: clamp(180px, 36vw, 240px);
}
.map-frame .leaflet-container {
  width: 100% !important;
  height: 100% !important;
  font: inherit;
  background: #dfe8e2;
}
/* App styles must not constrain Leaflet tile/marker images */
.leaflet-container img.leaflet-tile,
.leaflet-container img.leaflet-marker-icon,
.leaflet-container img.leaflet-marker-shadow {
  max-width: none !important;
  max-height: none !important;
}
.map-frame .leaflet-control-container .leaflet-control {
  margin: 8px;
}
@media (max-width: 960px) {
  .map-layout {
    grid-template-columns: 1fr;
  }
  .map-side {
    max-height: none;
  }
  .map-frame {
    height: clamp(220px, 48vw, 320px);
  }
  .map-frame.tall {
    height: clamp(250px, 62vw, 380px);
  }
  .map-frame.hero {
    height: min(52vh, 460px);
    min-height: 220px;
  }
  .map-frame .leaflet-control-zoom a {
    width: 34px !important;
    height: 34px !important;
    line-height: 34px !important;
    font-size: 18px !important;
  }
}
@media (max-width: 560px) {
  .map-frame,
  .map-frame.tall {
    height: min(48vh, 340px);
    border-radius: 12px;
  }
  .map-frame.hero {
    height: min(48vh, 380px);
  }
  .content {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

.filter-bar { margin-bottom: 1.25rem; }
.filters-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 0.75rem;
}
.table-wrap { width: 100%; overflow-x: auto; }
table.clickable-rows tbody tr.row-link { cursor: pointer; }
table.clickable-rows tbody tr.row-link:hover { background: #f0f6f2; }
.link-cell a { font-weight: 500; text-decoration: none; }
.status-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.status-pill.allowed { background: var(--accent-soft); color: var(--allow); }
.status-pill.denied { background: #f8e8e8; color: var(--deny); }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  width: 100%;
}
@media (max-width: 900px) {
  .detail-grid { grid-template-columns: 1fr; }
}
.detail-list { margin: 0; display: grid; gap: 0.85rem; }
.detail-list > div { display: grid; gap: 0.2rem; }
.detail-list dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
.detail-list dd { margin: 0; font-size: 0.98rem; }
.detail-list small { display: block; margin-top: 0.2rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; word-break: break-all; }
.inline-panel { margin-bottom: 1.2rem; }
.onboard-layout { width: 100%; max-width: none; }

.sidebar-logout button,
.logout button {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.18);
  color: #d7e4dc;
}

/* Design refresh */
:root {
  --warn: #9a6b12;
  --warn-soft: #f7ecd2;
  --danger: #9b2c2c;
  --danger-soft: #f8e4e4;
  --surface-2: #f4f8f5;
}

body {
  background:
    radial-gradient(ellipse 80% 50% at 100% -10%, rgba(15, 122, 78, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 40% at 0% 100%, rgba(20, 50, 40, 0.08), transparent 50%),
    linear-gradient(165deg, #f7faf8 0%, #eef3ef 48%, #e8eee9 100%);
}

.sidebar {
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.06);
}

.sidebar nav a.active {
  background: linear-gradient(90deg, rgba(15, 122, 78, 0.35), rgba(255,255,255,0.06));
  box-shadow: inset 3px 0 0 var(--accent);
}

.panel, .house-card, .point-card, .auth-card, table {
  backdrop-filter: blur(8px);
}

.btn.warn, button.warn {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid #e5d3a0;
}
.btn.danger, button.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid #e8b8b8;
}
.row-actions.wrap { flex-wrap: wrap; }

.point-card {
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.point-media {
  position: relative;
  height: 160px;
  background: var(--surface-2);
}
.point-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.point-placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, #d7ebe0, #c5d9ce);
  color: var(--accent);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.08em;
}
.point-code {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}
.point-body { padding: 1rem 1.1rem 1.15rem; display: grid; gap: 0.55rem; }
.point-body h3 { margin: 0; font-size: 1.1rem; }
.point-body > p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.mt-sm { margin-top: 0.5rem; }

.tenant-row {
  align-items: flex-start !important;
}
.tenant-row.status-paused {
  border-left: 3px solid var(--warn);
}
.tenant-row .status-pill {
  margin-left: 0.35rem;
  vertical-align: middle;
}

.page-head h1 {
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.house-card {
  border-radius: 18px;
}
.stats div {
  border-radius: 16px;
  transition: transform 160ms ease;
}
.stats div:hover { transform: translateY(-2px); }

/* Icons */
.sidebar nav a,
.sidebar-logout button,
.btn,
.panel-head a,
.panel-head h2,
.admin-chip,
.flash,
.page-head h1 {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.sidebar nav a {
  display: flex;
  width: 100%;
}
.sidebar nav a svg,
.btn svg,
.panel-head h2 svg,
.panel-head a svg,
.title-icon,
.inline-ico,
.flash svg,
.stat-icon svg,
.auth-badge svg,
.brand-mark svg,
.admin-chip svg,
.sidebar-logout button svg {
  width: 1.05rem;
  height: 1.05rem;
  stroke-width: 2;
  flex-shrink: 0;
}
.title-icon {
  width: 1.35rem;
  height: 1.35rem;
  color: var(--accent);
  margin-right: 0.15rem;
}
.brand-mark {
  color: #fff;
}
.brand-mark svg {
  width: 1.15rem;
  height: 1.15rem;
}
.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 0.55rem;
}
.stats div {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.inline-ico {
  width: 0.95rem;
  height: 0.95rem;
  vertical-align: -0.15rem;
  display: inline;
  margin-right: 0.15rem;
}
.panel-head h2 {
  display: inline-flex;
  gap: 0.4rem;
}
.panel-head.tight { margin-bottom: 0.75rem; }
.auth-badge {
  width: 3rem;
  height: 3rem;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 0.85rem;
}
.auth-badge svg {
  width: 1.4rem;
  height: 1.4rem;
}
.flash {
  display: flex;
  gap: 0.45rem;
}

.field-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.45rem;
}

.dropzone {
  position: relative;
  border-radius: 16px;
  cursor: pointer;
}
.dropzone-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
}
.dropzone-surface {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1rem;
  align-items: center;
  min-height: 120px;
  padding: 0.85rem;
  border: 1.5px dashed #b7cfc2;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.9), rgba(243,248,245,0.95));
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.dropzone:hover .dropzone-surface,
.dropzone.is-dragover .dropzone-surface {
  border-color: var(--accent);
  background: #eef8f2;
  box-shadow: 0 0 0 4px rgba(15, 122, 78, 0.08);
}
.dropzone.is-dragover .dropzone-surface {
  border-style: solid;
}
.dropzone-preview {
  width: 120px;
  height: 96px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, #dceade, #cfe0d6);
  background-size: cover;
  background-position: center;
  position: relative;
  overflow: hidden;
}
.dropzone-preview.has-image {
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}
.dropzone-copy {
  display: grid;
  gap: 0.2rem;
  position: relative;
  z-index: 3;
  pointer-events: none;
}
.dropzone-icon {
  color: var(--accent);
  display: flex;
  margin-bottom: 0.15rem;
}
.dropzone-title {
  margin: 0;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
}
.dropzone-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}
.dropzone-btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin-top: 0.45rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
}
.dropzone-filename {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
  word-break: break-all;
}
@media (max-width: 640px) {
  .dropzone-surface {
    grid-template-columns: 1fr;
  }
  .dropzone-preview {
    width: 100%;
    height: 120px;
  }
}

.zone-section {
  margin-bottom: 1.75rem;
}
.zone-section-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}
.zone-section-head h2 {
  margin: 0;
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.zone-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-right: 0.25rem;
}
.house-card .type-line {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.map-side .zone-pill {
  margin: 0.2rem 0;
}
.map-geocode-status {
  margin: 0.55rem 0 0.75rem;
  font-size: 0.86rem;
  min-height: 1.2em;
}
.map-geocode-status.error {
  color: var(--deny);
}
.map-search {
  position: relative;
  margin: 0 0 0.85rem;
  z-index: 5;
}
.map-search-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}
.map-search-box {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.35rem 0.65rem;
  box-shadow: 0 8px 18px rgba(16, 35, 27, 0.05);
}
.map-search-ico {
  width: 1rem;
  height: 1rem;
  color: var(--muted);
  flex-shrink: 0;
}
.map-search-input {
  border: 0 !important;
  box-shadow: none !important;
  padding: 0.55rem 0.15rem !important;
  width: 100%;
  background: transparent !important;
}
.map-search-input:focus {
  outline: none;
}
.map-search-clear {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  padding: 0.2rem 0.35rem;
  cursor: pointer;
  border-radius: 8px;
}
.map-search-clear:hover {
  background: var(--accent-soft);
  color: var(--ink);
}
.map-search-results {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0.35rem;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 240px;
  overflow: auto;
  z-index: 20;
}
.map-search-item {
  padding: 0.7rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.35;
}
.map-search-item:hover,
.map-search-item.is-active {
  background: var(--accent-soft);
}
.map-search-empty {
  padding: 0.75rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.analytics .page-head h1 { letter-spacing: -0.03em; }
.analytics.is-loading { opacity: 0.45; pointer-events: none; }
.range-picker { position: relative; }
.range-picker summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.55rem 0.75rem 0.55rem 0.85rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  min-width: 220px;
}
.range-picker summary::-webkit-details-marker { display: none; }
.range-picker summary > span { display: grid; line-height: 1.15; flex: 1; }
.range-picker summary strong { font-size: 0.92rem; font-weight: 600; }
.range-picker summary small { color: var(--muted); font-size: 0.75rem; }
.range-picker summary .chev { color: var(--muted); width: 16px; height: 16px; transition: transform 160ms ease; }
.range-picker[open] summary .chev { transform: rotate(180deg); }
.range-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  z-index: 30;
  width: min(360px, calc(100vw - 2rem));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 0.85rem;
}
.range-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.range-presets a,
.range-presets span {
  text-decoration: none;
  text-align: center;
  border-radius: 12px;
  padding: 0.55rem 0.4rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
  background: #f3f6f4;
}
.range-presets a.on,
.range-presets span.on { background: var(--sidebar); color: #f4faf6; }
.range-custom {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  align-items: end;
  margin-top: 0.75rem;
}
.range-custom label { display: grid; gap: 0.28rem; font-size: 0.72rem; font-weight: 600; color: var(--muted); }
.range-custom input[type="date"] {
  font: inherit;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.48rem 0.55rem;
  background: #fff;
  width: 100%;
}
.range-panel > .muted { margin: 0.65rem 0 0; font-size: 0.75rem; }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.05rem 1.15rem 1.1rem;
  box-shadow: var(--shadow);
}
.metric .k {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.metric strong {
  display: block;
  font-size: 2.15rem;
  line-height: 1;
  letter-spacing: -0.04em;
}
.metric p:last-child { margin: 0.45rem 0 0; color: var(--muted); font-size: 0.82rem; }
.metric-deny strong { color: var(--deny); }
.chart-panel { padding-bottom: 0.8rem; }
.chart-panel .panel-head { align-items: flex-end; }
.chart-panel .panel-head h2 { margin: 0; }
.chart-panel .panel-head .muted { margin: 0.2rem 0 0; }
.chart-scroll { overflow-x: auto; padding-bottom: 0.2rem; }
.col-chart {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  height: 240px;
  min-width: calc(var(--cols) * 2.15rem);
  border-bottom: 1px solid var(--line);
  padding: 0 0.2rem;
}
.col { flex: 1 0 1.6rem; min-width: 1.6rem; display: flex; flex-direction: column; align-items: center; height: 100%; }
.col-plot {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
}
.vbar { width: 42%; border-radius: 5px 5px 0 0; min-height: 0; }
.vbar.invite { background: #8aa396; }
.vbar.checks { display: flex; flex-direction: column; justify-content: flex-end; background: transparent; }
.vbar.checks .allow, .vbar.checks .deny { display: block; width: 100%; }
.vbar.checks .allow { background: var(--accent); }
.vbar.checks .deny { background: var(--deny); }
.col-label {
  height: 1.35rem;
  margin-top: 0.35rem;
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}
.bar-legend { display: flex; gap: 0.9rem; margin: 0; font-size: 0.78rem; color: var(--muted); }
.bar-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.swatch { width: 0.55rem; height: 0.55rem; border-radius: 2px; display: inline-block; }
.swatch.invite { background: #8aa396; }
.swatch.allow { background: var(--accent); }
.swatch.deny { background: var(--deny); }
.insight-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 0.9rem;
}
.purpose-layout { display: flex; gap: 1.25rem; align-items: center; }
.donut {
  width: 148px;
  height: 148px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.donut span {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--panel);
  display: grid;
  place-items: center;
  text-align: center;
}
.donut strong { display: block; font-size: 1.45rem; letter-spacing: -0.03em; line-height: 1; }
.donut small { color: var(--muted); font-size: 0.72rem; }
.legend { list-style: none; margin: 0; padding: 0; flex: 1; display: grid; gap: 0.55rem; }
.legend li { display: grid; grid-template-columns: 0.6rem 1fr auto auto; gap: 0.55rem; align-items: center; font-size: 0.9rem; }
.legend i { width: 0.55rem; height: 0.55rem; border-radius: 2px; }
.legend em { color: var(--muted); font-style: normal; font-size: 0.8rem; min-width: 2.2rem; text-align: right; }
.rank, .rank-list, .gate-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.85rem; }
.rank li { display: grid; grid-template-columns: 1.6rem 1fr; gap: 0.65rem; align-items: center; }
.rank-n {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
}
.rank-top { display: flex; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.28rem; font-size: 0.92rem; }
.rank-top span, .gate-meta { color: var(--muted); }
.gate-meta { margin: 0.28rem 0 0; font-size: 0.78rem; }
.bar-track { height: 7px; background: #e7eeea; border-radius: 99px; overflow: hidden; display: flex; }
.bar-fill { height: 100%; background: var(--accent); }
.bar-fill.deny { background: var(--deny); }
@media (max-width: 980px) {
  .metric-grid, .insight-grid { grid-template-columns: 1fr 1fr; }
  .purpose-layout { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 640px) {
  .metric-grid, .insight-grid { grid-template-columns: 1fr; }
  .analytics .page-head { flex-wrap: wrap; }
  .range-picker, .range-picker summary { width: 100%; }
  .range-panel { left: 0; right: 0; width: auto; }
  .range-custom { grid-template-columns: 1fr 1fr; }
  .range-custom button { grid-column: 1 / -1; }
}
