:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #182033;
  background: #f4f6f8;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid #d4dae3;
  border-radius: 6px;
  background: #ffffff;
  color: #182033;
  min-height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

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

button.primary {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #ffffff;
}

button.ghost {
  background: transparent;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #182033;
  padding: 0 10px;
}

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

h1,
h2,
p {
  margin: 0;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(18, 24, 38, 0.48), rgba(18, 24, 38, 0.48)),
    url("https://images.unsplash.com/photo-1544620347-c4fd4a3d5957?auto=format&fit=crop&w=1800&q=80") center/cover;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 22px 64px rgba(15, 23, 42, 0.24);
}

.login-panel h1 {
  margin-top: 4px;
  font-size: 30px;
}

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

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.brand,
.topbar nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand {
  font-weight: 800;
  color: #0f172a;
}

.topbar nav button {
  border-color: transparent;
}

.topbar nav button.active {
  background: #e0ecff;
  color: #1d4ed8;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 290px 1fr;
}

.sidebar {
  min-height: 0;
  overflow: auto;
  padding: 16px;
  border-right: 1px solid #dbe2ea;
  background: #f8fafc;
}

.section-title {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #334155;
  font-weight: 800;
}

.icon-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.vehicle-row {
  width: 100%;
  display: grid;
  grid-template-columns: 12px 1fr;
  align-items: center;
  text-align: left;
  justify-content: start;
  margin-top: 8px;
  padding: 10px;
  min-height: 58px;
  background: #ffffff;
}

.vehicle-row.selected {
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px #dbeafe;
}

.vehicle-row span:last-child {
  display: grid;
  gap: 3px;
}

.vehicle-row small {
  color: #64748b;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #64748b;
}

.status-dot.large {
  width: 18px;
  height: 18px;
}

.status-dot.online {
  background: #16a34a;
}

.status-dot.stale {
  background: #ca8a04;
}

.status-dot.alarm {
  background: #dc2626;
}

.status-dot.offline {
  background: #64748b;
}

.main-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 330px;
}

.map-wrap {
  min-height: 0;
  padding: 16px;
}

.map {
  width: 100%;
  height: calc(100vh - 96px);
  min-height: 520px;
  border: 1px solid #dbe2ea;
  border-radius: 8px;
  overflow: hidden;
}

.details {
  min-height: 0;
  padding: 18px;
  background: #ffffff;
  border-left: 1px solid #dbe2ea;
  overflow: auto;
}

.vehicle-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.vehicle-head h2,
.content h2 {
  font-size: 22px;
}

.eyebrow {
  color: #1d4ed8;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0;
  font-weight: 800;
}

dl {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

dl div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eef2f7;
}

dt {
  color: #64748b;
}

dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}

.action-row,
.toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.content {
  min-height: 0;
  overflow: auto;
  padding: 20px;
}

.content.narrow {
  max-width: 820px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.stats article {
  border: 1px solid #dbe2ea;
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  display: grid;
  gap: 6px;
}

.stats span {
  color: #64748b;
  font-size: 13px;
}

.stats strong {
  font-size: 22px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid #dbe2ea;
  border-radius: 8px;
  background: #ffffff;
}

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

th,
td {
  padding: 12px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
}

th {
  color: #475569;
  font-size: 13px;
  background: #f8fafc;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr)) auto;
  align-items: end;
  gap: 12px;
  margin: 14px 0 28px;
}

pre {
  white-space: pre-wrap;
  background: #0f172a;
  color: #dbeafe;
  padding: 16px;
  border-radius: 8px;
  overflow: auto;
}

.error {
  color: #b91c1c;
}

.muted {
  color: #64748b;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr;
    height: auto;
    padding: 12px;
  }

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

  .workspace,
  .main-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 1fr);
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid #dbe2ea;
  }

  .section-title {
    grid-column: 1 / -1;
  }

  .details {
    border-left: 0;
    border-top: 1px solid #dbe2ea;
  }

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

  .map {
    height: 58vh;
    min-height: 360px;
  }
}
