:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #66736c;
  --paper: #f4f1e8;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --line: #d9ddd5;
  --line-strong: #bcc8bf;
  --forest: #174c3c;
  --forest-dark: #0d362a;
  --sage: #dce8dc;
  --mint: #edf5ed;
  --gold: #d39b42;
  --danger: #a53939;
  --shadow: 0 18px 50px rgba(26, 52, 40, 0.12);
  --radius: 16px;
  --font-sans: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.55;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(23, 76, 60, 0.3);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

code {
  border: 1px solid #d5ddd4;
  background: #f3f7f2;
  padding: 1px 5px;
  color: var(--forest-dark);
  font-family: Consolas, monospace;
  font-size: 0.9em;
}

.login-view {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(390px, 0.8fr) minmax(520px, 1.2fr);
  background: var(--surface);
}

.login-card {
  display: flex;
  width: min(100%, 560px);
  flex-direction: column;
  justify-content: center;
  padding: clamp(32px, 6vw, 82px);
  justify-self: end;
}

.eyebrow-row,
.header-actions,
.map-bottom-bar,
.register-actions,
.dialog-header,
.dialog-actions,
.dialog-actions > div,
.user-chip,
.staff-legend__item,
.current-users__item,
.check-row {
  display: flex;
  align-items: center;
}

.eyebrow-row {
  gap: 12px;
}

.eyebrow {
  color: var(--forest);
  font-size: 0.71rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid currentColor;
  padding: 2px 8px;
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.status-badge--test {
  border-color: #d6ad6c;
  background: #fff4dc;
  color: #7b5217;
}

.login-card h1 {
  margin: 14px 0 8px;
  font-size: clamp(2rem, 5vw, 3.1rem);
  letter-spacing: -0.045em;
  line-height: 1.12;
}

.lead {
  max-width: 34rem;
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 1rem;
}

.stack {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 7px;
}

.field > span,
.field-label {
  color: #34463e;
  font-size: 0.82rem;
  font-weight: 750;
}

.field small {
  color: var(--muted);
  font-size: 0.75rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface-strong);
  padding: 10px 12px;
  color: var(--ink);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: #83978c;
}

.field--compact {
  margin-top: 17px;
}

.field--compact input,
.field--compact select {
  min-height: 44px;
  background: #fff;
}

.date-range-filter {
  margin: 17px 0 0;
  border: 0;
  padding: 0;
}

.date-range-filter legend {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.date-range-filter__fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 6px;
}

.date-range-filter__fields label {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.date-range-filter__fields label span {
  color: var(--muted);
  font-size: 0.7rem;
}

.date-range-filter__fields input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border-color: #dadce0;
  border-radius: 4px;
  background: #fff;
  padding-inline: 7px;
  font-size: 0.73rem;
}

.date-range-filter__separator {
  padding-bottom: 12px;
  color: var(--muted);
  font-size: 0.8rem;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 14px;
  font-weight: 760;
  text-decoration: none;
  transition: transform 100ms ease, background 120ms ease, border-color 120ms ease;
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button--primary {
  background: var(--forest);
  color: white;
}

.button--primary:hover {
  background: var(--forest-dark);
}

.button--danger {
  background: #b3261e;
  color: white;
}

.button--danger:hover {
  background: #8f1d17;
}

.button--outline {
  border-color: var(--line-strong);
  background: white;
  color: var(--ink);
}

.button--outline:hover,
.button--quiet:hover {
  background: var(--mint);
}

.button--quiet {
  background: var(--sage);
  color: var(--forest-dark);
}

.button--large {
  min-height: 52px;
  padding-inline: 22px;
  font-size: 0.98rem;
}

.button--full {
  width: 100%;
}

.text-button {
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--forest);
  font-size: 0.8rem;
  font-weight: 760;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.form-error {
  min-height: 1.25em;
  margin: 0;
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 700;
}

.test-note {
  margin-top: 24px;
  border-left: 4px solid var(--gold);
  background: #fff7e8;
  padding: 14px 16px;
  font-size: 0.82rem;
}

.test-note p,
.security-note {
  margin: 4px 0 0;
  color: #66583f;
}

.test-note--compact {
  margin-top: 18px;
  padding: 11px 12px;
  font-size: 0.75rem;
}

.security-note {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.75rem;
}

.login-scene {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #dbe9df;
}

.scene-grid {
  position: absolute;
  inset: 0;
  opacity: 0.56;
  background-image:
    linear-gradient(rgba(36, 90, 68, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36, 90, 68, 0.07) 1px, transparent 1px);
  background-size: 58px 58px;
  transform: rotate(-8deg) scale(1.16);
}

.scene-road {
  position: absolute;
  border: 18px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
}

.scene-road::after {
  position: absolute;
  inset: -7px;
  border: 1px dashed rgba(111, 133, 119, 0.6);
  border-radius: inherit;
  content: "";
}

.scene-road--one {
  width: 820px;
  height: 470px;
  right: -180px;
  top: 12%;
  transform: rotate(20deg);
}

.scene-road--two {
  width: 640px;
  height: 760px;
  left: -250px;
  bottom: -250px;
  transform: rotate(-14deg);
}

.scene-pin {
  position: absolute;
  width: 31px;
  height: 31px;
  border: 7px solid white;
  border-radius: 50% 50% 50% 8px;
  filter: drop-shadow(0 8px 10px rgba(15, 45, 33, 0.25));
  transform: rotate(-45deg);
}

.scene-pin--blue {
  top: 25%;
  left: 28%;
  background: #2563eb;
}

.scene-pin--green {
  right: 24%;
  bottom: 31%;
  background: #059669;
}

.scene-pin--orange {
  right: 39%;
  top: 43%;
  background: #ea580c;
}

.scene-copy {
  position: absolute;
  right: clamp(30px, 7vw, 100px);
  bottom: clamp(42px, 9vh, 110px);
  display: grid;
  max-width: 470px;
  color: var(--forest-dark);
  font-size: clamp(1.25rem, 2.6vw, 2.4rem);
  letter-spacing: -0.03em;
}

.scene-copy strong {
  font-size: 1.32em;
}

.app-view {
  position: relative;
  height: 100dvh;
  min-height: 520px;
  overflow: hidden;
  background: #e5e3df;
  color: #202124;
  font-family: Arial, "Noto Sans JP", "Yu Gothic UI", sans-serif;
}

.app-header {
  position: absolute;
  z-index: 42;
  top: 12px;
  right: 12px;
  left: 12px;
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
}

.header-actions {
  gap: 8px;
  border: 1px solid rgba(60, 64, 67, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.97);
  padding: 5px 7px;
  box-shadow: 0 1px 6px rgba(60, 64, 67, 0.26);
  pointer-events: auto;
}

.user-chip {
  min-height: 42px;
  gap: 8px;
  border: 0;
  background: transparent;
  padding: 6px 9px;
  font-weight: 760;
}

.user-dot,
.legend-dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border: 2px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(23, 33, 29, 0.2);
}

.app-body {
  position: relative;
  height: 100dvh;
  min-height: 520px;
  overflow: hidden;
}

.filter-panel {
  position: absolute;
  z-index: 30;
  top: 78px;
  bottom: 16px;
  left: 16px;
  width: 300px;
  overflow: auto;
  border: 1px solid rgba(60, 64, 67, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  padding: 20px 18px;
  box-shadow: 0 2px 9px rgba(60, 64, 67, 0.28);
  transition: opacity 160ms ease, transform 180ms ease, visibility 180ms ease;
}

.filter-panel[data-open="false"] {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(-100% - 30px));
}

.sidebar-toggle {
  position: absolute;
  z-index: 44;
  top: 12px;
  left: 12px;
  min-height: 48px;
  border-radius: 6px;
  box-shadow: 0 1px 6px rgba(60, 64, 67, 0.3);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-heading h2 {
  margin: 3px 0 0;
  letter-spacing: -0.025em;
}

.panel-heading h2 {
  font-size: 1.12rem;
}

.panel-clear {
  margin-top: 9px;
  padding-inline: 0;
}

.filter-panel .field input,
.filter-panel .field select {
  border-color: #dadce0;
  border-radius: 4px;
}

.filter-summary {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 22px 0 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  color: var(--muted);
  font-size: 0.77rem;
}

.filter-summary strong {
  color: var(--forest);
  font-size: 1.75rem;
  line-height: 1;
}

.legend-block {
  margin-top: 12px;
}

.staff-legend {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.staff-legend__item {
  gap: 9px;
  color: #4b5a53;
  font-size: 0.78rem;
}

.staff-legend__item small {
  margin-left: auto;
  color: #8a938e;
}

.panel-actions {
  display: grid;
  gap: 9px;
  margin-top: 22px;
}

.map-section {
  position: absolute;
  inset: 0;
  min-width: 0;
}

.map-surface {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid #b9cabd;
  border-radius: var(--radius);
  background-color: #e5e3df;
  background-image:
    linear-gradient(rgba(37, 82, 61, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 82, 61, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  box-shadow: inset 0 0 80px rgba(44, 89, 67, 0.06);
}

.map-section > .map-surface {
  position: absolute;
  inset: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  cursor: grab;
  background-image: none;
  touch-action: none;
  user-select: none;
}

.map-section > .map-surface.is-dragging {
  cursor: grabbing;
}

.map-section > .map-surface.is-placement {
  cursor: crosshair;
}

.google-map-canvas,
.position-fallback-map {
  position: absolute;
  inset: 0;
}

.google-map-canvas {
  z-index: 0;
  background: #e5e3df;
}

.map-surface.has-google-map {
  cursor: default;
  touch-action: auto;
}

.map-surface.has-google-map.is-placement {
  cursor: crosshair;
}

.map-surface.has-google-map .map-content,
.map-surface.has-google-map .position-fallback-map,
.map-surface.has-google-map .map-attribution {
  display: none;
}

.map-surface.has-google-map .google-map-canvas {
  display: block !important;
}

.google-current-location {
  width: 20px;
  height: 20px;
  border: 4px solid white;
  border-radius: 50%;
  background: #1a73e8;
  box-shadow: 0 0 0 9px rgba(26, 115, 232, 0.2), 0 3px 10px rgba(26, 115, 232, 0.45);
}

.map-content {
  --map-pin-scale: 1;
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(60, 64, 67, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(60, 64, 67, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  transform-origin: 50% 50%;
  will-change: transform;
}

.map-water {
  position: absolute;
  top: -12%;
  right: -8%;
  width: 27%;
  height: 128%;
  background: #c9e6f0;
  transform: rotate(3deg);
}

.map-water::before {
  position: absolute;
  top: 0;
  left: -18px;
  width: 27px;
  height: 100%;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.55) 0 11px, transparent 11px 22px);
  content: "";
}

.map-green {
  position: absolute;
  background: #d3e4cd;
  opacity: 0.72;
}

.map-green--one {
  top: -13%;
  left: -8%;
  width: 41%;
  height: 55%;
  border-radius: 44% 56% 48% 52%;
  transform: rotate(-11deg);
}

.map-green--two {
  bottom: -20%;
  left: 28%;
  width: 38%;
  height: 48%;
  border-radius: 55% 45% 52% 48%;
  transform: rotate(9deg);
}

.map-road {
  position: absolute;
  z-index: 1;
  border: 6px solid white;
  opacity: 0.95;
  box-shadow: 0 0 0 1px #ccd3ca;
}

.map-road::after {
  position: absolute;
  inset: -1px;
  border: 0;
  content: "";
}

.map-road--a {
  top: -24%;
  left: 43%;
  width: 18%;
  height: 150%;
  border-radius: 50%;
  transform: rotate(12deg);
}

.map-road--b {
  top: 48%;
  left: -15%;
  width: 118%;
  height: 20%;
  border-radius: 50%;
  transform: rotate(-8deg);
}

.map-road--c {
  top: 9%;
  left: -14%;
  width: 80%;
  height: 18%;
  border-radius: 50%;
  transform: rotate(16deg);
}

.map-road--d {
  top: 23%;
  right: 14%;
  width: 25%;
  height: 82%;
  border-radius: 50%;
  transform: rotate(-17deg);
}

.map-label {
  position: absolute;
  z-index: 2;
  padding: 2px 5px;
  background: transparent;
  color: #5f6368;
  font-size: clamp(0.66rem, 1.3vw, 0.78rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 0 white, 1px 0 0 white, 0 -1px 0 white, -1px 0 0 white;
}

.map-label--hyuga {
  top: 39%;
  left: 52%;
  color: #243f33;
  font-size: 0.95rem;
}

.map-label--zaikoji {
  left: 56%;
  bottom: 18%;
}

.map-label--hichiya {
  top: 24%;
  right: 19%;
}

.map-label--togo {
  top: 41%;
  left: 10%;
}

.marker-layer {
  position: absolute;
  z-index: 5;
  inset: 0;
  pointer-events: none;
}

.map-pin {
  position: absolute;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 4px solid white;
  border-radius: 50% 50% 50% 7px;
  color: white;
  filter: drop-shadow(0 5px 6px rgba(20, 46, 34, 0.28));
  font-size: 0.62rem;
  font-weight: 900;
  pointer-events: auto;
  transform: translate(-50%, -100%) rotate(-45deg) scale(var(--map-pin-scale));
  transition: width 120ms ease, height 120ms ease, filter 120ms ease;
}

.map-pin span {
  transform: rotate(45deg);
}

.map-pin--important span {
  font-size: 1rem;
  line-height: 1;
}

.map-pin:hover,
.map-pin:focus-visible {
  width: 40px;
  height: 40px;
  z-index: 8;
  filter: drop-shadow(0 8px 10px rgba(20, 46, 34, 0.38));
}

.map-pin::after {
  position: absolute;
  top: 43px;
  left: 50%;
  display: none;
  min-width: max-content;
  max-width: 190px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  padding: 5px 8px;
  color: var(--ink);
  content: attr(data-label);
  font-size: 0.68rem;
  font-weight: 700;
  transform: translateX(-50%) rotate(45deg);
}

.map-pin:hover::after,
.map-pin:focus-visible::after {
  display: block;
}

.google-marker-cluster,
.map-cluster {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 4px solid white;
  border-radius: 50%;
  background: var(--cluster-background, #1a73e8);
  box-shadow: 0 5px 12px rgba(20, 46, 34, 0.34);
  color: white;
  font-size: 0.75rem;
  font-weight: 900;
}

.google-marker-cluster {
  position: relative;
}

.google-marker-cluster__count {
  display: grid;
  min-width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 50%;
  background: rgba(31, 41, 55, 0.72);
  padding: 0 4px;
}

.google-marker-cluster__important {
  position: absolute;
  top: -9px;
  right: -8px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 2px solid white;
  border-radius: 50%;
  background: #b3261e;
  color: white;
  font-size: 0.78rem;
}

.map-cluster {
  position: absolute;
  z-index: 7;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(var(--map-pin-scale));
}

.current-location {
  position: absolute;
  z-index: 4;
  width: 18px;
  height: 18px;
  border: 4px solid white;
  border-radius: 50%;
  background: #1684d6;
  box-shadow: 0 0 0 9px rgba(22, 132, 214, 0.19), 0 4px 12px rgba(22, 91, 140, 0.4);
  transform: translate(-50%, -50%) scale(var(--map-pin-scale));
}

.draft-location {
  position: absolute;
  z-index: 6;
  width: 36px;
  height: 36px;
  border: 5px solid white;
  border-radius: 50% 50% 50% 8px;
  background: var(--forest);
  box-shadow: 0 7px 16px rgba(13, 54, 42, 0.34);
  transform: translate(-50%, -100%) rotate(-45deg) scale(var(--map-pin-scale));
}

.draft-location::after {
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: white;
  content: "";
}

.map-attribution {
  position: absolute;
  z-index: 7;
  right: 8px;
  bottom: 88px;
  background: rgba(255, 255, 255, 0.85);
  padding: 3px 6px;
  color: #68736d;
  font-size: 0.62rem;
}

.map-surface.has-google-map + .map-bottom-bar {
  bottom: 38px;
}

.map-bottom-bar {
  position: absolute;
  z-index: 12;
  right: 16px;
  bottom: 16px;
  left: auto;
  justify-content: space-between;
  gap: 20px;
  pointer-events: none;
}

.map-help {
  display: none;
}

.map-help strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.register-actions {
  gap: 12px;
  pointer-events: auto;
}

.register-actions .button {
  min-height: 48px;
  border-radius: 6px;
  box-shadow: 0 1px 6px rgba(60, 64, 67, 0.3);
}

#registerHereButton {
  background: #1a73e8;
}

#registerHereButton:hover {
  background: #1557b0;
}

#placeOnMapButton {
  border-color: rgba(60, 64, 67, 0.24);
  background: white;
}

.map-zoom-controls {
  position: absolute;
  z-index: 14;
  right: 18px;
  top: 78px;
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: white;
  box-shadow: 0 1px 6px rgba(60, 64, 67, 0.3);
}

.map-zoom-controls button {
  min-width: 46px;
  min-height: 43px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-weight: 800;
}

.map-zoom-controls button:last-child {
  border-bottom: 0;
  font-size: 0.72rem;
}

.map-zoom-controls button:hover {
  background: var(--mint);
}

.map-location-control {
  position: absolute;
  z-index: 14;
  top: 220px;
  right: 18px;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: white;
  color: #3c4043;
  box-shadow: 0 1px 6px rgba(60, 64, 67, 0.3);
}

.map-location-control:hover {
  background: var(--mint);
}

.map-location-control:disabled {
  cursor: wait;
  opacity: 0.72;
}

.map-location-control svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.map-location-control.is-locating svg {
  animation: spin 0.8s linear infinite;
}

.map-search-control {
  position: absolute;
  z-index: 14;
  top: 274px;
  right: 18px;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: white;
  color: #3c4043;
  box-shadow: 0 1px 6px rgba(60, 64, 67, 0.3);
}

.map-search-control:hover,
.map-search-control[aria-expanded="true"] {
  background: var(--mint);
  color: var(--forest);
}

.map-search-control svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.map-search-panel {
  position: absolute;
  z-index: 22;
  top: 328px;
  right: 18px;
  display: grid;
  width: min(370px, calc(100% - 36px));
  max-height: min(58dvh, 540px);
  gap: 10px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  padding: 14px;
  box-shadow: 0 3px 14px rgba(60, 64, 67, 0.3);
}

.map-search-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.map-search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.map-search-form input {
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 10px 11px;
  font: inherit;
}

.map-search-form .button {
  min-height: 42px;
  padding-inline: 14px;
}

.map-search-status,
.map-search-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.55;
}

.map-search-results {
  display: grid;
  gap: 6px;
}

.map-search-result {
  display: grid;
  width: 100%;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  padding: 10px 11px;
  color: var(--ink);
  text-align: left;
}

.map-search-result:hover,
.map-search-result[aria-selected="true"] {
  border-color: var(--forest);
  background: var(--mint);
}

.map-search-result strong,
.map-search-selection strong {
  font-size: 0.84rem;
}

.map-search-result span,
.map-search-selection small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.map-search-selection {
  display: grid;
  gap: 5px;
  border-left: 4px solid var(--forest);
  background: var(--mint);
  padding: 11px 12px;
}

.map-search-selection > span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.map-search-selection .button {
  margin-top: 5px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.map-placement-banner {
  position: absolute;
  z-index: 22;
  top: 78px;
  left: 50%;
  display: flex;
  width: min(560px, calc(100% - 180px));
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 2px solid #1a73e8;
  border-radius: 8px;
  background: white;
  padding: 10px 12px 10px 16px;
  box-shadow: 0 2px 10px rgba(60, 64, 67, 0.28);
  transform: translateX(-50%);
}

.map-placement-banner > div {
  display: grid;
}

.map-placement-banner span {
  color: var(--muted);
  font-size: 0.76rem;
}

.map-info-card {
  position: absolute;
  z-index: 20;
  display: grid;
  width: min(350px, calc(100% - 24px));
  max-height: calc(100% - 120px);
  gap: 11px;
  overflow: auto;
  border: 1px solid rgba(60, 64, 67, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.99);
  padding: 15px;
  box-shadow: 0 2px 10px rgba(60, 64, 67, 0.32);
  user-select: text;
}

.map-info-card__header,
.map-info-card__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.map-info-card__header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.map-info-card__header h2 {
  margin: 2px 0 0;
  font-size: 1.05rem;
  line-height: 1.3;
}

.map-info-card .eyebrow {
  display: none;
}

.map-info-card .detail-card {
  border: 0;
  border-bottom: 1px solid #e8eaed;
  background: transparent;
}

.map-info-card .detail-card span {
  color: #5f6368;
}

.map-info-card__actions {
  border-top: 1px solid var(--line);
  padding-top: 11px;
}

.map-info-card__actions .button {
  flex: 1;
}

.map-info-card .detail-grid {
  grid-template-columns: 1fr;
}

.map-info-card .detail-card--wide {
  grid-column: auto;
}

.map-info-card .detail-card {
  padding: 9px 10px;
}

.map-ui {
  touch-action: manipulation;
  user-select: none;
}

.icon-button--small {
  width: 38px;
  height: 38px;
  font-size: 1.2rem;
}

.toast-region {
  position: fixed;
  z-index: 100;
  top: 82px;
  right: 18px;
  display: grid;
  width: min(380px, calc(100vw - 36px));
  gap: 9px;
}

.toast {
  border-left: 5px solid var(--forest);
  background: #fff;
  padding: 13px 15px;
  box-shadow: var(--shadow);
  font-size: 0.84rem;
  animation: toast-in 180ms ease-out;
}

.toast--error {
  border-left-color: var(--danger);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.dialog {
  width: min(560px, calc(100vw - 28px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  border: 0;
  border-radius: 15px;
  background: transparent;
  padding: 0;
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(14, 29, 23, 0.46);
  backdrop-filter: blur(3px);
}

.dialog--wide {
  width: min(800px, calc(100vw - 28px));
}

.dialog--fullscreen {
  width: min(1180px, calc(100vw - 28px));
}

.dialog-shell {
  display: grid;
  gap: 17px;
  background: var(--surface);
  padding: 24px;
}

.dialog-shell--viewport {
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.dialog-body {
  display: grid;
  min-height: 0;
  gap: 17px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 3px;
  -webkit-overflow-scrolling: touch;
}

.dialog-header {
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.dialog-header h2 {
  margin: 3px 0 0;
  font-size: 1.35rem;
  line-height: 1.25;
}

.dialog-subtitle,
.dialog-intro {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: #536058;
  font-size: 1.5rem;
}

.icon-button:hover {
  background: var(--mint);
}

.dialog-actions {
  justify-content: flex-end;
  gap: 9px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.dialog-actions--split {
  justify-content: space-between;
  gap: 16px;
}

.dialog-actions > div {
  gap: 9px;
}

.detail-body {
  display: grid;
  gap: 14px;
}

.edit-choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.edit-choice {
  display: grid;
  min-height: 118px;
  align-content: center;
  gap: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: white;
  padding: 18px;
  color: var(--ink);
  text-align: left;
}

.edit-choice:hover {
  border-color: var(--forest);
  background: var(--mint);
}

.edit-choice strong {
  color: var(--forest);
  font-size: 1.15rem;
}

.edit-choice--danger {
  grid-column: 1 / -1;
  min-height: 88px;
  border-color: #e4b8b4;
  background: #fff8f7;
}

.edit-choice--danger:hover {
  border-color: #b3261e;
  background: #fce8e6;
}

.edit-choice--danger strong {
  color: #b3261e;
}

.edit-choice span,
.edit-guidance p {
  color: var(--muted);
  font-size: 0.8rem;
}

.edit-guidance {
  border-left: 4px solid var(--forest);
  background: var(--mint);
  padding: 12px 14px;
}

.edit-guidance p {
  margin: 4px 0 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-card {
  border: 1px solid var(--line);
  background: white;
  padding: 12px;
}

.detail-card--wide {
  grid-column: 1 / -1;
}

.detail-card span,
.location-preview span,
.position-result span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.detail-card strong,
.detail-card p {
  margin: 0;
  font-size: 0.9rem;
}

.detail-card small {
  color: var(--muted);
}

.location-preview {
  display: grid;
  gap: 2px;
  border-left: 4px solid var(--forest);
  background: var(--mint);
  padding: 12px 14px;
}

.location-preview small {
  color: var(--muted);
}

.confirm-list {
  display: grid;
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--line);
}

.confirm-list div {
  display: grid;
  grid-template-columns: 100px 1fr;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}

.confirm-list dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.confirm-list dd {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
}

.conflict-alert {
  border: 1px solid #d6a25b;
  background: #fff5df;
  padding: 12px 14px;
  color: #684918;
  font-size: 0.82rem;
}

.conflict-alert p {
  margin: 4px 0 0;
}

.map-surface--editor {
  min-height: 370px;
  cursor: crosshair;
  touch-action: none;
}

.map-surface--editor.has-google-map {
  touch-action: auto;
}

.position-pin {
  position: absolute;
  z-index: 10;
  width: 40px;
  height: 40px;
  border: 5px solid white;
  border-radius: 50% 50% 50% 8px;
  background: var(--forest);
  filter: drop-shadow(0 6px 8px rgba(13, 54, 42, 0.35));
  cursor: grab;
  transform: translate(-50%, -100%) rotate(-45deg);
  touch-action: none;
}

.position-pin:active {
  cursor: grabbing;
}

.position-pin::after {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: white;
  content: "";
}

.position-result {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 14px;
  border: 1px solid var(--line);
  background: white;
  padding: 14px;
}

.position-result > div strong {
  font-size: 0.83rem;
}

.position-result .check-row,
.position-result > small {
  grid-column: 1 / -1;
}

.check-row {
  min-height: 40px;
  gap: 9px;
  font-size: 0.83rem;
  font-weight: 700;
}

.check-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--forest);
}

.important-toggle {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
  padding: 9px 12px;
}

.position-result > small {
  color: var(--muted);
}

.dialog--notice {
  width: min(520px, calc(100vw - 28px));
}

.dialog--notice .dialog-shell {
  border-top: 5px solid #f9ab00;
}

.dialog--notice.is-critical .dialog-shell {
  border-top-color: #d93025;
}

.dialog--danger .dialog-shell {
  border-top: 5px solid #b3261e;
}

.delete-warning {
  display: grid;
  gap: 5px;
  border: 1px solid #e4b8b4;
  border-radius: 8px;
  background: #fff8f7;
  padding: 14px;
}

.delete-warning span,
.delete-warning p {
  color: var(--muted);
  font-size: 0.82rem;
}

.delete-warning p {
  margin: 3px 0 0;
}

.usage-alert-items {
  display: grid;
  gap: 9px;
}

.usage-alert-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #f1d38c;
  border-radius: 8px;
  background: #fff8e1;
  padding: 11px 13px;
}

.usage-alert-item strong {
  color: #7a4f01;
}

.usage-alert-item.is-critical {
  border-color: #f2b8b5;
  background: #fce8e6;
}

.usage-alert-item.is-critical strong {
  color: #b3261e;
}

.table-wrap {
  max-height: min(62vh, 640px);
  overflow: auto;
  border: 1px solid var(--line);
  background: white;
}

.list-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-top: 0;
  background: #f8faf8;
  padding: 10px 12px;
}

.list-pagination[hidden] {
  display: none;
}

.list-pagination .button {
  min-width: 76px;
  min-height: 44px;
  padding: 8px 14px;
}

.list-pagination__select {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.list-pagination__select select {
  min-height: 44px;
  border: 1px solid #aebbb4;
  border-radius: 7px;
  background: white;
  padding: 6px 28px 6px 10px;
  color: var(--ink);
}

.list-pagination__status {
  min-width: 88px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.79rem;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 11px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: #edf3ed;
  color: #3a4d43;
  font-size: 0.72rem;
  white-space: nowrap;
}

td a {
  color: var(--forest);
  font-weight: 700;
}

.table-empty {
  padding: 38px;
  color: var(--muted);
  text-align: center;
}

.export-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.current-users {
  display: grid;
  max-height: 240px;
  gap: 8px;
  overflow: auto;
}

.current-users__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--line);
  padding: 8px 2px;
  font-size: 0.8rem;
}

.current-users__identity {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.current-users__identity strong,
.current-users__identity span {
  overflow-wrap: anywhere;
}

.current-users__identity span {
  color: var(--muted);
  font-size: 0.7rem;
}

.current-users__reset {
  min-height: 44px;
  border: 1px solid #c6d4ea;
  border-radius: 999px;
  background: #f7faff;
  padding: 0 13px;
  color: #174ea6;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 800;
  cursor: pointer;
}

.current-users__reset:hover {
  background: #e8f0fe;
}

.current-users__reset:focus-visible {
  outline: 3px solid rgba(26, 115, 232, 0.28);
  outline-offset: 2px;
}

.password-reset-warning {
  margin-top: 0;
}

.form-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.form-divider::before,
.form-divider::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

input[type="color"] {
  padding: 5px;
}

.loading-overlay {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(244, 241, 232, 0.56);
  backdrop-filter: blur(2px);
}

.loading-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  padding: 16px 20px;
  box-shadow: var(--shadow);
  font-size: 0.84rem;
  font-weight: 750;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--sage);
  border-top-color: var(--forest);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  .login-view {
    grid-template-columns: 1fr;
  }

  .login-card {
    min-height: 100vh;
    width: min(100%, 610px);
    justify-self: center;
  }

  .login-scene {
    display: none;
  }

  .filter-panel {
    width: 280px;
    padding-inline: 16px;
  }

  .header-actions .status-badge,
  #refreshButton {
    display: none;
  }
}

@media (max-width: 680px) {
  .app-header {
    top: 8px;
    right: 8px;
    left: 8px;
    min-height: 48px;
  }

  .header-actions {
    padding: 3px 4px;
  }

  #logoutButton {
    min-height: 44px;
    padding-inline: 8px;
    font-size: 0.72rem;
  }

  .user-chip {
    max-width: 118px;
    min-height: 44px;
    padding-inline: 5px;
    font-size: 0.76rem;
  }

  #currentUserName {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-body {
    height: 100dvh;
    min-height: 480px;
  }

  .filter-panel {
    top: 68px;
    right: 8px;
    bottom: 8px;
    left: 8px;
    width: auto;
    max-width: 350px;
    padding: 18px 16px;
  }

  .field--compact {
    margin-top: 13px;
  }

  .date-range-filter {
    margin-top: 13px;
  }

  .filter-summary {
    margin: 15px 0 13px;
    padding: 12px 0;
  }

  .filter-summary strong {
    font-size: 1.3rem;
  }

  .panel-actions {
    margin-top: 16px;
  }

  .map-section {
    min-height: 0;
  }

  .map-bottom-bar {
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: 8px;
    display: block;
    background: transparent;
    padding: 0;
    box-shadow: none;
  }

  .map-surface.has-google-map + .map-bottom-bar {
    bottom: calc(34px + env(safe-area-inset-bottom));
  }

  .map-help {
    display: none;
  }

  .register-actions {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    align-items: stretch;
    gap: 7px;
  }

  .register-actions .button {
    min-height: 50px;
    padding-inline: 8px;
    font-size: 0.8rem;
    line-height: 1.25;
  }

  .sidebar-toggle {
    top: 8px;
    left: 8px;
    min-height: 46px;
  }

  .map-zoom-controls {
    top: 68px;
    right: 10px;
  }

  .map-location-control {
    top: 210px;
    right: 10px;
  }

  .map-search-control {
    top: 266px;
    right: 10px;
  }

  .map-search-panel {
    top: 322px;
    right: 8px;
    width: min(370px, calc(100% - 16px));
    max-height: min(52dvh, 500px);
  }

  .map-placement-banner {
    top: 68px;
    right: 8px;
    left: 8px;
    width: auto;
    gap: 9px;
    padding: 9px 9px 9px 12px;
    transform: none;
  }

  .map-placement-banner span {
    font-size: 0.68rem;
  }

  .map-placement-banner .button {
    min-height: 42px;
    flex: 0 0 auto;
  }

  .map-info-card {
    top: auto !important;
    right: 8px;
    bottom: calc(88px + env(safe-area-inset-bottom));
    left: 8px !important;
    width: auto;
    max-height: min(57%, 500px);
  }

  .map-attribution {
    right: 10px;
    bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .dialog-shell {
    gap: 14px;
    padding: 18px 15px;
  }

  .dialog-shell--viewport {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .dialog-body {
    gap: 14px;
  }

  .current-users__item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .current-users__reset {
    grid-column: 2;
    width: 100%;
  }

  .dialog-actions--split {
    align-items: stretch;
    flex-direction: column;
  }

  .dialog-actions--split > div,
  .dialog-actions--split > a,
  .dialog-actions--split > button {
    width: 100%;
  }

  .dialog-actions--split > div .button {
    flex: 1;
  }

  .detail-grid,
  .edit-choice-grid,
  .position-result,
  .two-columns {
    grid-template-columns: 1fr;
  }

  .detail-card--wide,
  .position-result .check-row,
  .position-result > small {
    grid-column: auto;
  }

  .map-surface--editor {
    min-height: 320px;
  }

  .table-wrap {
    max-height: 58vh;
  }

  .list-pagination {
    flex-wrap: wrap;
  }

  .list-pagination__status {
    order: -1;
    width: 100%;
  }

  table {
    min-width: 840px;
  }
}

@media (max-width: 400px) {
  .user-chip {
    max-width: 104px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
