:root {
  --ink: #14251f;
  --muted: #6f7c76;
  --paper: #f2f3ed;
  --card: #fffefa;
  --line: #dfe3da;
  --green: #1f6249;
  --green-soft: #dceee3;
  --lime: #d9f265;
  --yellow: #d99d28;
  --yellow-soft: #fff0c8;
  --red: #d95745;
  --red-soft: #f9ded9;
  --shadow: 0 24px 70px rgba(20, 37, 31, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 90% 5%, rgba(217, 242, 101, 0.2), transparent 27rem),
    var(--paper);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
a {
  font: inherit;
}

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

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(31, 98, 73, 0.3);
  outline-offset: 3px;
}

.app-shell {
  width: min(1220px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 25px 0 20px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 23px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: none;
  place-items: center;
  border-radius: 14px 14px 5px 14px;
  color: white;
  background: var(--green);
  font-size: 20px;
  font-weight: 900;
}

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

.brand strong {
  letter-spacing: -0.03em;
}

.brand small,
.label,
.last-seen,
.metric-note {
  color: var(--muted);
  font-size: 12px;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.mvp-badge,
.logout-button,
.soft-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mvp-badge {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 13px;
}

.mvp-badge i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #24a36a;
  box-shadow: 0 0 0 4px rgba(36, 163, 106, 0.11);
}

.logout-button {
  padding: 9px 13px;
  cursor: pointer;
  text-decoration: none;
}

.logout-button:hover {
  color: var(--ink);
  background: var(--card);
}

.page-heading,
.detail-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  padding: 58px 0 36px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 11px;
  color: var(--green);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.page-heading h1,
.detail-heading h1 {
  margin: 0;
  font-size: clamp(40px, 5vw, 68px);
  line-height: 1;
  letter-spacing: -0.065em;
}

.page-copy {
  max-width: 660px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.heading-count {
  min-width: 180px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
}

.heading-count strong,
.heading-count span {
  display: block;
}

.heading-count strong {
  font-size: 34px;
  letter-spacing: -0.05em;
}

.heading-count span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

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

.city-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  color: inherit;
  background: var(--card);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.city-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 30px 80px rgba(20, 37, 31, 0.14);
}

.city-artwork {
  position: relative;
  height: 250px;
  overflow: hidden;
  background:
    linear-gradient(90deg, transparent 49%, rgba(255,255,255,.7) 50%, transparent 52%),
    linear-gradient(20deg, #e3eadf 0 24%, #d6e0d4 25% 44%, #e8eee4 45%);
}

.map-water {
  position: absolute;
  top: -40px;
  right: -30px;
  width: 43%;
  height: 145%;
  border-left: 8px solid rgba(255, 255, 255, 0.65);
  background: #bcd8db;
  transform: rotate(7deg);
}

.map-road {
  position: absolute;
  height: 16px;
  border: 4px solid rgba(255, 255, 255, 0.78);
  border-radius: 99px;
  background: #c6cec3;
}

.road-one {
  top: 45px;
  left: -50px;
  width: 78%;
  transform: rotate(-22deg);
}

.road-two {
  bottom: 45px;
  left: 40px;
  width: 67%;
  transform: rotate(35deg);
}

.city-pin {
  position: absolute;
  top: 50%;
  left: 48%;
  display: grid;
  width: 55px;
  height: 55px;
  place-items: center;
  border: 5px solid var(--card);
  border-radius: 20px 20px 7px 20px;
  color: white;
  background: var(--green);
  box-shadow: 0 12px 30px rgba(20, 37, 31, 0.24);
  font-size: 20px;
  font-weight: 900;
  transform: translate(-50%, -50%);
}

.city-open {
  position: absolute;
  right: 18px;
  bottom: 18px;
  padding: 10px 13px;
  border-radius: 11px;
  background: rgba(255, 254, 250, 0.92);
  font-size: 11px;
  font-weight: 800;
  backdrop-filter: blur(10px);
}

.city-card-content {
  padding: 25px;
}

.city-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.city-title span {
  color: var(--muted);
  font-size: 11px;
}

.city-title h2 {
  margin: 4px 0 0;
  font-size: 28px;
  letter-spacing: -0.045em;
}

.city-title > strong {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 15px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 21px;
}

.city-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 17px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.city-stats span,
.map-legend span,
.device-status {
  display: flex;
  gap: 7px;
  align-items: center;
}

.city-stats i,
.map-legend i,
.state-dot,
.device-status i {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
}

i.active,
.state-dot.active,
.device-status.active i {
  background: #2ca66c;
}

i.ready,
.state-dot.ready,
.device-status.ready i {
  background: var(--yellow);
}

i.offline,
.state-dot.offline,
.device-status.offline i {
  background: var(--red);
}

.loading-card {
  grid-column: 1 / -1;
  padding: 45px;
  border: 1px dashed #cbd1c8;
  border-radius: 22px;
  color: var(--muted);
  text-align: center;
}

.error-card {
  color: var(--red);
  background: var(--red-soft);
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  padding-top: 22px;
  color: var(--muted);
  font-size: 12px;
}

.breadcrumbs a,
.app-footer a {
  color: var(--green);
  font-weight: 700;
  text-decoration: none;
}

.breadcrumbs strong {
  color: var(--ink);
}

.city-heading {
  padding-top: 38px;
}

.fleet-summary {
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
}

.fleet-summary > div {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0 8px;
  min-width: 115px;
  padding: 17px 19px;
  border-right: 1px solid var(--line);
}

.fleet-summary > div:last-child {
  border: 0;
}

.fleet-summary i {
  grid-row: 1 / 3;
  align-self: center;
}

.fleet-summary strong {
  font-size: 18px;
}

.fleet-summary span {
  color: var(--muted);
  font-size: 10px;
}

.fleet-section {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 254, 250, 0.55);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-heading h2 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.04em;
}

.section-heading .section-kicker {
  margin-bottom: 5px;
}

.soft-badge {
  padding: 8px 12px;
}

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

.device-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 21px;
  color: inherit;
  background: var(--card);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease;
}

.device-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 5px;
  background: var(--red);
  content: "";
}

.device-card.active::before {
  background: #2ca66c;
}

.device-card.ready::before {
  background: var(--yellow);
}

.device-card:hover {
  border-color: #bec9c0;
  transform: translateY(-3px);
}

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

.device-id {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  text-transform: uppercase;
}

.device-status {
  padding: 7px 9px;
  border-radius: 999px;
  color: var(--red);
  background: var(--red-soft);
  font-size: 10px;
  font-weight: 800;
}

.device-status.active {
  color: var(--green);
  background: var(--green-soft);
}

.device-status.ready {
  color: #8b6110;
  background: var(--yellow-soft);
}

.device-card h3 {
  margin: 24px 0 6px;
  font-size: 23px;
  letter-spacing: -0.04em;
}

.device-card > p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.device-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 20px;
}

.device-card-metrics span {
  min-width: 0;
  padding: 10px;
  border-radius: 11px;
  background: #f2f3ed;
}

.device-card-metrics small,
.device-card-metrics strong {
  display: block;
}

.device-card-metrics small {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
}

.device-card-metrics strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-card-action {
  display: block;
  margin-top: 20px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
}

.detail-heading {
  padding-top: 32px;
}

.connection-card {
  display: grid;
  grid-template-columns: auto auto;
  gap: 3px 11px;
  min-width: 230px;
  padding: 17px 19px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

.status-dot {
  width: 8px;
  height: 8px;
  grid-row: 1 / 3;
  align-self: center;
  border-radius: 50%;
  background: var(--red);
}

.status-dot.online {
  background: #24a36a;
  box-shadow: 0 0 0 5px rgba(36, 163, 106, 0.12);
}

.connection-card .label,
.connection-card strong {
  display: block;
}

.connection-card strong {
  font-size: 15px;
}

.last-seen {
  grid-column: 2;
}

.dashboard {
  display: flex;
  height: 550px;
  min-height: 550px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.map-panel {
  position: relative;
  flex: 1.62;
  min-width: 0;
  height: 100%;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #dfe4db;
}

.leaflet-container {
  isolation: isolate;
}

.fleet-marker {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 3px solid var(--card);
  border-radius: 12px 12px 4px 12px;
  color: white;
  background: var(--red);
  box-shadow: 0 7px 20px rgba(20, 37, 31, 0.25);
  font-size: 13px;
  font-weight: 900;
}

.fleet-marker.active {
  background: #239a62;
}

.fleet-marker.ready {
  color: #4e390f;
  background: #e2ad42;
}

.fleet-marker.selected {
  width: 54px;
  height: 54px;
  border-width: 5px;
  border-radius: 18px 18px 6px 18px;
  box-shadow: 0 10px 32px rgba(20, 37, 31, 0.34);
  font-size: 19px;
}

.marker-symbol {
  position: relative;
  z-index: 2;
}

.marker-pulse {
  position: absolute;
  inset: -10px;
  z-index: 1;
  border: 2px solid currentColor;
  border-radius: 24px;
  animation: marker-pulse 2s ease-out infinite;
}

@keyframes marker-pulse {
  0% { opacity: 0.7; transform: scale(0.75); }
  80%, 100% { opacity: 0; transform: scale(1.35); }
}

.scooter-tooltip {
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  color: var(--ink);
  background: var(--card);
  box-shadow: 0 8px 24px rgba(20, 37, 31, 0.17);
  font-family: inherit;
  font-size: 10px;
  font-weight: 800;
}

.scooter-tooltip::before {
  border-top-color: var(--card) !important;
}

.scooter-tooltip.selected {
  font-size: 11px;
}

.map-label,
.locate-button,
.map-legend {
  position: absolute;
  z-index: 500;
  border: 1px solid rgba(220, 224, 216, 0.92);
  background: rgba(255, 254, 250, 0.93);
  backdrop-filter: blur(12px);
}

.map-label {
  bottom: 20px;
  left: 20px;
  padding: 13px 16px;
  border-radius: 14px;
}

.map-label span,
.map-label strong {
  display: block;
}

.map-label span {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
}

.map-label strong {
  font-size: 12px;
}

.locate-button {
  top: 20px;
  right: 20px;
  padding: 11px 15px;
  border-radius: 12px;
  color: var(--ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.map-legend {
  bottom: 20px;
  left: 275px;
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.control-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 330px;
  max-width: 430px;
  overflow-y: auto;
  padding: 28px 32px;
  border-left: 1px solid var(--line);
}

.selected-device-tag {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.selected-device-tag span {
  padding: 6px 8px;
  border-radius: 7px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.selected-device-tag strong {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.scooter-visual {
  position: relative;
  height: 112px;
  margin: 15px 0 16px;
}

.wheel {
  position: absolute;
  bottom: 3px;
  width: 45px;
  height: 45px;
  border: 7px solid var(--ink);
  border-radius: 50%;
}

.wheel::after {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--lime);
  content: "";
}

.wheel-back { left: 10px; }
.wheel-front { right: 15px; }

.deck {
  position: absolute;
  right: 53px;
  bottom: 20px;
  left: 52px;
  height: 9px;
  border-radius: 10px;
  background: var(--ink);
}

.stem {
  position: absolute;
  right: 49px;
  bottom: 42px;
  width: 7px;
  height: 63px;
  border-radius: 5px;
  background: var(--ink);
  transform: rotate(-9deg);
  transform-origin: bottom;
}

.handle {
  position: absolute;
  top: 3px;
  right: 35px;
  width: 38px;
  height: 7px;
  border-radius: 5px;
  background: var(--ink);
}

.power-status {
  padding: 19px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.power-line {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 5px;
}

.power-line strong {
  font-size: 27px;
  letter-spacing: -0.045em;
}

.power-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  background: #ebece7;
}

.power-icon.on {
  color: var(--green);
  background: var(--lime);
}

.power-status p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.controls {
  display: grid;
  gap: 9px;
  margin-top: 20px;
}

.control-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 15px 17px;
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  text-align: left;
  transition: transform 160ms ease, opacity 160ms ease;
}

.control-button:hover:not(:disabled) {
  transform: translateY(-2px);
}

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

.control-button span {
  font-weight: 850;
}

.control-button small {
  opacity: 0.68;
  font-size: 9px;
}

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

.control-button.secondary {
  color: var(--ink);
  background: #e8eae4;
}

.command-message {
  margin: auto 0 0;
  padding-top: 14px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.command-message.working { color: #b87517; }
.command-message.success { color: var(--green); }

.telemetry {
  display: flex;
  gap: 1px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--line);
}

.telemetry article {
  display: grid;
  flex: 1;
  grid-template-columns: auto 1fr auto;
  gap: 13px;
  align-items: center;
  min-height: 90px;
  padding: 19px;
  background: var(--card);
}

.metric-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  color: var(--green);
  background: rgba(217, 242, 101, 0.4);
  font-size: 20px;
}

.telemetry .label,
.telemetry strong {
  display: block;
}

.telemetry strong {
  margin-top: 3px;
  font-size: 13px;
}

.meter {
  width: 58px;
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: #ddd;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 400ms ease;
}

.signal-bars {
  display: flex;
  gap: 3px;
  align-items: end;
  height: 22px;
}

.signal-bars i {
  width: 4px;
  border-radius: 3px;
  background: var(--green);
}

.signal-bars i:nth-child(1) { height: 6px; }
.signal-bars i:nth-child(2) { height: 11px; }
.signal-bars i:nth-child(3) { height: 16px; }
.signal-bars i:nth-child(4) { height: 21px; }
.signal-bars i.muted { opacity: 0.16; }

.event-console {
  margin-top: 18px;
  overflow: hidden;
  border-radius: 22px;
  color: #edf3ef;
  background: #17251f;
  box-shadow: 0 20px 60px rgba(20, 37, 31, 0.14);
}

.event-console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 27px 19px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.console-kicker {
  margin: 0 0 4px;
  color: var(--lime);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.event-console h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.04em;
}

.console-live {
  display: flex;
  gap: 8px;
  align-items: center;
  color: #aebbb5;
  font-size: 10px;
  font-weight: 700;
}

.console-live span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 5px rgba(217, 242, 101, 0.1);
}

.event-explanation {
  padding: 14px 27px;
  color: #9eaba5;
  background: rgba(255, 255, 255, 0.035);
  font-size: 11px;
}

.event-list {
  max-height: 380px;
  overflow-y: auto;
}

.event-row {
  position: relative;
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 16px;
  padding: 16px 27px 16px 37px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.event-row::before {
  position: absolute;
  top: 22px;
  left: 20px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #87928d;
  content: "";
}

.event-row.app_to_server::before { background: #72a8ff; }
.event-row.server_to_device::before { background: #f0aa61; }
.event-row.device_to_server::before { background: var(--lime); }

.event-row time {
  padding-top: 2px;
  color: #77847e;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.event-route {
  display: block;
  margin-bottom: 4px;
  color: #89968f;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.event-row strong {
  display: block;
  color: #f6faf7;
  font-size: 12px;
}

.event-row p {
  margin: 5px 0 0;
  color: #aebbb5;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  line-height: 1.5;
}

.event-empty {
  margin: 0;
  padding: 34px 28px;
  color: #89968f;
  font-size: 11px;
  text-align: center;
}

.console-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 15px 27px;
  color: #89968f;
  background: rgba(0, 0, 0, 0.12);
  font-size: 9px;
}

.console-legend span {
  display: flex;
  gap: 7px;
  align-items: center;
}

.console-legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.app-dot { background: #72a8ff; }
.server-dot { background: #f0aa61; }
.device-dot { background: var(--lime); }

.app-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 21px 4px 0;
  color: var(--muted);
  font-size: 11px;
}

.login-page {
  min-height: 100vh;
  background: #16382c;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(400px, 0.85fr);
  min-height: 100vh;
}

.login-story {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: clamp(30px, 5vw, 70px);
  color: white;
  background:
    radial-gradient(circle at 78% 22%, rgba(217, 242, 101, 0.28), transparent 25rem),
    linear-gradient(135deg, #173c2f, #102a22);
}

.brand-light small {
  color: rgba(255, 255, 255, 0.58);
}

.brand-light .brand-mark {
  color: var(--green);
  background: var(--lime);
}

.eyebrow-light {
  color: var(--lime);
}

.login-story h1 {
  margin: 0;
  font-size: clamp(48px, 7vw, 92px);
  line-height: 0.94;
  letter-spacing: -0.075em;
}

.login-story p:not(.eyebrow) {
  max-width: 560px;
  margin: 24px 0 0;
  color: rgba(255, 255, 255, 0.63);
  font-size: 16px;
  line-height: 1.65;
}

.login-stage {
  color: rgba(255, 255, 255, 0.46);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-form-side {
  display: grid;
  place-items: center;
  padding: 40px;
  background: var(--paper);
}

.login-card {
  width: min(100%, 430px);
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.login-card-heading {
  display: flex;
  gap: 14px;
  align-items: center;
}

.login-icon {
  display: grid;
  width: 45px;
  height: 45px;
  place-items: center;
  border-radius: 14px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 20px;
}

.login-card h2 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -0.045em;
}

.login-card .section-kicker {
  margin-bottom: 4px;
}

.form-copy {
  margin: 23px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.login-card label {
  display: block;
  margin-top: 15px;
}

.login-card label > span {
  display: block;
  margin: 0 0 7px 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.login-card input {
  width: 100%;
  height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: #f8f8f4;
}

.login-card input:focus {
  border-color: #91aa9c;
  background: white;
}

.primary-action {
  width: 100%;
  margin-top: 20px;
  padding: 15px 18px;
  border: 0;
  border-radius: 13px;
  color: white;
  background: var(--green);
  cursor: pointer;
  font-weight: 850;
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.55;
}

.form-message {
  min-height: 18px;
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.form-message.error { color: var(--red); }
.form-message.success { color: var(--green); }

@media (max-width: 980px) {
  .device-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard {
    height: auto;
    min-height: 0;
    flex-direction: column;
  }

  .map-panel {
    flex: none;
    width: 100%;
    height: 500px;
  }

  #map {
    min-height: 500px;
  }

  .control-panel {
    width: 100%;
    max-width: none;
    min-width: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .scooter-visual {
    width: min(100%, 360px);
  }

  .command-message {
    margin-top: 10px;
  }

  .login-layout {
    grid-template-columns: 1fr 420px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 24px, 1220px);
    padding-top: 15px;
  }

  .mvp-badge {
    display: none;
  }

  .page-heading,
  .detail-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 22px;
    padding: 38px 0 27px;
  }

  .page-heading h1,
  .detail-heading h1 {
    font-size: 44px;
  }

  .heading-count,
  .connection-card {
    width: 100%;
  }

  .city-grid,
  .device-grid {
    grid-template-columns: 1fr;
  }

  .fleet-summary {
    width: 100%;
  }

  .fleet-summary > div {
    min-width: 0;
    flex: 1;
    padding: 14px;
  }

  .fleet-section {
    padding: 17px;
    border-radius: 21px;
  }

  .telemetry {
    flex-direction: column;
  }

  .map-panel,
  #map {
    height: 430px;
    min-height: 430px;
  }

  .map-legend {
    display: none;
  }

  .login-layout {
    display: block;
  }

  .login-story {
    min-height: 43vh;
    padding: 28px;
  }

  .login-story h1 {
    margin-top: 55px;
    font-size: 54px;
  }

  .login-story p:not(.eyebrow) {
    display: none;
  }

  .login-form-side {
    min-height: 57vh;
    padding: 24px 16px 40px;
  }
}

@media (max-width: 500px) {
  .brand small {
    display: none;
  }

  .city-artwork {
    height: 200px;
  }

  .fleet-summary > div {
    grid-template-columns: auto;
    text-align: center;
  }

  .fleet-summary i {
    display: none;
  }

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

  .device-card-metrics span:last-child {
    grid-column: 1 / -1;
  }

  .dashboard {
    border-radius: 20px;
  }

  .map-panel,
  #map {
    height: 390px;
    min-height: 390px;
  }

  .map-label {
    right: 13px;
    bottom: 13px;
    left: 13px;
  }

  .locate-button {
    top: 13px;
    right: 13px;
  }

  .control-panel {
    padding: 24px;
  }

  .event-console-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 21px;
  }

  .event-explanation,
  .console-legend {
    padding-right: 21px;
    padding-left: 21px;
  }

  .event-row {
    grid-template-columns: 1fr;
    gap: 5px;
    padding-right: 21px;
    padding-left: 35px;
  }

  .app-footer {
    flex-direction: column;
    gap: 8px;
  }

  .login-card {
    padding: 27px 22px;
  }
}

/* Пользовательский интерфейс поездки */
.rider-body { min-height: 100vh; background: #edf0e9; }
.rider-app { width: min(520px, 100%); min-height: 100vh; margin: 0 auto; overflow: hidden; background: #f7f8f3; box-shadow: 0 0 80px rgba(20, 37, 31, .13); }
.rider-header { display: flex; align-items: center; justify-content: space-between; padding: max(18px, env(safe-area-inset-top)) 20px 16px; color: white; background: #173e31; }
.rider-brand { display: flex; gap: 10px; align-items: center; color: inherit; text-decoration: none; }
.rider-brand > span { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 11px 11px 4px 11px; color: #173e31; background: var(--lime); font-weight: 950; }
.rider-brand strong { font-size: 14px; letter-spacing: -.03em; }
.rider-connection { display: flex; gap: 7px; align-items: center; color: #b9c8c1; font-size: 11px; font-weight: 750; }
.rider-connection i { width: 7px; height: 7px; border-radius: 50%; background: #e77967; }
.rider-connection.online i { background: #62db98; box-shadow: 0 0 0 4px rgba(98, 219, 152, .12); }
.rider-hero { position: relative; height: 365px; color: white; background: #173e31; }
.rider-hero > div:first-child { position: absolute; z-index: 500; top: 18px; left: 20px; max-width: calc(100% - 40px); padding: 15px 17px; border: 1px solid rgba(255,255,255,.14); border-radius: 17px; background: rgba(23,62,49,.88); backdrop-filter: blur(12px); }
.rider-eyebrow { margin: 0 0 6px; color: var(--lime); font-size: 9px; font-weight: 850; letter-spacing: .15em; text-transform: uppercase; }
.rider-hero h1 { margin: 0; font-size: 27px; letter-spacing: -.055em; }
.rider-hero p:last-child { margin: 5px 0 0; color: #d2ddd7; font-size: 11px; line-height: 1.4; }
#riderMap { width: 100%; height: 100%; background: #dce4da; }
.rider-locate { position: absolute; z-index: 500; right: 18px; bottom: 18px; width: 44px; height: 44px; border: 0; border-radius: 14px; color: #173e31; background: white; box-shadow: 0 8px 22px rgba(20,37,31,.2); font-size: 22px; cursor: pointer; }
.rider-marker { position: relative; display: grid; width: 54px; height: 54px; place-items: center; border: 5px solid white; border-radius: 19px 19px 6px 19px; color: white; background: #1f8d5d; box-shadow: 0 10px 32px rgba(20,37,31,.34); font-size: 18px; font-weight: 950; }
.rider-marker span { position: absolute; inset: -12px; border: 2px solid #1f8d5d; border-radius: 25px; animation: marker-pulse 2s ease-out infinite; }
.rider-sheet { position: relative; z-index: 600; margin-top: -22px; padding: 25px 20px 22px; border-radius: 27px 27px 0 0; background: #f7f8f3; }
.rider-scooter-row { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.rider-device-id { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; text-transform: uppercase; }
.rider-scooter-row h2 { margin: 4px 0 0; font-size: 25px; letter-spacing: -.05em; }
.rider-status { padding: 8px 11px; border-radius: 999px; color: #136343; background: #d9eee1; font-size: 10px; font-weight: 850; white-space: nowrap; }
.rider-status.occupied, .rider-status.unavailable { color: #8b6110; background: var(--yellow-soft); }
.rider-status.locked { color: #a63c2d; background: var(--red-soft); }
.rider-status.offline { color: #a63c2d; background: var(--red-soft); }
.rider-status.mine { color: white; background: #1f8d5d; }
.rider-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 21px 0 16px; }
.rider-metrics article { padding: 13px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.rider-metrics span, .rider-metrics strong { display: block; }
.rider-metrics span { margin-bottom: 6px; color: var(--muted); font-size: 9px; }
.rider-metrics strong { font-size: 14px; letter-spacing: -.02em; }
.rider-metrics b { font-size: inherit; }
.trip-panel { position: relative; margin: 14px 0; padding: 18px; overflow: hidden; border-radius: 18px; color: white; background: #173e31; }
.trip-panel::after { position: absolute; right: -40px; bottom: -55px; width: 130px; height: 130px; border-radius: 50%; background: rgba(217,242,101,.16); content: ""; }
.trip-panel span, .trip-panel strong, .trip-panel small { display: block; }
.trip-panel span { color: #a9bdb4; font-size: 9px; text-transform: uppercase; letter-spacing: .12em; }
.trip-panel strong { margin: 5px 0 2px; color: var(--lime); font-size: 32px; letter-spacing: -.05em; }
.trip-panel small { color: #d2ddd7; }
.rider-safety { display: flex; gap: 11px; align-items: flex-start; margin: 13px 0; padding: 12px 13px; border-radius: 14px; color: #6f551d; background: #fff1cc; }
.rider-safety > span { display: grid; width: 20px; height: 20px; flex: none; place-items: center; border-radius: 50%; color: white; background: #d99d28; font-size: 11px; font-weight: 900; }
.rider-safety p { margin: 0; font-size: 10px; line-height: 1.45; }
.rider-safety strong { display: block; }
.rider-action { width: 100%; min-height: 70px; padding: 14px 18px; border: 0; border-radius: 18px; text-align: left; cursor: pointer; }
.rider-action[href] { display: block; box-sizing: border-box; text-decoration: none; }
.rider-action span, .rider-action small { display: block; }
.rider-action span { font-size: 18px; font-weight: 900; letter-spacing: -.035em; }
.rider-action small { margin-top: 4px; opacity: .72; font-size: 10px; }
.rider-action.start { color: #173e31; background: var(--lime); box-shadow: 0 13px 28px rgba(130,161,48,.22); }
.rider-action.finish { color: white; background: #173e31; box-shadow: 0 13px 28px rgba(20,37,31,.2); }
.rider-action:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.rider-message { min-height: 16px; margin: 12px 0 0; color: var(--muted); font-size: 10px; text-align: center; }
.rider-footer { display: flex; justify-content: space-between; padding: 5px 20px max(22px, env(safe-area-inset-bottom)); color: var(--muted); font-size: 9px; }
.rider-footer a { color: var(--green); font-weight: 750; text-decoration: none; }
@media (max-width: 520px) { .rider-app { box-shadow: none; } .rider-hero { height: 330px; } }

.rider-auth-app { width: min(520px, 100%); min-height: 100vh; margin: 0 auto; padding-bottom: max(28px, env(safe-area-inset-bottom)); color: white; background: radial-gradient(circle at 85% 10%, rgba(217,242,101,.2), transparent 22rem), #173e31; }
.rider-auth-header { display: flex; align-items: center; justify-content: space-between; padding: max(20px, env(safe-area-inset-top)) 22px 16px; }
.rider-auth-header > span { color: #afc1b9; font-size: 9px; font-weight: 750; text-transform: uppercase; }
.rider-auth-intro { padding: 42px 24px 30px; }
.rider-auth-intro h1 { max-width: 430px; margin: 0; font-size: clamp(38px, 10vw, 55px); line-height: .96; letter-spacing: -.065em; }
.rider-auth-intro > p:last-child { max-width: 390px; margin: 17px 0 0; color: #c7d4ce; font-size: 13px; line-height: 1.55; }
.rider-auth-card { margin: 0 12px; padding: 24px 20px; border-radius: 28px; color: var(--ink); background: #f7f8f3; box-shadow: 0 25px 65px rgba(0,0,0,.2); }
.rider-auth-card form { display: grid; gap: 15px; }
.rider-auth-card form[hidden] { display: none; }
.rider-auth-card label > span:first-child { display: block; margin-bottom: 7px; color: var(--muted); font-size: 10px; font-weight: 750; }
.rider-auth-card input:not([type="checkbox"]) { width: 100%; padding: 15px 16px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: white; font-size: 16px; }
.rider-consent { display: grid; grid-template-columns: 20px 1fr; gap: 9px; align-items: start; }
.rider-consent input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--green); }
.rider-consent > span { color: var(--muted); font-size: 10px; line-height: 1.45; }
.rider-consent a, .legal-card a { color: var(--green); font-weight: 750; }
.rider-auth-card .rider-action { margin-top: 4px; }
.rider-auth-message { min-height: 18px; margin: 13px 3px 0; color: var(--muted); font-size: 10px; text-align: center; }
.rider-auth-message.error { color: var(--red); }
.rider-auth-message.success { color: var(--green); }
.rider-auth-back { justify-self: start; padding: 0; border: 0; color: var(--green); background: transparent; cursor: pointer; font-size: 11px; font-weight: 750; }
.rider-resend { display: flex; justify-content: center; gap: 6px; padding: 9px; border: 0; color: var(--green); background: transparent; cursor: pointer; font-size: 11px; font-weight: 800; }
.rider-resend small { color: var(--muted); font-size: inherit; font-weight: 650; }
.rider-resend:disabled { color: var(--muted); cursor: not-allowed; }
.rider-code-input { font-size: 30px !important; font-weight: 850; letter-spacing: .26em; text-align: center; }
.rider-code-hint { margin: -5px 0 0; color: var(--muted); font-size: 10px; text-align: center; }
.rider-auth-footer { display: flex; justify-content: space-between; gap: 14px; padding: 22px 24px 0; color: #aebfb7; font-size: 9px; }
.rider-auth-footer b { color: white; font-weight: 750; }
.rider-auth-footer a { color: var(--lime); text-decoration: none; }
.legal-body { min-height: 100vh; padding: 24px; background: #edf0e9; }
.legal-card { width: min(720px, 100%); margin: 0 auto; padding: clamp(24px, 5vw, 50px); border-radius: 28px; background: white; box-shadow: var(--shadow); }
.legal-card h1 { margin: 8px 0 25px; font-size: clamp(31px, 6vw, 51px); line-height: 1; letter-spacing: -.055em; }
.legal-card p:not(.rider-eyebrow) { color: #53625c; font-size: 14px; line-height: 1.7; }

.rental-card { margin: 14px 0 4px; padding: 12px 14px; border: 1px solid #ecd493; border-radius: 14px; background: var(--yellow-soft); }
.rental-card .label, .rental-card strong, .rental-card small { display: block; }
.rental-card strong { margin: 3px 0; color: #7d570f; font-size: 14px; }
.rental-card small { color: #8b6b2c; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; }
.rental-access-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: #f5f6f1; }
.rental-access-card .label, .rental-access-card strong { display: block; }
.rental-access-card strong { margin-top: 3px; color: var(--green); font-size: 12px; }
.rental-access-card strong.locked { color: var(--red); }
.rental-access-actions { display: flex; gap: 5px; }
.rental-access-actions button { padding: 7px 8px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: white; cursor: pointer; font-size: 8px; font-weight: 800; }
.rental-access-actions button:disabled { opacity: .35; cursor: default; }
