:root {
  --ink: #163b40;
  --muted: #667d80;
  --teal: #008777;
  --line: #dbe6e5;
  --bg: #f1f5f4;
  --danger: #d93743;
  --amber: #d98a14;
  font-family: Inter, Arial, sans-serif;
  color: var(--ink);
  font-size: 15px
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  background: var(--bg)
}

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

button,
.button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 15px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px
}

button:hover,
.button:hover {
  border-color: var(--teal);
  background: #eef8f5
}

button:disabled {
  opacity: .5;
  cursor: wait
}

button.primary,
.button.primary {
  background: var(--teal);
  color: white;
  border-color: var(--teal)
}

button.danger {
  color: var(--danger);
  border-color: #edc6cb
}

.quiet {
  background: none;
  border: 0
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cad9d7;
  border-radius: 7px;
  background: white;
  color: var(--ink);
  min-height: 42px
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #99d9cd;
  outline-offset: 1px
}

textarea {
  min-height: 85px;
  resize: vertical
}

label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin: 12px 0
}

label input,
label select,
label textarea {
  margin-top: 7px;
  font-weight: 400
}

input[type=checkbox] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--teal);
  vertical-align: middle
}

.check {
  display: flex;
  align-items: center;
  gap: 8px
}

.check input {
  margin: 0
}

h1,
h2,
h3,
p {
  margin-top: 0
}

h1 {
  font-size: 27px;
  letter-spacing: -.7px;
  margin-bottom: 0
}

h2 {
  font-size: 22px
}

h3 {
  font-size: 17px;
  margin-bottom: 10px
}

.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 1.8px;
  font-weight: 700;
  color: var(--teal);
  margin-bottom: 8px
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  padding: 12px 6px 30px
}

.brand small {
  font-size: 14px;
  font-weight: 400
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--teal);
  border-radius: 10px;
  color: white;
  font-size: 25px;
  font-weight: 700
}

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 220px;
  padding: 25px 16px;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 5
}

nav {
  display: grid;
  gap: 6px
}

nav a {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  padding: 13px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 17px
}

nav a span {
  font-size: 14px
}

nav a.active {
  color: var(--teal);
  background: #e6f4ef;
  font-weight: 700
}

nav b {
  margin-left: auto;
  background: #e7eeec;
  border-radius: 12px;
  min-width: 22px;
  padding: 2px 5px;
  text-align: center;
  font-size: 12px
}

nav a.alert,
nav a.alert b {
  color: white;
  background: var(--danger)
}

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding: 16px 5px 0;
  font-size: 13px;
  display: grid;
  gap: 10px
}

main {
  margin-left: 220px;
  padding: 28px 30px
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 26px
}

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

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  margin-bottom: 22px
}

.stat {
  background: white;
  border: 1px solid var(--line);
  padding: 18px 20px;
  border-radius: 12px
}

.stat strong {
  display: block;
  font-size: 28px;
  margin-top: 10px;
  letter-spacing: -1px
}

.stat.alert {
  border-color: #eebfc1;
  background: #fff4f4
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 15px
}

.toolbar input {
  max-width: 250px
}

.toolbar select {
  width: auto;
  max-width: 210px
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px
}

.map-surface {
  background: #e5ede7;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  min-height: 550px
}

#mapCanvas {
  height: calc(100vh - 295px);
  min-height: 550px
}

.map-empty {
  padding: 70px 40px;
  text-align: center;
  line-height: 1.7
}

.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px
}

.side-panel {
  max-height: calc(100vh - 240px);
  overflow: auto
}

.scooter-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  align-items: start
}

.scooter-row strong {
  font-size: 14px
}

.scooter-row small {
  display: block;
  font-size: 12px;
  margin-top: 5px;
  color: var(--muted)
}

.scooter-row .details {
  border: 0;
  padding: 0;
  min-height: 0;
  text-align: left;
  display: block;
  background: none;
  flex: 1
}

.scooter-list {
  max-height: 370px;
  overflow: auto
}

.pill {
  display: inline-block;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 5px;
  background: #e6f1ee;
  color: var(--teal);
  white-space: nowrap
}

.pill.red {
  background: #fee7e8;
  color: #b72b37
}

.pill.amber {
  background: #fff0d4;
  color: #9d620c
}

.pill.gray {
  background: #edf0f1;
  color: #596e74
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px
}

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

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
  margin-bottom: 12px
}

.card h3 {
  margin: 0
}

.card p {
  line-height: 1.6;
  font-size: 14px;
  margin-bottom: 10px
}

.card .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 15px
}

.card.overdue {
  border-left: 4px solid var(--danger)
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 17px;
  font-weight: 700;
  color: var(--teal);
  padding: 8px 0
}

.timer.red {
  color: var(--danger)
}

.photos {
  display: flex;
  gap: 7px;
  overflow: auto;
  margin: 12px 0
}

.photos img {
  width: 100px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px
}

.photo-preview img {
  width: 90px;
  height: 90px;
  object-fit: cover;
  margin: 5px;
  border-radius: 8px
}

.table-wrap {
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap
}

th {
  background: #eaf1ee;
  color: #526d6d;
  font-size: 12px
}

.empty {
  padding: 55px 25px;
  text-align: center;
  background: white;
  border: 1px dashed #c7d8d2;
  border-radius: 12px;
  color: var(--muted)
}

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

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

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

.banner {
  padding: 13px 18px;
  border-radius: 8px;
  background: #fff2db;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.5
}

.error {
  color: #ac2936
}

.banner.error {
  background: #ffebed
}

.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 0;
  color: var(--muted);
  font-size: 12px
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px
}

.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at top right, #c9e3d9, transparent 70%)
}

.login-card {
  width: min(440px, 92vw);
  padding: 38px;
  background: white;
  box-shadow: 0 20px 80px #123f4312;
  border-radius: 18px;
  border: 1px solid var(--line)
}

.login-card .brand-mark {
  margin-bottom: 28px
}

.login-card h1 {
  margin-bottom: 12px
}

.login-card button {
  width: 100%;
  margin-top: 14px
}

.login-card .eyebrow {
  font-size: 9px
}

dialog {
  width: min(650px, 95vw);
  border: 0;
  border-radius: 14px;
  padding: 25px;
  color: var(--ink);
  box-shadow: 0 25px 100px #102c4750;
  max-height: 92dvh;
  overflow: auto
}

dialog::backdrop {
  background: #122e3c75;
  backdrop-filter: blur(3px)
}

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

.modal-header h2 {
  margin: 0
}

.modal-header button {
  font-size: 24px;
  border: 0;
  min-height: 32px;
  padding: 0 7px
}

dialog .actions {
  margin-top: 20px
}

#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  padding: 13px 20px;
  border-radius: 10px;
  background: #163b40;
  color: white;
  z-index: 9999;
  display: none;
  max-width: 90vw
}

.zone-edit {
  border: 2px solid var(--teal);
  padding: 15px;
  border-radius: 10px;
  background: #e8f5ef;
  margin-bottom: 15px
}

.summary {
  padding: 12px;
  background: #f1f5f3;
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.6
}

.wide {
  grid-column: 1/-1
}

.section-title {
  margin: 24px 0 15px
}

.admin-hidden .admin-only {
  display: none !important
}

[hidden] {
  display: none !important
}

code {
  background: #eaf1ed;
  padding: 3px 5px;
  border-radius: 4px;
  overflow-wrap: anywhere
}

.small {
  font-size: 12px
}

a {
  color: var(--teal)
}

.map-bubble {
  min-width: 200px;
  line-height: 1.6;
  padding: 5px
}

.map-bubble button {
  margin-top: 10px
}

.loading {
  opacity: .6;
  pointer-events: none
}

@media(max-width:1100px) {
  .sidebar {
    width: 180px
  }

  main {
    margin-left: 180px;
    padding: 20px
  }

  .topbar {
    align-items: start
  }

  .top-actions {
    flex-wrap: wrap;
    justify-content: flex-end
  }

  .map-layout {
    grid-template-columns: 1fr 260px
  }

  .stats {
    gap: 8px
  }

  .stat {
    padding: 14px
  }

  .stat strong {
    font-size: 24px
  }
}

@media(max-width:760px) {
  .sidebar {
    position: fixed;
    top: auto;
    bottom: 0;
    width: 100%;
    height: 70px;
    padding: 0;
    border-right: 0;
    border-top: 1px solid var(--line)
  }

  .brand,
  .sidebar-bottom {
    display: none
  }

  nav {
    display: flex;
    overflow: auto;
    gap: 0;
    height: 70px
  }

  nav a {
    min-width: 75px;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    padding: 9px 6px;
    border-radius: 0;
    position: relative
  }

  nav a span {
    font-size: 10px
  }

  nav b {
    position: absolute;
    top: 3px;
    right: 4px;
    min-width: 16px;
    font-size: 10px
  }

  main {
    margin: 0;
    padding: 18px 14px 90px
  }

  .topbar {
    display: block;
    margin-bottom: 18px
  }

  h1 {
    font-size: 24px
  }

  .top-actions {
    justify-content: start;
    margin-top: 15px
  }

  .top-actions .muted {
    display: none
  }

  .stats {
    grid-template-columns: 1fr 1fr;
    margin-bottom: 16px
  }

  .stat strong {
    font-size: 26px
  }

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

  .map-surface {
    min-height: 420px
  }

  #mapCanvas {
    height: 52vh;
    min-height: 420px
  }

  .side-panel {
    max-height: none
  }

  .grid {
    grid-template-columns: 1fr
  }

  .two {
    grid-template-columns: 1fr
  }

  .toolbar {
    gap: 8px
  }

  .toolbar input {
    max-width: none
  }

  .toolbar select {
    max-width: none;
    flex: 1
  }

  .panel,
  .card {
    padding: 17px
  }

  .scooter-list {
    max-height: 260px
  }

  .login-card {
    padding: 28px
  }

  .card .actions button {
    flex: 1
  }

  dialog {
    padding: 20px
  }

  .top-actions button {
    flex: 1;
    font-size: 12px
  }

  #syncState {
    font-size: 11px
  }

  .table-wrap {
    max-width: calc(100vw - 28px)
  }
}
