:root {
  color-scheme: light;
  --ink: #212121;
  --muted: #5f5f5f;
  --canvas: #fafafa;
  --paper: #fff;
  --line: #dedede;
  --blue: #5b70ee;
  --blue-text: #3b4cba;
  --blue-tint: #eef0ff;
  --yellow: #fdf43a;
  --yellow-tint: #fffde2;
  --coral: #ff7c4c;
  --coral-tint: #fff0e9;
  --warn-text: #67470c;
  --danger-text: #8c3823;
  font: 15px / 1.45 'Baloo 2', Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  display: grid;
  grid-template-columns: 218px minmax(0, 1fr);
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
}
h1, h2, p { margin: 0; }
a { color: var(--blue-text); }
button, select { color: inherit; font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .46; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
#main:focus { outline: none; }
.skip {
  position: fixed;
  top: -80px;
  left: 5px;
  z-index: 5;
  padding: 8px;
  background: var(--paper);
}
.skip:focus { top: 5px; }

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 27px 16px 17px;
  background: var(--ink);
  color: var(--line);
}
.brand {
  display: grid;
  justify-items: start;
  gap: 7px;
  margin: 2px 5px 40px;
}
.brand img { display: block; width: 150px; height: auto; }
.brand small { font-size: 10px; font-weight: 540; line-height: 1.2; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar a {
  display: block;
  padding: 10px 11px;
  border-radius: 7px;
  color: var(--line);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.sidebar a:hover { background: #343434; color: var(--paper); }
.side-end { margin-top: auto; padding-top: 10px; border-top: 1px solid #4a4a4a; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 clamp(18px, 3.3vw, 48px);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}
.page {
  max-width: 1650px;
  margin-inline: auto;
  padding: 30px clamp(17px, 3.3vw, 48px) 0;
}
.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.eyebrow {
  margin-bottom: 4px;
  color: var(--blue-text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}
h1 { font-size: clamp(30px, 4vw, 48px); font-weight: 750; letter-spacing: -.052em; line-height: 1.06; }
.hero-text { margin-top: 7px; color: var(--muted); }
.hero-right { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.eom-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--coral);
  border-radius: 7px;
  background: var(--coral-tint);
  color: var(--danger-text);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}
.eom-link:hover, .eom-link:focus-visible { background: #ffe2d6; outline: 2px solid var(--yellow); outline-offset: 2px; }
.refresh {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border: 1px solid var(--blue);
  border-radius: 7px;
  background: var(--paper);
  color: var(--blue-text);
  font-weight: 700;
  white-space: nowrap;
}
.refresh svg { width: 16px; height: 16px; }
.refresh:hover, .week-picker button:hover, .segments button:hover { background: var(--blue-tint); }

.alert {
  display: grid;
  gap: 4px;
  margin: 0 0 14px;
  padding: 9px 12px;
  border: 1px solid #e6dc9e;
  border-left: 4px solid var(--yellow);
  border-radius: 8px;
  background: var(--yellow-tint);
  color: var(--warn-text);
  font-size: 13px;
}
.dashboard { display: grid; gap: 14px; }
.filters {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
}
.filters fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
.filters legend, .week-control > label, .status-control > label {
  display: block;
  margin: 0 0 4px;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}
.segments { display: flex; flex-wrap: wrap; gap: 4px; }
.segments button, .week-picker button, select {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
}
.segments button { padding: 6px 11px; font-weight: 700; line-height: 1.25; white-space: nowrap; }
.segments button[aria-pressed=true] { border-color: var(--blue); background: var(--blue-tint); color: var(--blue-text); }
.week-picker { display: flex; gap: 4px; min-height: 34px; }
.week-picker button { width: 33px; font-size: 20px; line-height: 1; }
.week-picker select, .status-control select { padding: 4px 7px; font-weight: 650; }

.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 11px; }
.metric {
  display: grid;
  align-content: center;
  min-width: 0;
  min-height: 95px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
}
.metric:first-child { border-color: var(--blue); background: var(--blue-tint); }
.metric:nth-child(2), .metric:nth-child(3) { background: var(--blue-tint); }
.metric:nth-child(4) { border-color: #e6dc9e; background: var(--yellow-tint); }
.metric:nth-child(5) { border-color: var(--coral); background: var(--coral-tint); }
.metric-label { font-size: 13px; font-weight: 750; }
.metric strong { margin: 2px 0; font-size: clamp(24px, 2.5vw, 32px); font-variant-numeric: tabular-nums; line-height: 1.12; letter-spacing: -.04em; }
.metric small { color: var(--muted); font-size: 12px; line-height: 1.25; }

.panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  scroll-margin-top: 16px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  padding: 13px 16px 11px;
}
.panel-head h2 { font-size: 20px; font-weight: 750; letter-spacing: -.03em; line-height: 1.2; }
.panel-head p { margin-top: 4px; color: var(--muted); font-size: 13px; }
.table-frame { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 10px; border-top: 1px solid #e9e9e9; vertical-align: top; }
th { background: var(--blue-tint); color: var(--ink); font-size: 12px; font-weight: 750; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
td { min-width: 95px; }
td:first-child { min-width: 145px; }
tbody tr:nth-child(even) { background: #fcfcfc; }
tr:hover td { background: #f7f8ff; }
.small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.chip {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 5px;
  background: #f0f0f0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}
.chip.good, .chip.info { background: var(--blue-tint); color: var(--blue-text); }
.chip.review { background: var(--yellow-tint); color: var(--warn-text); }
.chip.danger { background: var(--coral-tint); color: var(--danger-text); }
.row-detail { min-width: 130px; }
.row-detail summary, .section-details summary { color: var(--blue-text); cursor: pointer; font-weight: 700; }
.row-detail summary:hover, .section-details summary:hover { text-decoration: underline; }
.row-detail p { margin-top: 4px; }
.detail-lines { margin-top: 5px; }
.stock-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; padding: 0 16px 12px; }
.source-summary { padding: 9px 11px; border: 1px solid #d7dcfc; border-radius: 8px; background: var(--blue-tint); }
.source-summary h3 { margin: 0 0 2px; color: var(--blue-text); font-size: 12px; }
.source-summary strong { display: block; font-size: 16px; }
.section-details { border-top: 1px solid var(--line); }
.section-details > summary { padding: 10px 16px; font-size: 13px; }
.sources-content { display: grid; gap: 8px; padding: 0 16px 13px; color: var(--muted); font-size: 13px; }
.sources-content a { font-weight: 700; text-underline-offset: 2px; }
.sources-content ul { margin: 2px 0; padding-left: 18px; }
.sources-content li + li { margin-top: 4px; }
.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 13px 0 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1150px) {
  body { grid-template-columns: 189px minmax(0, 1fr); }
  .sidebar { padding-inline: 10px; }
  .page { padding-top: 23px; }
}
@media (max-width: 800px) {
  body { display: block; }
  .sidebar { position: static; height: auto; padding: 13px 11px 8px; }
  .brand { margin: 0 3px 9px; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .sidebar a { padding: 5px 7px; }
  .side-end { margin-top: 4px; padding-top: 3px; }
  .top { min-height: 38px; }
  .hero { margin-bottom: 14px; }
}
@media (max-width: 580px) {
  .top { align-items: start; flex-direction: column; gap: 0; padding-block: 6px; }
  .hero, .filters { flex-wrap: wrap; }
  .segments button { padding: 5px 8px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 78px; }
  .stock-summary { grid-template-columns: minmax(0, 1fr); }
  .panel-head { align-items: start; flex-wrap: wrap; }
}
