:root {
  color-scheme: light;
  --page: #f7f4ee;
  --paper: #fffdf8;
  --panel: rgba(255, 253, 248, 0.92);
  --ink: #221f1c;
  --muted: #756e65;
  --line: #e2d8ca;
  --fire: #c21f26;
  --fire-deep: #8f1518;
  --amber: #f0b429;
  --green: #18a368;
  --yellow: #e5ae24;
  --red: #d13f35;
  --shadow: 0 18px 40px rgba(82, 54, 30, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(194, 31, 38, 0.18), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(247, 244, 238, 0.88)),
    var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  width: min(100%, 900px);
  margin: 0 auto;
  padding: 14px 12px 30px;
}

.topbar {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 14px 2px 18px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  border: 2px solid #f7cc55;
  border-radius: 16px;
  background: var(--fire);
  box-shadow: 0 12px 24px rgba(143, 21, 24, 0.24);
  object-fit: cover;
}

.kicker,
h1 {
  margin: 0;
}

.kicker {
  color: var(--fire-deep);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1 {
  margin-top: 2px;
  font-size: clamp(34px, 11vw, 58px);
  line-height: 0.95;
  letter-spacing: 0;
}

.sync-state {
  grid-column: 1 / -1;
  justify-self: start;
  padding: 8px 10px;
  border: 1px solid rgba(24, 163, 104, 0.24);
  border-radius: 999px;
  background: #edf8f2;
  color: #12663d;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.sync-state[data-mode="local"] {
  border-color: rgba(240, 180, 41, 0.38);
  background: #fff7df;
  color: #8a5b09;
}

.sync-state[data-mode="error"] {
  border-color: rgba(209, 63, 53, 0.3);
  background: #fff0ee;
  color: #8f2118;
}

.summary-band,
.status-board {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.section-title span {
  color: var(--ink);
}

.section-title strong {
  color: var(--fire-deep);
  font-size: 12px;
}

.vehicle-list,
.role-grid {
  display: grid;
  gap: 10px;
}

.vehicle-card,
.role-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.vehicle-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 86px;
  padding: 14px;
}

.vehicle-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: var(--red);
}

.vehicle-card.ready::before {
  background: var(--green);
}

.vehicle-card.not-ready {
  opacity: 0.82;
}

.vehicle-name {
  display: block;
  font-size: 28px;
  font-weight: 900;
}

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

.vehicle-state {
  min-width: 98px;
  padding: 9px 11px;
  border-radius: 999px;
  background: #fff0ee;
  color: #8f2118;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.vehicle-card.ready .vehicle-state {
  background: #e8f8ef;
  color: #12663d;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffaf1;
}

.role-card {
  padding: 12px;
}

.role-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.role-heading h2 {
  margin: 0;
  font-size: 19px;
}

.role-count {
  color: var(--fire-deep);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.member-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 64px;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(180deg, #ffffff, #fffaf2);
  color: var(--ink);
}

.member-name {
  min-width: 0;
  overflow-wrap: normal;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.18;
}

.traffic {
  display: flex;
  gap: 7px;
  padding: 6px;
  border: 1px solid #e0d4c3;
  border-radius: 999px;
  background: #f3eee6;
}

.light-button,
.dot {
  display: block;
  border-radius: 50%;
}

.light-button {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.78);
  background: #cfc8bd;
  cursor: pointer;
  opacity: 0.35;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.light-button.active {
  opacity: 1;
  box-shadow:
    0 0 0 3px rgba(34, 31, 28, 0.08),
    0 8px 16px currentColor;
}

.light-button:active {
  transform: scale(0.92);
}

.light-button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.green {
  color: var(--green);
  background: var(--green);
}

.yellow {
  color: var(--yellow);
  background: var(--yellow);
}

.red {
  color: var(--red);
  background: var(--red);
}

.dot {
  width: 11px;
  height: 11px;
}

.status-label {
  display: block;
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

@media (min-width: 680px) {
  .app-shell {
    padding-top: 28px;
  }

  .topbar {
    grid-template-columns: 64px minmax(0, 1fr) auto;
  }

  .brand-mark {
    width: 64px;
    height: 64px;
  }

  .sync-state {
    grid-column: auto;
  }

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

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

  .vehicle-card {
    grid-template-columns: 1fr;
    align-content: space-between;
  }

  .member-card {
    grid-template-columns: 1fr;
  }

  .traffic {
    justify-self: start;
  }
}
