:root {
  --primary: #76b900;
  --primary-dark: #5a8d00;
  --ink: #000000;
  --canvas: #ffffff;
  --surface-dark: #000000;
  --surface-soft: #f7f7f7;
  --surface-elevated: #1a1a1a;
  --hairline: #cccccc;
  --hairline-strong: #5e5e5e;
  --body: #1a1a1a;
  --mute: #757575;
  --stone: #898989;
  --ash: #a7a7a7;
  --on-dark: #ffffff;
  --on-dark-mute: rgba(255, 255, 255, 0.7);
  --error: #e52020;
  --warning: #df6500;
  --success: #3f8500;
  --radius: 2px;
  --content: 1280px;
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--body);
  font-family: Inter, Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
}

.topbar {
  background: var(--surface-dark);
  color: var(--on-dark);
  border-bottom: 1px solid var(--hairline-strong);
}

.topbar__inner {
  width: min(var(--content), calc(100% - 48px));
  height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--on-dark);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
}

.brand__mark {
  width: 28px;
  height: 18px;
  display: inline-block;
  background:
    linear-gradient(90deg, var(--primary) 0 8px, transparent 8px 10px, var(--primary) 10px 18px, transparent 18px 20px, var(--primary) 20px 28px);
}

.topbar__meta {
  color: var(--on-dark-mute);
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero {
  background: var(--surface-dark);
  color: var(--on-dark);
}

.hero__inner {
  width: min(var(--content), calc(100% - 48px));
  min-height: 296px;
  margin: 0 auto;
  padding: 64px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  align-items: end;
  gap: 48px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.43;
  text-transform: uppercase;
}

h1 {
  max-width: 760px;
  margin: 0;
  color: var(--on-dark);
  font-size: 48px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.hero__panel {
  border: 1px solid var(--hairline-strong);
  background: var(--surface-elevated);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric {
  min-height: 118px;
  padding: 24px;
  border-right: 1px solid var(--hairline-strong);
  border-bottom: 1px solid var(--hairline-strong);
}

.metric:nth-child(2n) {
  border-right: 0;
}

.metric:nth-child(n + 3) {
  border-bottom: 0;
}

.metric__value {
  display: block;
  color: var(--primary);
  font-size: 36px;
  font-weight: 700;
  line-height: 1.25;
}

.metric__label {
  display: block;
  margin-top: 4px;
  color: var(--on-dark-mute);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.43;
}

.button {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  color: var(--ink);
  background: var(--primary);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.button:hover,
.button:focus-visible {
  background: var(--primary-dark);
  outline: 0;
}

.button:focus-visible,
.tab:focus-visible,
.search input:focus-visible,
.select:focus-visible {
  box-shadow: 0 0 0 2px var(--primary);
}

.button--dark-outline {
  background: transparent;
  color: var(--on-dark);
  border: 1px solid var(--on-dark);
  padding: 10px 18px;
}

.button--dark-outline:hover,
.button--dark-outline:focus-visible {
  background: var(--on-dark);
  color: var(--ink);
}

.button--outline {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--primary);
  padding: 9px 13px;
}

.button--outline:hover,
.button--outline:focus-visible {
  background: var(--primary);
  color: var(--ink);
}

.button__icon {
  font-size: 18px;
  line-height: 1;
}

.controls {
  background: var(--surface-soft);
  border-bottom: 1px solid var(--hairline);
}

.controls__inner {
  width: min(var(--content), calc(100% - 48px));
  min-height: 72px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) 220px;
  align-items: center;
  gap: 16px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tab {
  min-height: 40px;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 18px;
  background: transparent;
  color: var(--ink);
  font-size: 14.4px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.144px;
}

.tab.is-active {
  background: var(--ink);
  color: var(--on-dark);
}

.search {
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--canvas);
  padding: 0 14px;
}

.search span {
  color: var(--mute);
  font-weight: 700;
}

.search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--ink);
  padding: 0 12px;
}

.status-strip {
  background: var(--canvas);
}

.status-strip__inner {
  width: min(var(--content), calc(100% - 48px));
  min-height: 48px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--mute);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.43;
}

.status-dot {
  width: 12px;
  height: 12px;
  background: var(--primary);
  display: inline-block;
  flex: 0 0 auto;
}

.status-strip.is-busy .status-dot {
  animation: pulse 850ms steps(2, end) infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

.grid-section {
  width: min(var(--content), calc(100% - 48px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

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

.card {
  position: relative;
  min-width: 0;
  min-height: 342px;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--canvas);
  padding: 24px;
}

.corner {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--primary);
}

.corner--tl {
  top: -1px;
  left: -1px;
}

.card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.card__label {
  margin: 0 0 8px;
  color: var(--mute);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.card__title {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.47;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.change-badge,
.route-badge,
.tag,
.phone-pill {
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  background: var(--surface-soft);
  color: var(--body);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}

.change-badge.is-new,
.change-badge.is-changed {
  background: var(--primary);
  color: var(--ink);
}

.change-badge.is-down {
  background: var(--error);
  color: var(--on-dark);
}

.card__meta {
  margin: 24px 0 0;
  display: grid;
  gap: 16px;
}

.card__meta div {
  min-width: 0;
}

.card__meta dt {
  margin: 0 0 6px;
  color: var(--mute);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}

.card__meta dd {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.67;
  overflow-wrap: anywhere;
}

.phones,
.rules {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.phone-pill {
  background: var(--ink);
  color: var(--on-dark);
}

.tag.is-open {
  background: var(--primary);
  color: var(--ink);
}

.tag.is-warn {
  background: #feeeb2;
  color: var(--ink);
}

.tag.is-error {
  background: var(--error);
  color: var(--on-dark);
}

.card__foot {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.open-button {
  flex: 0 0 auto;
}

.empty {
  position: relative;
  display: none;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  min-height: 184px;
  align-items: center;
  justify-content: center;
  background: var(--canvas);
  color: var(--mute);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
}

.empty p {
  margin: 0;
}

.cards:empty + .empty {
  display: flex;
}

@media (max-width: 1180px) {
  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .hero__inner {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .controls__inner {
    grid-template-columns: 1fr;
    padding: 16px 0;
  }

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

@media (max-width: 620px) {
  .topbar__inner,
  .hero__inner,
  .controls__inner,
  .status-strip__inner,
  .grid-section {
    width: min(100% - 32px, var(--content));
  }

  .topbar__inner {
    height: 56px;
  }

  .hero__inner {
    padding: 32px 0;
    gap: 32px;
  }

  h1 {
    font-size: 32px;
  }

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

  .metric {
    min-height: 94px;
    padding: 16px;
  }

  .metric__value {
    font-size: 30px;
  }

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

  .tab {
    width: 100%;
  }

  .cards {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .card {
    min-height: 0;
  }

  .card__foot {
    align-items: stretch;
    flex-direction: column;
  }

  .open-button {
    width: 100%;
  }
}
