:root {
  color-scheme: light;
  --bg: #f6f9fc;
  --panel: #ffffff;
  --ink: #18324f;
  --muted: #66727d;
  --line: #d7e0e8;
  --line-strong: #b9c7d4;
  --navy: #1e5a83;
  --navy-dark: #143f61;
  --box: #f6f8fa;
  --accent: #327ba5;
  --accent-dark: #19577f;
  --ok: #176c4a;
  --bad: #9b2f2f;
  --warn: #8a5600;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 32px;
  background: var(--navy);
  color: #ffffff;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 19px;
}

h3 {
  font-size: 18px;
}

h3 span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.eyebrow {
  margin-bottom: 5px;
  color: #d5e7f4;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

main {
  padding: 24px 32px 40px;
}

.hidden {
  display: none !important;
}

.panel {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

.narrow {
  max-width: 460px;
}

.stack {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.user-form {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 0.8fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
  font-weight: 650;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  font: inherit;
  font-weight: 700;
}

button:disabled {
  color: #8996a3;
  cursor: not-allowed;
  opacity: 0.72;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.ghost {
  border-color: #96bad3;
  background: #2c6a92;
  color: #ffffff;
}

.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.page-tabs button {
  border-color: var(--line-strong);
  background: #ffffff;
}

.page-tabs button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

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

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

.stat-box {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--box);
  padding: 12px;
}

.stat-box span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat-box strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.muted,
.section-head p {
  color: var(--muted);
  font-size: 13px;
}

.message {
  min-height: 20px;
  color: var(--bad);
  font-weight: 700;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

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

.charger-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

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

.charger-card-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.status {
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef2f5;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.status.idle,
.status.plugged_in {
  background: #eaf7f1;
  color: var(--ok);
}

.status.charging {
  background: #e5f4ff;
  color: #135d85;
}

.status.busy,
.status.full {
  background: #fff4d7;
  color: var(--warn);
}

.status.offline,
.status.error {
  background: #fae8e8;
  color: var(--bad);
}

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

.metrics div {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--box);
  padding: 9px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metrics strong {
  display: block;
  margin-top: 3px;
  font-size: 19px;
}

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

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

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

th {
  background: #eef3f7;
  color: var(--navy-dark);
  font-size: 12px;
  text-transform: uppercase;
}

.subtle {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.ok-text {
  color: var(--ok);
}

.warn-text {
  color: var(--warn);
}

tr:last-child td {
  border-bottom: 0;
}

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

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    padding: 18px;
  }

  h1 {
    font-size: 23px;
  }

  main {
    padding: 18px;
  }

  .panel {
    padding: 14px;
  }

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

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