:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --line: #d8e0eb;
  --surface: #ffffff;
  --page: #f4f7fb;
  --blue: #1769e0;
  --navy: #102a43;
  --green: #10b981;
  --orange: #f59e0b;
  --red: #e5484d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.site-nav {
  width: min(1500px, calc(100% - 28px));
  min-height: 92px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.site-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  text-decoration: none;
}

.site-brand img {
  width: 132px;
  height: auto;
  display: block;
}

.site-brand span {
  display: grid;
  gap: 4px;
}

.site-brand strong {
  color: var(--blue);
  font-size: 14px;
  letter-spacing: 0.02em;
}

.site-brand small {
  color: var(--muted);
  font-size: 13px;
}

.site-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.site-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #344054;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.site-button-primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.shell {
  width: min(1500px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.notice {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #475467;
  text-align: center;
}

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

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(26px, 3vw, 38px);
}

h2 {
  font-size: 13px;
  text-transform: uppercase;
}

.sync {
  display: grid;
  gap: 4px;
  color: var(--muted);
  text-align: right;
  font-size: 12px;
}

.sync strong {
  color: var(--ink);
  font-size: 18px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(4, minmax(145px, 1fr)) auto auto;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

input, select, button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
}

button {
  cursor: pointer;
  font-weight: 800;
}

.check-filter {
  grid-template-columns: auto 1fr;
  align-items: center;
  align-self: end;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
}

.check-filter input {
  min-height: auto;
}

.visual-filter {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #b9d5ff;
  border-radius: 8px;
  background: #eef5ff;
  color: var(--navy);
  font-weight: 700;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.kpi {
  min-height: 118px;
  display: grid;
  align-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.kpi span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.kpi strong {
  font-size: 38px;
  line-height: 1;
}

.kpi.danger strong {
  color: var(--red);
}

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

.panel {
  min-height: 330px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--muted);
}

.panel-title span {
  font-size: 12px;
  font-weight: 700;
}

.bar-list {
  display: grid;
  gap: 9px;
}

.bar-item {
  display: grid;
  grid-template-columns: minmax(130px, 0.85fr) 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.bar-item span:first-child {
  overflow: hidden;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf4;
}

.bar-fill {
  display: block;
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
  background: var(--blue);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

.bar-item[data-field="brand"] .bar-fill {
  background: #178df2;
}

.bar-item[data-field="stage"] .bar-fill {
  background: #10bf31;
}

.bar-item[data-field="dealer"] .bar-fill {
  background: #ffb000;
}

.bar-item[data-field="action"] .bar-fill {
  background: #e06432;
}

.bar-item[data-field="monthKey"] .bar-fill {
  background: #172dd8;
}

.bar-item.is-active .bar-track {
  outline: 2px solid #172033;
  outline-offset: 2px;
}

.bar-item.is-active span:first-child,
.bar-item.is-active .bar-value {
  color: #172033;
}

.bar-value {
  min-width: 30px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.compact {
  max-height: 290px;
  overflow: auto;
  padding-right: 4px;
}

.table-panel {
  min-height: 0;
  margin-top: 12px;
}

.table-wrap {
  overflow: auto;
}

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

th, td {
  padding: 10px 9px;
  border-bottom: 1px solid #edf1f6;
  font-size: 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  text-transform: uppercase;
}

td strong {
  color: var(--navy);
}

.stage-detail {
  display: grid;
  gap: 3px;
  color: var(--ink);
}

.stage-detail strong {
  color: var(--blue);
  font-size: 11px;
  text-transform: uppercase;
}

.stage-detail span,
.muted-detail {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 22px max(14px, calc((100% - 1500px) / 2));
  color: var(--muted);
  font-size: 14px;
}

.site-footer div {
  display: grid;
  gap: 4px;
}

.site-footer strong {
  color: var(--navy);
}

.site-footer a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

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

  .layout,
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .site-nav,
  .topbar,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-brand img {
    width: 118px;
  }

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

  .sync {
    text-align: left;
  }

  .bar-item {
    grid-template-columns: 1fr;
  }

  .bar-value {
    text-align: left;
  }
}
