:root {
  --bg: #f5f8fc;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-soft: #f7f9fc;
  --line: rgba(129, 149, 176, 0.18);
  --line-strong: rgba(96, 122, 156, 0.28);
  --text: #23354d;
  --muted: #6b809d;
  --brand: #6687ab;
  --brand-strong: #49698f;
  --accent: #67a2d8;
  --success: #43b581;
  --warning: #d79a32;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --shadow: 0 18px 55px rgba(49, 82, 128, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: 'Manrope', sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(120, 167, 222, 0.14), transparent 34%),
    radial-gradient(circle at 100% 10%, rgba(145, 188, 232, 0.12), transparent 28%),
    linear-gradient(180deg, #fbfdff 0%, #f4f8fc 100%);
}

body {
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1400px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(18px);
  background: rgba(255, 255, 255, 0.84);
  border-bottom: 1px solid rgba(129, 149, 176, 0.12);
}

.topbar-inner {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--brand-strong), var(--accent));
  box-shadow: 0 12px 28px rgba(73, 105, 143, 0.28);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 28px;
}

.topnav a {
  position: relative;
  padding: 28px 4px;
  color: var(--muted);
  font-weight: 700;
}

.topnav a.active,
.topnav a:hover {
  color: var(--text);
}

.topnav a.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-strong), var(--accent));
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  background: linear-gradient(135deg, #9fb4ca, #6e88a7);
}

.button,
.ghost-button,
.link-button {
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  cursor: pointer;
  transition: 0.2s ease;
}

.button {
  color: white;
  background: linear-gradient(135deg, var(--brand-strong), var(--accent));
  box-shadow: 0 12px 28px rgba(73, 105, 143, 0.2);
}

.ghost-button,
.link-button {
  color: var(--text);
  background: white;
  border: 1px solid var(--line);
}

.button:hover,
.ghost-button:hover,
.link-button:hover {
  transform: translateY(-1px);
}

.page {
  padding: 30px 0 54px;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-filter {
  display: flex;
  justify-content: flex-end;
  min-width: 240px;
}

.filter-select {
  width: min(280px, 100%);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 10px;
  color: #7e97b4;
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 800;
}

.hero h1,
.hero h2 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 3vw, 3rem);
  letter-spacing: -0.03em;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.grid-4,
.grid-3,
.grid-2,
.card-grid {
  display: grid;
  gap: 18px;
}

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

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

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

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

.metric-card span,
.stat-card span,
.info-line span,
.table-head span,
.detail-stat span,
.settings-copy,
.mini-copy {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.dashboard-panels {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.dashboard-panels .card,
.grid-2 > .card {
  min-height: 320px;
}

.vehicle-showcase {
  display: grid;
  gap: 22px;
}

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

.vehicle-preview {
  padding: 18px;
  border-radius: 18px;
  background: var(--surface-soft);
  border: 1px solid rgba(129, 149, 176, 0.12);
}

.vehicle-preview img,
.vehicle-image {
  width: 100%;
  height: 240px;
  object-fit: contain;
}

.vehicle-image {
  width: 150%;
  height: auto;
  max-width: none;
  transform: scale(1.18);
  transform-origin: center center;
}

.vehicle-preview strong,
.detail-stat strong,
.settings-block h3,
.table-row strong {
  display: block;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.85rem;
}

.status-pill.online {
  color: var(--success);
  background: rgba(67, 181, 129, 0.12);
}

.status-pill.warning {
  color: var(--warning);
  background: rgba(215, 154, 50, 0.12);
}

.table-wrap {
  display: grid;
  gap: 12px;
}

.table-head,
.row-grid {
  display: grid;
  grid-template-columns: 110px minmax(220px, 1.6fr) 130px 130px 130px 130px 130px;
  gap: 12px;
  align-items: center;
}

.table-head {
  padding: 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 800;
}

.table-row {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  overflow: hidden;
}

.table-row summary {
  list-style: none;
  cursor: pointer;
  padding: 0;
}

.table-row summary::-webkit-details-marker {
  display: none;
}

.row-grid {
  width: 100%;
  padding: 16px 18px;
}

.table-row[open] summary {
  border-bottom: 1px solid var(--line);
}

.row-kind {
  font-weight: 800;
  color: var(--brand-strong);
}

.row-name {
  font-weight: 700;
  min-width: 0;
}

.row-grid > span {
  min-width: 0;
}

.row-grid > span:not(:last-child) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stop-row summary {
  background: linear-gradient(180deg, rgba(255, 248, 236, 0.92), rgba(255, 255, 255, 0.98));
}

.detail-panel {
  padding: 18px;
}

.detail-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.detail-stat {
  padding: 16px;
  border-radius: 18px;
  background: var(--surface-soft);
  border: 1px solid rgba(129, 149, 176, 0.12);
}

.detail-stat span {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.92rem;
}

.trip-map,
.charge-map {
  height: 280px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  margin-bottom: 18px;
}

iframe.charge-map {
  width: 100%;
  border: 0;
  display: block;
}

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

.activity-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding: 14px 0;
  border-top: 1px solid rgba(129, 149, 176, 0.14);
}

.activity-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.activity-item strong {
  display: block;
  margin-bottom: 4px;
}

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

.vehicle-card {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px;
  align-items: center;
  padding: 16px;
}

.vehicle-card > div:last-child {
  min-width: 0;
}

.vehicle-visual {
  min-height: 150px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.vehicle-header h3 {
  font-size: 0.98rem;
  letter-spacing: -0.02em;
}

.vehicle-header p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.2;
}

.vehicle-header .eyebrow {
  margin-bottom: 6px;
  font-size: 0.72rem;
}

.vehicle-note {
  margin-top: 8px !important;
  max-width: 420px;
  color: var(--muted);
  font-size: 0.76rem !important;
  line-height: 1.25 !important;
}

.vehicle-meters {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 0 10px;
  min-width: 0;
}

.meter-card {
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface-soft);
  border: 1px solid rgba(129, 149, 176, 0.12);
}

.meter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.82rem;
}

.meter-value {
  color: var(--text);
  font-weight: 800;
  font-size: 0.84rem;
  white-space: nowrap;
}

.progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(108, 132, 165, 0.12);
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #5d88f7, #36c09a);
}

.meter-note {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}

.vehicle-actions,
.settings-actions,
.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

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

.vehicle-stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  min-width: 0;
}

.vehicle-stats-grid .detail-stat {
  padding: 10px 12px;
  border-radius: 14px;
  min-width: 0;
}

.vehicle-stats-grid .detail-stat span {
  display: block;
  font-size: 0.8rem;
  line-height: 1.1;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vehicle-stats-grid .detail-stat strong {
  font-size: 0.82rem;
  line-height: 1.15;
  word-break: normal;
  overflow-wrap: normal;
  white-space: normal;
}

.vehicle-actions {
  margin-top: 12px;
}

.vehicle-actions .button {
  padding: 10px 16px;
  font-size: 0.92rem;
  border-radius: 999px;
}

.settings-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
}

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

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

.field,
.auth-field {
  display: grid;
  gap: 8px;
}

.field input,
.auth-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 26px;
}

.auth-shell {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 460px;
  gap: 26px;
}

.auth-panel,
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 32px;
}

.auth-panel {
  padding: 48px;
  min-height: 620px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    radial-gradient(circle at 0% 0%, rgba(120, 167, 222, 0.16), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.96));
}

.auth-card {
  padding: 34px;
}

.auth-card h2 {
  margin: 0 0 8px;
  font-size: 2rem;
  letter-spacing: -0.03em;
}

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

.auth-switch {
  margin-top: 18px;
  color: var(--muted);
}

.hero-tags,
.page-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.hero-tags span,
.page-tags span {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
}

.placeholder {
  text-align: center;
  color: var(--muted);
  padding: 28px 20px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  max-width: 420px;
  padding: 14px 18px;
  border-radius: 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.toast.error {
  border-color: rgba(207, 85, 85, 0.24);
}

.hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .topbar-inner,
  .hero,
  .dashboard-panels,
  .settings-layout,
  .auth-shell {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topnav {
    flex-wrap: wrap;
    justify-content: center;
  }

  .vehicles-grid,
  .grid-4,
  .grid-3,
  .grid-2,
  .vehicle-card,
  .vehicle-preview-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 860px) {
  .shell {
    width: min(100%, calc(100% - 24px));
  }

  .page-filter {
    width: 100%;
    justify-content: flex-start;
  }

  .table-head {
    display: none;
  }

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

  .topbar-inner {
    display: grid;
    justify-items: center;
    padding: 16px 0;
  }

  .topbar-user {
    width: 100%;
    justify-content: center;
  }

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