:root {
  color-scheme: light;
  --bg: #f6f7f2;
  --surface: #ffffff;
  --surface-strong: #eef5ee;
  --ink: #17211b;
  --muted: #69746c;
  --line: #dbe2d8;
  --primary: #127c55;
  --primary-dark: #0c5d41;
  --accent: #e7b93f;
  --danger: #b73838;
  --shadow: 0 20px 50px rgba(25, 35, 30, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "Noto Sans KR", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  padding: 16px 32px;
  background: rgba(246, 247, 242, 0.9);
  backdrop-filter: blur(14px);
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px;
  background: #16231d;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-link {
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--accent);
  flex: 0 0 48px;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand strong,
.brand span {
  display: block;
}

.brand span:last-child {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
}

.mobile-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.08);
}

.mobile-menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #fff;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  display: block;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  text-align: left;
}

.nav-tab.active {
  background: #fff;
  color: var(--ink);
}

.system-card {
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.system-card p {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
  line-height: 1.5;
}

.main {
  padding: 32px;
}

.auth-gate {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 20px;
  align-items: start;
}

.auth-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-card h1,
.auth-card h2 {
  margin: 8px 0 10px;
}

.auth-card p,
.page-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.form-grid.single {
  grid-template-columns: 1fr;
}

.auth-submit {
  margin-top: 16px;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-view {
  display: none;
}

.admin-view.active {
  display: grid;
  gap: 20px;
}

.search-input {
  max-width: 320px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.small-btn {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  min-height: 26px;
  padding: 0 10px;
  background: #e7f4ed;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 900;
}

.status-pill.danger {
  background: #fdecec;
  color: var(--danger);
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.region-picker {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.region-picker .field-hint,
.selected-regions {
  grid-column: 1 / -1;
}

.selected-regions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.selected-region {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(18, 124, 85, 0.25);
  border-radius: 999px;
  padding: 7px 10px;
  background: #e8f6ef;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
}

.selected-region button {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 999px;
  background: rgba(12, 93, 65, 0.12);
  color: var(--primary-dark);
  font-weight: 900;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(14, 21, 18, 0.56);
}

.modal-card {
  width: min(760px, 100%);
  max-height: min(860px, 92vh);
  overflow: auto;
  border-radius: 8px;
  padding: 22px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.24);
}

.modal-card.wide {
  width: min(920px, 100%);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.modal-header h2 {
  margin: 6px 0 0;
}

.modal-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.checkbox-field {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0;
  padding: 12px;
}

.checkbox-field legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
}

.check-row input {
  width: auto;
}

.modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.alarm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: start center;
  padding: 22px;
  pointer-events: none;
}

.alarm-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  width: min(520px, 100%);
  border: 1px solid rgba(18, 124, 85, 0.28);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(14, 21, 18, 0.24);
  pointer-events: auto;
  animation: alarmSlideIn 0.22s ease-out;
}

.alarm-card.waiting {
  border-color: rgba(215, 148, 28, 0.5);
}

.alarm-card.accepted {
  border-color: rgba(18, 124, 85, 0.48);
}

.alarm-card.message {
  border-color: rgba(37, 99, 235, 0.48);
}

.alarm-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 22px;
  font-weight: 900;
}

.alarm-card.waiting .alarm-icon {
  background: var(--accent);
  color: #2e2408;
}

.alarm-card.message .alarm-icon {
  background: #2563eb;
}

.alarm-content h2 {
  margin: 4px 0 10px;
  font-size: 20px;
}

.alarm-lines {
  display: grid;
  gap: 5px;
}

.alarm-lines p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.alarm-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

@keyframes alarmSlideIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

[hidden] {
  display: none !important;
}

.top-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-menu a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.top-menu a:hover {
  border-color: rgba(18, 124, 85, 0.38);
  color: var(--primary-dark);
}

.language-select {
  width: auto;
  min-width: 108px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.sidebar-language {
  width: 100%;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-language option {
  color: var(--ink);
}

.landing {
  display: grid;
  gap: 28px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 42px 32px 64px;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 28px;
  align-items: stretch;
}

.hero-copy {
  display: grid;
  align-content: center;
  border-radius: 8px;
  padding: 48px;
  background: #16231d;
  color: #fff;
  box-shadow: var(--shadow);
}

.hero-copy h1 {
  margin: 12px 0 18px;
  max-width: 760px;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 1.08;
}

.hero-copy p {
  max-width: 680px;
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 17px;
  line-height: 1.7;
}

.hero-emphasis {
  max-width: 760px;
  color: #fff !important;
  font-size: clamp(17px, 2.65vw, 32px) !important;
  font-weight: 900;
  line-height: 1.18 !important;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  min-height: 46px;
  padding: 0 16px;
  font-weight: 900;
  text-decoration: none;
}

.primary-link {
  background: var(--accent);
  color: var(--ink);
}

.secondary-link {
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: #fff;
}

.service-visual {
  display: grid;
  gap: 14px;
}

.service-banner-link {
  display: block;
  border-radius: 8px;
  text-decoration: none;
}

.service-banner {
  display: block;
  width: 100%;
  min-height: 150px;
  max-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #fff;
  box-shadow: var(--shadow);
}

.banner-form {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.banner-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface-strong);
}

.banner-editor legend {
  padding: 0 6px;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 900;
}

.banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.flow-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}

.flow-card span {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 900;
}

.flow-card strong {
  font-size: 22px;
}

.flow-card p,
.landing-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

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

.page {
  display: none;
}

.page.active {
  display: grid;
  gap: 24px;
}

.page-header,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-header h1,
.panel h2 {
  margin: 0;
}

.page-header h1 {
  font-size: 30px;
}

.panel h2 {
  font-size: 18px;
}

.panel-heading p {
  margin: 8px 0 0;
  color: var(--muted);
}

.purpose-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-top: 18px;
  background: var(--surface-strong);
}

.purpose-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.purpose-heading h3 {
  margin: 0;
  font-size: 16px;
}

.purpose-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.purpose-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.radio-card {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.radio-card input {
  width: auto;
  accent-color: var(--primary);
}

.purpose-fields {
  margin-top: 14px;
}

.eyebrow,
.label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.content-grid {
  display: grid;
  gap: 20px;
}

.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(18, 124, 85, 0.2);
  outline-offset: 2px;
}

textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.5;
}

.message-form {
  align-items: end;
}

.message-text-field {
  grid-column: 1 / -1;
}

.message-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.message-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.message-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-wrap;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 800;
}

.primary-btn {
  background: var(--primary);
  color: #fff;
}

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

.primary-btn:disabled {
  cursor: wait;
  opacity: 0.72;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.danger-btn {
  background: var(--danger);
  color: #fff;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: var(--surface-strong);
}

.segment {
  border: 0;
  border-radius: 6px;
  min-width: 100px;
  padding: 9px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segment.active {
  background: var(--surface);
  color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(25, 35, 30, 0.1);
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 20px;
  margin-top: 18px;
}

.route-map-layout {
  grid-template-columns: 1fr;
}

.route-map-layout .location-summary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.route-map-layout .map {
  width: 100%;
}

.request-taxi-btn {
  justify-self: end;
  min-width: 180px;
}

.map {
  position: relative;
  min-height: 460px;
  overflow: hidden;
  border: 1px solid #cbd8cc;
  border-radius: 8px;
  background: #dfeadc;
}

.map-frame {
  display: block;
  width: 100%;
  height: 460px;
  border: 0;
}

.map-zoom-controls {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  display: grid;
  gap: 6px;
}

.map-zoom-controls button {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(23, 33, 27, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(25, 35, 30, 0.12);
  font-size: 20px;
  font-weight: 900;
}

.map-overlay {
  position: absolute;
  z-index: 2;
  left: 16px;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  pointer-events: none;
}

.map-location-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: min(720px, 100%);
  pointer-events: auto;
}

.map-chip,
.map-link,
.inline-map-link {
  border: 1px solid rgba(23, 33, 27, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(25, 35, 30, 0.12);
  font-weight: 800;
  text-decoration: none;
}

.map-chip {
  min-height: 36px;
  padding: 0 12px;
}

.map-chip.active {
  border-color: var(--primary);
  background: #e8f6ef;
  color: var(--primary-dark);
}

.map-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  white-space: nowrap;
  pointer-events: auto;
}

.inline-map-link {
  display: inline-flex;
  width: fit-content;
  margin-top: 4px;
  padding: 8px 10px;
  color: var(--primary-dark);
  font-size: 13px;
}

.map-fallback {
  display: grid;
  place-items: center;
  padding: 20px;
}

.map-point {
  position: absolute;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(23, 33, 27, 0.12);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(25, 35, 30, 0.12);
  transform: translate(-50%, -50%);
}

.map-point.selected-pickup {
  border-color: var(--primary);
  background: #e8f6ef;
}

.map-point.selected-destination {
  border-color: var(--accent);
  background: #fff8df;
}

.pin {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
}

.selected-destination .pin {
  background: var(--accent);
}

.point-name {
  white-space: nowrap;
  font-size: 13px;
  font-weight: 800;
}

.location-summary {
  display: grid;
  align-content: start;
  gap: 14px;
}

.route-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.route-column {
  display: grid;
  gap: 14px;
}

.route-select-title {
  font-size: 15px;
  font-weight: 900;
}

.pickup-select-title {
  color: #2563eb;
}

.destination-select-title {
  color: #dc2626;
}

.route-select-title input {
  color: var(--ink);
  font-weight: 500;
}

.route-summary,
.empty-state,
.profile-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-strong);
}

.location-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.call-status.accepted {
  border-color: rgba(37, 99, 235, 0.42);
  background: #eff6ff;
}

.call-status.accepted .profile-box {
  border-color: rgba(37, 99, 235, 0.32);
  background: #dbeafe;
}

.list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.list.compact {
  max-height: none;
  overflow: visible;
}

[data-admin-panel="dashboard"] .list.compact {
  max-height: 520px;
  overflow: auto;
}

.protected-view > .panel .list,
.admin-view > .panel .list {
  gap: 14px;
}

.protected-view > .panel .call-card,
.admin-view > .panel .call-card {
  padding: 16px;
}

.call-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.call-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.call-card h3 {
  margin: 0;
  font-size: 16px;
}

.call-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  min-height: 28px;
  padding: 0 10px;
  background: #e7f4ed;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.table-wrap {
  margin-top: 14px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

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

th {
  color: var(--muted);
  font-size: 12px;
}

td {
  font-size: 14px;
}

@media (max-width: 980px) {
  .site-header,
  .landing-hero {
    grid-template-columns: 1fr;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-menu,
  .landing-grid {
    grid-template-columns: 1fr;
  }

  .top-menu {
    flex-wrap: wrap;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .auth-gate {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    height: auto;
    padding: 14px 18px;
  }

  .sidebar .brand {
    min-width: 0;
  }

  .sidebar .brand strong,
  .sidebar .brand span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-tabs,
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .mobile-menu-toggle {
    display: inline-flex;
    flex-direction: column;
  }

  .sidebar .nav-tabs,
  .sidebar .system-card,
  .sidebar .sidebar-language {
    display: none;
    grid-column: 1 / -1;
  }

  .sidebar.menu-open .nav-tabs {
    display: grid;
  }

  .sidebar.menu-open .system-card {
    display: block;
  }

  .sidebar.menu-open .sidebar-language {
    display: block;
  }

  .system-card {
    margin-top: 0;
  }

  .two-columns,
  .map-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .site-header,
  .landing {
    padding: 18px;
  }

  .hero-copy {
    padding: 28px;
  }

  .top-menu {
    width: 100%;
  }

  .top-menu a {
    flex: 1 1 46%;
    text-align: center;
  }

  .main {
    padding: 18px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    height: auto;
    padding: 12px 14px;
  }

  .sidebar .brand {
    min-width: 0;
  }

  .sidebar .brand strong,
  .sidebar .brand span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-menu-toggle {
    display: inline-flex;
    flex-direction: column;
  }

  .sidebar .nav-tabs,
  .sidebar .system-card,
  .sidebar .sidebar-language {
    display: none;
    grid-column: 1 / -1;
  }

  .sidebar.menu-open .nav-tabs {
    display: grid;
  }

  .sidebar.menu-open .system-card {
    display: block;
  }

  .sidebar.menu-open .sidebar-language {
    display: block;
  }

  .page-header,
  .panel-heading,
  .purpose-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid,
  .nav-tabs,
  .stats-grid,
  .route-map-layout .location-summary,
  .route-columns,
  .banner-editor,
  .modal-form,
  .checkbox-field,
  .region-picker {
    grid-template-columns: 1fr;
  }

  .alarm-backdrop {
    padding: 12px;
  }

  .alarm-card {
    grid-template-columns: 1fr;
  }

  .map {
    min-height: 390px;
  }

  .map-frame {
    height: 390px;
  }

  .map-overlay {
    align-items: stretch;
    flex-direction: column;
  }

  .map-link {
    justify-content: center;
    width: 100%;
  }

  .segment {
    min-width: 0;
  }
}
