:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #647184;
  --line: #d9e2ee;
  --panel: #ffffff;
  --soft: #f2f6fb;
  --blue: #0b4ea2;
  --blue-2: #0d7adf;
  --green: #26b864;
  --amber: #f59e0b;
  --red: #db2f2f;
  --shadow: 0 18px 45px rgba(23, 32, 51, 0.12);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 56px);
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  text-decoration: none;
}

.brand *,
.brand:hover {
  text-decoration: none;
}

.brand-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-2));
  font-weight: 800;
  letter-spacing: 0;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.1;
  text-transform: uppercase;
}

.brand span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.nav-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.contact-link {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.contact-link:hover {
  text-decoration: underline;
}

.button,
button {
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  color: #fff;
  background: var(--blue);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.button:hover,
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(11, 78, 162, 0.18);
}

.button.call {
  background: var(--blue);
}

.button.secondary,
button.secondary {
  color: var(--blue);
  background: #e8f2ff;
}

.button.danger,
button.danger {
  background: var(--red);
}

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 470px) minmax(0, 1fr);
  min-height: calc(100vh - 83px);
}

.public-page {
  display: grid;
  gap: 22px;
  padding: 22px clamp(18px, 4vw, 56px) 36px;
}

.info-accordion {
  display: grid;
  gap: 10px;
  max-width: 1180px;
}

.info-accordion details,
.map-card,
.evidence-section,
.admin-map-section,
.admin-table-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(23, 32, 51, 0.06);
}

.info-accordion details {
  padding: 0;
  overflow: hidden;
}

.info-accordion summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.info-accordion summary::-webkit-details-marker {
  display: none;
}

.info-accordion summary::after {
  content: "+";
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  color: var(--blue);
  background: #e8f2ff;
  font-size: 22px;
  line-height: 1;
}

.info-accordion details[open] summary::after {
  content: "−";
}

.info-accordion p {
  margin: 0;
  padding: 0 18px 16px;
  color: #3b4758;
  line-height: 1.55;
}

.section-heading h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

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

.map-card {
  position: relative;
  overflow: hidden;
}

.map-card #map {
  min-height: 620px;
}

.evidence-section {
  padding: 18px;
}

.sidebar {
  padding: 22px;
  overflow: auto;
  background: #fff;
  border-right: 1px solid var(--line);
}

.notice {
  padding: 18px;
  border: 1px solid #ffd38a;
  border-left: 6px solid var(--amber);
  border-radius: 8px;
  background: #fff8ea;
}

.notice h2,
.panel h2,
.drawer h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.notice p,
.panel p,
.drawer p {
  margin: 0;
  color: #3b4758;
  line-height: 1.55;
}

.filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 18px 0;
}

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

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

.vehicle-list {
  display: grid;
  gap: 12px;
}

.vehicle-card {
  display: grid;
  gap: 9px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.vehicle-card:hover {
  border-color: #8cbbed;
  box-shadow: 0 8px 18px rgba(23, 32, 51, 0.08);
}

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

.vehicle-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  color: #fff;
  background: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.map-wrap {
  position: relative;
  min-height: 520px;
}

#map,
#admin-map {
  width: 100%;
  height: 100%;
  min-height: calc(100vh - 83px);
}

.drawer {
  position: absolute;
  right: 24px;
  bottom: 24px;
  z-index: 500;
  width: min(430px, calc(100% - 48px));
  max-height: calc(100vh - 140px);
  overflow: auto;
  padding: 18px;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.drawer[hidden] {
  display: none;
}

.drawer-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 8px;
  color: var(--ink);
  background: #edf2f7;
}

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

.detail-box {
  padding: 11px;
  border-radius: 8px;
  background: var(--soft);
}

.detail-box small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail-box strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(380px, 520px) minmax(0, 1fr);
  min-height: calc(100vh - 83px);
}

.admin-workspace {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.admin-map-section {
  position: relative;
  overflow: hidden;
}

.admin-map-section #admin-map {
  min-height: 560px;
}

.map-instruction {
  position: absolute;
  top: 92px;
  left: 50%;
  z-index: 500;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 36px));
  padding: 14px 18px;
  border: 1px solid #8cbbed;
  border-radius: 8px;
  color: #073b80;
  background: #e8f2ff;
  box-shadow: var(--shadow);
  text-align: center;
  font-weight: 800;
}

.is-adding-map-point #admin-map {
  cursor: crosshair;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.admin-table-section {
  overflow: hidden;
}

.table-wrap {
  overflow: auto;
}

.vehicles-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.vehicles-table th,
.vehicles-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.vehicles-table th {
  color: #405066;
  background: #f7f9fc;
  font-size: 12px;
  text-transform: uppercase;
}

.vehicles-table tr {
  cursor: pointer;
}

.vehicles-table tbody tr:hover {
  background: #f0f6ff;
}

.vehicles-table td span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.vehicles-table .is-archived {
  color: #687386;
  background: #fafafa;
}

.empty-cell {
  color: var(--muted);
  text-align: center !important;
}

.editor-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 800;
  width: min(560px, 100%);
  height: 100vh;
  overflow: auto;
  padding: 20px;
  border-left: 1px solid var(--line);
  background: #fff;
  box-shadow: -20px 0 45px rgba(23, 32, 51, 0.16);
}

.editor-panel[hidden] {
  display: none;
}

.token-input {
  width: 220px;
}

.admin-panel {
  padding: 22px;
  overflow: auto;
  background: #fff;
  border-right: 1px solid var(--line);
}

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

.field-full {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
  color: #405066;
  font-size: 13px;
  font-weight: 700;
}

.hint {
  margin: 12px 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.admin-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
  border: 1px dashed #b5c4d6;
  border-radius: 8px;
  background: #fafcff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 900;
  transform: translateX(-50%);
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  background: #172033;
  box-shadow: var(--shadow);
}

.toast[hidden] {
  display: none;
}

.site-footer {
  padding: 28px clamp(18px, 4vw, 56px);
  text-align: center;
}

.site-footer a {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--blue);
  text-decoration: underline;
}

.quiet-admin-link {
  position: fixed;
  right: 18px;
  bottom: 14px;
  z-index: 1000;
  padding: 6px 8px;
  border-radius: 8px;
  color: #7b8798;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 6px 18px rgba(23, 32, 51, 0.08);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  opacity: 0.55;
}

.quiet-admin-link:hover,
.quiet-admin-link:focus {
  color: var(--blue);
  background: #fff;
  text-decoration: none;
  opacity: 1;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--soft);
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.login-logo {
  width: 86px;
  height: 86px;
  object-fit: contain;
}

.login-panel h1,
.login-panel p {
  margin: 0;
}

.login-panel p {
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 920px) {
  .layout,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .admin-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  #map,
  #admin-map {
    min-height: 620px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav-actions {
    justify-content: flex-start;
  }

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