:root {
  color-scheme: light;
  --color-signal-orange: #ff682c;
  --color-carbon: #202020;
  --color-graphite: #4d4d4d;
  --color-slate: #828282;
  --color-fog: #f5f5f5;
  --color-mist: #efefef;
  --color-chalk: #e8e8e8;
  --color-paper: #ffffff;
  --font-polysans: "Space Grotesk", "DM Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-inter: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --shadow-card: 0 1px 2px rgba(32, 32, 32, 0.04), 0 10px 28px rgba(32, 32, 32, 0.04);
  font-family: var(--font-inter);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--color-carbon);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(255, 255, 255, 0) 260px),
    var(--color-mist);
}

button {
  font: inherit;
}

h1,
h2,
p {
  margin: 0;
}

.shell {
  width: min(1220px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(130, 130, 130, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-card);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--color-carbon);
  color: var(--color-paper);
  font-family: var(--font-polysans);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.04em;
  overflow: hidden;
}

.brand-mark::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: 7px;
  width: 28px;
  height: 10px;
  border: 3px solid var(--color-signal-orange);
  border-left: 0;
  border-top: 0;
  border-radius: 999px;
  transform: rotate(-16deg);
}

.topbar h1 {
  font-family: var(--font-polysans);
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 500;
  line-height: 0.96;
  letter-spacing: -0.045em;
}

.topbar p {
  margin-top: 4px;
  color: var(--color-graphite);
  font-size: 13px;
  line-height: 1.35;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--color-chalk);
  border-radius: 200px;
  padding: 0 13px;
  background: var(--color-fog);
  color: var(--color-graphite);
  font-size: 13px;
  font-weight: 600;
}

.live-badge span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-signal-orange);
}

.button {
  border: 0;
  border-radius: 20px;
  min-height: 38px;
  padding: 0 16px;
  background: var(--color-carbon);
  color: var(--color-paper);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.button.secondary {
  border: 1px solid rgba(32, 32, 32, 0.18);
  background: var(--color-paper);
  color: var(--color-carbon);
}

.button.compact {
  min-height: 34px;
  padding: 0 13px;
  font-size: 13px;
}

.button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.zone-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  width: min(520px, 100%);
  margin: 18px auto 0;
  padding: 5px;
  border: 1px solid rgba(130, 130, 130, 0.34);
  border-radius: 200px;
  background: var(--color-paper);
  box-shadow: var(--shadow-card);
}

.zone-tab {
  border: 0;
  border-radius: 200px;
  min-height: 36px;
  background: transparent;
  color: var(--color-slate);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.zone-tab.active {
  background: var(--color-carbon);
  color: var(--color-paper);
}

.state {
  margin-top: 14px;
  padding: 16px 18px;
  border: 1px solid var(--color-chalk);
  border-radius: 8px;
  background: var(--color-paper);
  color: var(--color-graphite);
  box-shadow: var(--shadow-card);
}

.state.error {
  border-color: rgba(255, 104, 44, 0.55);
  color: #8c3212;
}

.hidden {
  display: none !important;
}

.dashboard {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.days-head {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--color-chalk);
  border-radius: 8px;
  background: var(--color-chalk);
  box-shadow: var(--shadow-card);
}

.days-head > div {
  position: relative;
  min-height: 116px;
  padding: 17px 18px 16px;
  background: var(--color-paper);
}

.days-head > div::before {
  content: "";
  display: block;
  width: 26px;
  height: 3px;
  margin-bottom: 17px;
  border-radius: 99px;
  background: var(--color-chalk);
}

.days-head > div:nth-child(4)::before,
.days-head > div:nth-child(5)::before {
  background: var(--color-signal-orange);
}

.days-head > div:nth-child(6)::before {
  background: var(--color-carbon);
}

.label {
  display: block;
  color: var(--color-slate);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.days-head strong {
  display: block;
  margin-top: 8px;
  font-family: var(--font-polysans);
  font-size: clamp(30px, 4.4vw, 42px);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.05em;
  overflow-wrap: anywhere;
}

.metric-stack,
.sum-stack {
  display: inline-grid;
  gap: 4px;
}

.metric-stack-main,
.sum-stack-main {
  display: block;
}

.metric-stack-meta,
.sum-stack-meta {
  display: block;
  color: var(--color-graphite);
  font-family: var(--font-inter);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0;
}

.day-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}

.day-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--color-chalk);
  border-radius: 8px;
  background: var(--color-paper);
  box-shadow: var(--shadow-card);
}

.day-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--color-chalk);
}

.day-card.active {
  border-color: rgba(255, 104, 44, 0.72);
}

.day-card.active::before {
  background: var(--color-signal-orange);
}

.day-card-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 20px 14px;
}

.day-card h2 {
  margin-top: 3px;
  font-family: var(--font-polysans);
  font-size: 34px;
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.05em;
}

.day-total {
  flex: 0 0 auto;
  border-radius: 20px;
  padding: 7px 10px;
  background: var(--color-fog);
  color: var(--color-graphite);
  font-size: 12px;
  font-weight: 700;
}

.day-spend,
.day-registration-spend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 20px 12px;
  border: 1px solid var(--color-chalk);
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--color-fog);
}

.day-registration-spend {
  margin-top: -4px;
  background: var(--color-paper);
}

.day-spend span,
.day-registration-spend span {
  color: var(--color-slate);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.day-spend strong,
.day-registration-spend strong {
  font-family: var(--font-polysans);
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
}

.day-spend .metric-stack {
  justify-items: end;
}

.day-spend .metric-stack-meta {
  font-size: 12px;
}

.funding-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 20px 16px;
}

.funding-row {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 104px;
  border: 1px solid var(--color-chalk);
  border-top: 3px solid var(--color-signal-orange);
  border-radius: 8px;
  padding: 11px 12px 12px;
  background: var(--color-paper);
}

.funding-row.external {
  border-top-color: var(--color-carbon);
  background: var(--color-fog);
}

.funding-label {
  color: var(--color-slate);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.2;
  text-transform: uppercase;
}

.funding-row strong {
  color: var(--color-carbon);
  font-family: var(--font-polysans);
  font-size: 22px;
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.funding-meta {
  color: var(--color-graphite);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
}

.day-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 20px 20px;
}

.action-button {
  position: relative;
  min-height: 48px;
  border: 1px solid var(--color-chalk);
  border-radius: 20px;
  background: var(--color-paper);
  color: var(--color-carbon);
  cursor: pointer;
  padding: 10px 14px;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
}

.action-button:hover {
  border-color: rgba(255, 104, 44, 0.44);
  background: var(--color-fog);
}

.action-button::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--color-signal-orange);
  vertical-align: 1px;
}

.action-button.purchase::before {
  background: var(--color-carbon);
}

.action-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-panel {
  overflow: hidden;
  border: 1px solid var(--color-chalk);
  border-radius: 8px;
  background: var(--color-paper);
  box-shadow: var(--shadow-card);
}

.detail-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--color-chalk);
  background: var(--color-paper);
}

.detail-head h2 {
  margin-top: 6px;
  font-family: var(--font-polysans);
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.055em;
}

.detail-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  padding: 18px 28px 0;
}

.detail-summary > span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border-radius: 20px;
  padding: 8px 11px;
  background: var(--color-fog);
  color: var(--color-graphite);
  font-size: 13px;
  font-weight: 650;
}

.detail-summary > span strong {
  color: var(--color-carbon);
}

.sum-stack {
  min-width: 70px;
}

.detail-summary .funding-row {
  flex: 1 1 210px;
  min-height: 88px;
  max-width: 280px;
}

.address-breakdown {
  padding: 14px 28px 0;
}

.address-breakdown-title {
  font-family: var(--font-polysans);
  font-size: 13px;
  font-weight: 650;
  color: var(--color-slate);
  margin-bottom: 8px;
}

.address-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.address-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--color-chalk);
  border-radius: 8px;
  background: var(--color-fog);
  font-size: 13px;
}

.address-name {
  color: var(--color-carbon);
  font-weight: 600;
  word-break: break-word;
}

.address-count {
  color: var(--color-graphite);
  white-space: nowrap;
}

.address-count strong {
  color: var(--color-signal-orange);
}

@media (max-width: 720px) {
  .address-breakdown {
    padding: 12px 16px 0;
  }
}

.table-wrap {
  overflow-x: auto;
  padding: 18px 28px 28px;
}

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

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--color-chalk);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--color-slate);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

td {
  color: var(--color-carbon);
  font-size: 14px;
  line-height: 1.38;
}

tbody tr:hover {
  background: var(--color-fog);
}

.product-slots {
  display: grid;
  gap: 7px;
  min-width: 230px;
}

.product-slot {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(130, 130, 130, 0.28);
  border-radius: 8px;
  padding: 8px 9px;
  background: var(--color-paper);
}

.product-slot-index {
  border-radius: 999px;
  padding: 4px 7px;
  background: var(--color-carbon);
  color: var(--color-paper);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.product-slot-name {
  min-width: 0;
  color: var(--color-carbon);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.product-slot-qty {
  border-radius: 999px;
  padding: 4px 7px;
  background: rgba(255, 104, 44, 0.12);
  color: #8c3212;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.funding-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 104, 44, 0.13);
  color: #8c3212;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.funding-badge.external {
  background: rgba(32, 32, 32, 0.1);
  color: var(--color-carbon);
}

.muted {
  color: var(--color-slate);
}

.detail-empty {
  margin: 0 28px 28px;
  box-shadow: none;
}

@media (max-width: 860px) {
  .shell {
    width: min(100vw - 18px, 640px);
    padding-top: 10px;
  }

  .topbar {
    align-items: flex-start;
    padding: 12px;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .topbar h1 {
    font-size: 29px;
  }

  .topbar p,
  .live-badge {
    display: none;
  }

  .button {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
  }

  .zone-tabs {
    margin-top: 12px;
  }

  .days-head {
    grid-template-columns: 1fr 1fr;
  }

  .days-head > div {
    min-height: 100px;
    padding: 13px 14px;
  }

  .days-head > div::before {
    margin-bottom: 12px;
  }

  .days-head strong {
    font-size: 28px;
  }

  .metric-stack-meta,
  .sum-stack-meta {
    font-size: 12px;
  }

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

  .day-card-top {
    padding: 18px 16px 10px;
  }

  .day-card h2 {
    font-size: 30px;
  }

  .day-spend,
  .funding-split {
    margin-right: 16px;
    margin-left: 16px;
  }

  .funding-split {
    grid-template-columns: 1fr;
  }

  .funding-row {
    min-height: 0;
  }

  .day-actions {
    padding: 0 16px 16px;
  }

  .action-button {
    min-height: 44px;
    padding: 9px 10px;
    font-size: 14px;
  }

  .detail-head {
    padding: 18px 16px 14px;
  }

  .detail-summary {
    padding: 14px 16px 0;
  }

  .detail-summary .funding-row {
    flex-basis: 100%;
    max-width: none;
  }

  .table-wrap {
    overflow: visible;
    padding: 14px 16px 18px;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tr {
    border: 1px solid var(--color-chalk);
    border-radius: 8px;
    background: var(--color-paper);
    padding: 9px 12px;
  }

  tbody tr:hover {
    background: var(--color-paper);
  }

  tr + tr {
    margin-top: 8px;
  }

  td {
    display: grid;
    grid-template-columns: 102px minmax(0, 1fr);
    gap: 10px;
    border: 0;
    padding: 7px 0;
    overflow-wrap: anywhere;
  }

  td::before {
    content: attr(data-label);
    color: var(--color-slate);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .product-slots {
    min-width: 0;
  }

  .product-slot {
    grid-template-columns: 1fr auto;
  }

  .product-slot-index {
    grid-column: 1 / -1;
    width: fit-content;
  }
}

@media (max-width: 520px) {
  .topbar-actions {
    align-self: stretch;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar-actions,
  .button.secondary {
    width: 100%;
  }

  .zone-tabs,
  .days-head {
    margin-top: 12px;
  }

  .days-head {
    grid-template-columns: 1fr;
  }

  .day-actions {
    grid-template-columns: 1fr;
  }

  td {
    grid-template-columns: 1fr;
  }
}
