:root {
  --bg: #f6f8fc;
  --card: #ffffff;
  --ink: #13243d;
  --muted: #6b7a93;
  --line: #e4eaf3;
  --navy: #14365c;
  --cyan: #29abe2;
  --green: #16a35f;
  --green-bg: #e4f7ec;
  --yellow: #e0a008;
  --yellow-bg: #fdf4d9;
  --red: #e05252;
  --red-bg: #fdeaea;
  --shadow: 0 6px 24px rgba(19, 36, 61, 0.07);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
}

.dashboard-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 4px 18px;
  flex-wrap: wrap;
}

.brand-logo {
  height: 46px;
  width: auto;
  display: block;
  mix-blend-mode: multiply;
}

.date-block {
  text-align: right;
}

.weekday {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.date-label {
  font-size: 17px;
  font-weight: 800;
}

.customer-nav {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.customer-button {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 43px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.customer-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(19, 36, 61, 0.12);
}

.customer-button:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

.customer-button span:not(.status-dot):not(.arrow) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 11px;
  height: 11px;
  flex: none;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3.5px var(--green-bg);
}

.status-dot.idle {
  background: var(--yellow);
  box-shadow: 0 0 0 3.5px var(--yellow-bg);
}

.status-dot.down {
  background: var(--red);
  box-shadow: 0 0 0 3.5px var(--red-bg);
}

.customer-button .arrow {
  margin-left: auto;
  color: #b9c4d6;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.chart-card {
  padding: 22px 24px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0;
}

.chart-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

.summary-strip {
  display: flex;
  align-items: flex-start;
  gap: 26px;
  flex-wrap: wrap;
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.summary-item strong {
  display: block;
  margin-top: 1px;
  color: transparent;
  font-size: 21px;
  font-weight: 900;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(120deg, var(--navy), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
}

.chart-frame {
  width: 100%;
  height: auto;
}

#trendChart {
  width: 100%;
  height: auto;
  display: block;
  margin-top: 6px;
  overflow: visible;
}

.axis-label {
  fill: #9aa7bb;
  font-size: 11px;
  font-weight: 700;
}

.grid-line {
  stroke: #edf1f7;
  stroke-width: 1;
}

.trend-line {
  fill: none;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  cursor: pointer;
}

.trend-point {
  fill: #fff;
  stroke-width: 2.4;
  cursor: pointer;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 2px 6px;
}

.legend-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfe;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.legend-button:hover {
  transform: translateY(-1px);
}

.legend-button.is-hidden {
  opacity: 0.32;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

footer {
  margin-top: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.customer-drawer {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  background: rgba(19, 36, 61, 0);
  transition: background 0.2s ease;
}

.customer-drawer.is-open {
  pointer-events: auto;
  background: rgba(19, 36, 61, 0.35);
}

.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(430px, 94vw);
  padding: 0;
  overflow: hidden;
  background: #fff;
  box-shadow: -18px 0 50px rgba(19, 36, 61, 0.18);
  transform: translateX(105%);
  transition: transform 0.25s cubic-bezier(0.3, 0.8, 0.3, 1);
}

.customer-drawer.is-open .drawer-panel {
  transform: translateX(0);
}

.close-button {
  position: absolute;
  top: 22px;
  right: 24px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: #f1f4f9;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.close-button:hover {
  background: #e7ecf4;
}

.drawer-panel h2 {
  flex: none;
  margin: 0;
  padding: 22px 72px 16px 24px;
  border-bottom: 1px solid var(--line);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
}

.status-pill,
.detail-grid,
.bar-section {
  margin-right: 24px;
  margin-left: 24px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  margin-top: 20px;
  margin-bottom: 14px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--green-bg);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-pill span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3.5px currentColor;
  opacity: 0.9;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.detail-grid article {
  min-height: 78px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafd;
}

.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.detail-grid strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 21px;
  font-weight: 900;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.bar-section {
  margin-top: 0;
  overflow-y: auto;
}

.bar-section h3 {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.daily-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 110px;
}

.bar-item {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  height: 100%;
  text-align: center;
}

.bar-value {
  display: block;
  min-height: 18px;
  margin-bottom: 3px;
  color: var(--navy);
  font-size: 10.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.bar-track {
  display: flex;
  align-items: end;
  justify-content: center;
  width: 100%;
  height: 82px;
}

.bar-fill {
  width: 100%;
  max-width: 40px;
  min-height: 3px;
  border-radius: 6px 6px 0 0;
  background: #d8e9fb;
}

.bar-item.is-latest .bar-fill {
  background: linear-gradient(180deg, var(--cyan), var(--navy));
}

.bar-label {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}

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

@media (max-width: 680px) {
  .dashboard-shell {
    width: min(100% - 24px, 1180px);
  }

  .topbar {
    align-items: flex-start;
  }

  .brand-logo {
    height: 38px;
  }

  .date-block {
    text-align: left;
  }

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

  .chart-card {
    padding: 18px 16px 12px;
  }

  .summary-strip {
    gap: 16px;
  }

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

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
