:root {
  --bg: #d9ebf7;
  --card: #fff;
  --ink: #1c2430;
  --muted: #5d6b7a;
  --line: #d5d5d5;
  --blue: #49a3e4;
  --blue-deep: #1473c8;
  --banner: #0d7ad4;
  --head: #d7ebf8;
  --green: #22a34a;
  --green-dark: #0d8a45;
  --amber: #e09a12;
  --red: #e23b32;
  --pink: #f7d0dc;
  --pink-edge: #e7a0b6;
  --shadow: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 13px/1.35 "Segoe UI", "Noto Sans", sans-serif;
}

button, select { font: inherit; }

.shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-width: 1180px;
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: #fff;
  padding: 8px 220px;
  border-bottom: 3px solid #2b86c9;
}
.title-block { flex: 1; min-width: 0; }
.header-actions {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
}

.title-block h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
}
.title-block p { display: none; }

.header-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.action-row { display: flex; align-items: center; gap: 8px; }
.month-label { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.lang-icon { width: 18px; height: 18px; flex: 0 0 auto; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.month-label select {
  background: #fff;
  color: var(--ink);
  border: 0;
  border-radius: 3px;
  padding: 3px 6px;
  max-width: 180px;
}
.refresh {
  background: #fff;
  color: var(--blue-deep);
  border: 0;
  border-radius: 3px;
  padding: 4px 10px;
  font-weight: 700;
  cursor: pointer;
}
.refresh:hover { background: #e7f3fc; }
.refresh:disabled { opacity: 0.6; cursor: wait; }
.updated { font-size: 11px; opacity: 0.9; }

.stage { flex: 1; min-height: 0; overflow: hidden; padding: 8px; display: flex; flex-direction: column; }
.tabbar { display: none; }
.tabbar { display: none; }
.tab {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 0 16px;
  cursor: pointer;
  color: #333;
}
.tab.active {
  font-weight: 700;
  border-bottom-color: var(--green-dark);
  background: #fff;
}

.loading, .error {
  margin: 48px auto;
  max-width: 640px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 22px 24px;
}
.error { border-color: #f0b4b0; }
.error h2 { margin: 0 0 8px; font-size: 16px; }
.error code { font-size: 12px; }

.wall {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1.45fr) minmax(150px, 0.62fr);
  gap: 6px;
}
.wall-top {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(240px, 0.9fr);
  gap: 8px;
  min-height: 0;
}
.wall-rotator {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-height: 0;
}
.wall-rotator > * { min-width: 0; min-height: 0; }
.wall-rotator > .rot-off { display: none; }
.wall-rotator > .panel-scroll {
  height: 100%;
  overflow: auto;
  background: #fff;
  border: 1px solid #c8c8c8;
  border-radius: 4px;
  padding: 4px 8px 2px;
}
.wall-rotator caption { font-size: 14px; }
.wall-rotator .prod-panel svg { min-height: 0; height: 100%; }
.wall-top .kpi-board { height: 100%; }
.wall-top .kpi-board .score-grid { margin: 6px; }
.wall-top .kpi-board .score-cell .n { font-size: 16px; }
.wall-top .kpi-board .score-cell.total .n { font-size: 22px; }
.wall-bottom .pink-row {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  height: 100%;
  min-height: 0;
}
.wall-bottom .pink-card { display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.wall-bottom .pink-card .pn { font-size: 22px; }
.wall-top .pink-row { grid-template-columns: 1fr 1fr; }
.wall-top .gauge-card {
  display: grid;
  grid-template-rows: auto minmax(2.55em, 2.55em) 62px auto;
  align-content: start;
  padding-top: 0;
}
.wall-top .gauge-card h2 {
  margin: 0;
  min-height: 2.35em;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 2px 2px 0;
}
.wall-top .gauge-card .sub {
  margin: 0;
  min-height: 2.55em;
  font-size: 10px;
  line-height: 1.2;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.gauge-card .gauge-sub-spacer:empty {
  display: none;
  margin: 0;
  min-height: 0;
}
.wall-top .gauge-card .gauge-sub-spacer:empty {
  display: flex;
  visibility: hidden;
  margin: 0;
  min-height: 2.55em;
  padding: 0;
}
.wall-top .gauge-card .gauge-lines {
  display: block;
}
.wall-top .gauge-card svg { height: 62px; margin: 0; }
.wall-top .gauge-card .gauge-scale { margin-top: 0; }
.wall-top .incident-card .big { font-size: 34px; }
.viz { display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 0; }
.viz-head { background: #b9ddf7; padding: 6px 8px 5px; }
.viz-head h2, .line-viz h2 { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: 0.01em; }
.viz-head p, .line-viz > p { margin: 1px 0 0; font-size: 11px; color: #4d6275; }
.line-viz { padding: 6px 8px 4px; }
.line-viz h2 { text-align: center; }
.line-viz svg, .bar-viz { flex: 1; min-height: 0; }
.line-viz svg { width: 100%; height: 100%; }
.hbar-list { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: space-evenly; padding: 6px 8px 0; }
.hbar { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) 42px; gap: 6px; align-items: center; }
.hbar-name { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wall-rotator .bar-viz .hbar-name { font-size: 22px; }
.hbar-track { height: 14px; background: #f3f6f8; border-radius: 2px; }
.hbar-fill { height: 100%; background: #2f78d0; border-radius: 2px; }
.hbar-pct { font-size: 11px; font-weight: 700; text-align: right; }
.hbar-scale { display: flex; justify-content: space-between; margin: 0 50px 6px 42%; color: #7b8794; font-size: 10px; }
.wall-mid > * { min-width: 0; min-height: 0; }
.wall-bottom {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 8px;
}
.wall-days { height: 100%; max-height: none; overflow: auto; padding: 6px; }
.pink-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; min-width: 0; }
.pink-card, .incident-card { background: #fff; border: 1px solid #e3b7c6; border-radius: 4px; text-align: center; overflow: hidden; }
.pink-card .pk, .incident-card .pk { background: #f4c3d4; font-weight: 700; font-size: 11px; line-height: 1.2; padding: 4px 4px; min-height: 30px; display: flex; align-items: center; justify-content: center; }
.pink-card .pn { font-size: 24px; font-weight: 800; line-height: 1.05; padding-top: 4px; }
.pink-card .pu { color: var(--muted); font-size: 11px; padding-bottom: 4px; }
.incident-card { display: flex; flex-direction: column; height: 100%; }
.incident-card .big { flex: 1; display: flex; align-items: center; justify-content: center; font-size: 46px; font-weight: 800; }
.detail-panel { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 6px; height: 100%; min-height: 0; }
.detail-main { min-height: 0; display: flex; flex-direction: column; overflow: hidden; padding: 6px; }
.detail-panel .side-btn { background: #f8e1ea; border-color: #e7b3c6; color: #7a3050; font-size: 11px; line-height: 1.15; padding: 6px 4px; }
.detail-panel .side-btn.on { background: #d81b60; color: #fff; border-color: #ad1457; }
.wall .gauge-card { padding: 4px 6px 0; height: 100%; }
.wall .gauge-card svg { height: 88px; }
.wall .gauge-card h2 { font-size: 12px; line-height: 1.2; }
.wall .gauge-card .sub { color: var(--ink); font-weight: 600; }
.panel-scroll { flex: 1; min-height: 0; max-height: none; overflow: auto; }
.panel-scroll caption { caption-side: top; text-align: center; font-weight: 800; font-size: 16px; padding: 2px 0 6px; }
.panel-scroll thead th { position: sticky; top: 0; z-index: 1; }
.panel-scroll tfoot td { position: sticky; bottom: 0; background: #fff; z-index: 1; }
.mini-table.pink-head th { background: #f4c3d4; }
.prod-panel { display: flex; flex-direction: column; overflow: hidden; }
.prod-title { text-align: center; font-weight: 800; font-size: 16px; padding-bottom: 2px; }
.prod-panel svg { flex: 1; width: 100%; min-height: 160px; }
.gauge-lines { display: block; font-size: 11px; color: var(--ink); line-height: 1.25; }
.kpi-board { height: 100%; margin: 0; padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.kpi-board h2 { margin: 0; padding: 6px 8px; background: var(--blue-deep); color: #fff; text-align: center; font-size: 13px; letter-spacing: 0.04em; }
.kpi-board .score-grid { margin: 8px; }
.kpi-board .score-cell { padding: 0; overflow: hidden; border-color: #e3b7c6; }
.kpi-board .score-cell .k { background: #f4c3d4; color: var(--ink); font-weight: 700; padding: 4px 2px; }
.kpi-board .score-cell .n { padding: 4px 2px 0; font-size: 18px; }
.kpi-board .score-cell .u { padding-bottom: 4px; color: var(--muted); font-size: 11px; }
.kpi-board .score-cell.total { background: #fff; }
.kpi-board .score-cell.total .n { font-size: 26px; }
.table-fill { height: 100%; min-height: 0; min-width: 0; display: flex; flex-direction: column; margin: 0; }
.table-fill h2 { text-align: center; letter-spacing: 0.04em; }
.table-fill .sub { display: none; }
.table-fill .table-scroll { flex: 1; min-height: 0; max-height: none; overflow: auto; }
.table-fill .grid { min-width: 0; }
.table-fill tr.rot-off { display: none; }

.ops-wrap { margin-bottom: 8px; }
.ops-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.ops-head .sub { margin: 1px 0 6px; }
.ops-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(180px, 1.1fr) minmax(220px, 1fr) repeat(3, minmax(110px, 0.75fr));
  gap: 8px;
}
.ops-extra {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.ops-tops {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.ops-score .n { font-size: 16px; }
.ops-note { margin-bottom: 8px; }
.ops-note h2 { margin: 0 0 4px; font-size: 13px; }

.card {
  background: var(--card);
  border: 1px solid #c8c8c8;
  border-radius: 4px;
  padding: 8px 10px;
}

.attention { text-align: center; display: flex; flex-direction: column; justify-content: center; }
.attention .k { font-weight: 700; }
.attention .n {
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
  margin: 6px 0 2px;
}
.attention .s { color: var(--muted); font-size: 11px; }
.attention.warn .n { color: var(--amber); }
.attention.ok .n { color: var(--green); }

.metric { text-align: center; display: flex; flex-direction: column; justify-content: center; }
.metric .k { color: var(--muted); font-size: 12px; }
.metric .n { font-size: 28px; font-weight: 750; font-weight: 700; line-height: 1.1; margin-top: 4px; }
.metric .u { color: var(--muted); font-size: 11px; }

.gauge-card { text-align: center; padding-bottom: 4px; }
.gauge-card h2, .panel h2, .chart-card h2, .table-wrap h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}
.gauge-card .sub, .chart-card .sub, .panel .sub {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.gauge-card svg { width: 100%; height: 118px; display: block; }
.gauge-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
  margin-top: -8px;
  padding: 0 18%;
}

.mid-row {
  display: grid;
  grid-template-columns: 210px 300px 1fr;
  gap: 8px;
  margin-bottom: 8px;
  align-items: start;
}

.slicers { padding: 8px; max-height: 430px; overflow: auto; }
.slicer + .slicer { margin-top: 10px; }
.slicer-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}
.slicer-head strong { font-size: 12px; }
.linkish {
  background: none;
  border: 0;
  color: var(--blue-deep);
  cursor: pointer;
  padding: 0;
  font-size: 11px;
}
.slicer-item {
  display: flex;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: #f7f7f7;
  margin: 0 0 3px;
  padding: 3px 6px;
  cursor: pointer;
  border-radius: 2px;
}
.slicer-item.on {
  background: var(--pink);
  border-color: var(--pink-edge);
}
.slicer-item .cnt { color: var(--muted); }

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.score-cell {
  border: 1px solid var(--line);
  border-radius: 3px;
  text-align: center;
  padding: 6px 4px 5px;
}
.score-cell .k { font-size: 11px; color: var(--muted); }
.score-cell .n { font-size: 20px; font-weight: 700; }
.score-cell.total { grid-column: 1 / -1; background: #f4fbf6; }
.score-cell.total .n { font-size: 26px; }

.detail-head {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 8px;
  align-items: start;
}
.banner {
  background: var(--banner);
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.03em;
  padding: 6px 8px;
  border-radius: 2px;
  margin-bottom: 6px;
}
.side-btns { display: flex; flex-direction: column; gap: 6px; }
.side-btn {
  border: 1px solid #b9d7ee;
  background: #f3f9fd;
  color: #14598f;
  border-radius: 6px;
  padding: 8px 6px;
  cursor: pointer;
  font-weight: 700;
  font-size: 12px;
}
.side-btn.on { background: var(--blue-deep); color: #fff; border-color: var(--blue-deep); }

.mini-table, .grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.mini-table th, .grid th {
  background: var(--head);
  font-weight: 700;
  padding: 4px 6px;
  border: 1px solid #c5d7e4;
  text-align: center;
}
.mini-table td, .grid td {
  border: 1px solid #e1e1e1;
  padding: 3px 6px;
  text-align: center;
}
.mini-table td.left, .grid td.left { text-align: left; }
.mini-table tr.total td { font-weight: 700; background: #f7f7f7; }
.mini-table button.sort, .grid button.sort {
  background: none;
  border: 0;
  font-weight: 700;
  cursor: pointer;
  color: inherit;
  padding: 0;
}
.mini-table button.sort:hover, .grid button.sort:hover { color: var(--blue-deep); }

.table-wrap { padding: 8px 8px 4px; }
.table-scroll { max-height: 460px; overflow: auto; margin-top: 6px; }
.grid { min-width: 1280px; }
.grid thead th { position: sticky; top: 0; z-index: 1; }
.grid tbody tr:hover td { background: #f3f9fd; }
.grid tbody tr.waiting td { background: #fff8e8; }
.grid tfoot td { font-weight: 700; background: #f7f7f7; position: sticky; bottom: 0; }

.pill {
  display: inline-block;
  border-radius: 10px;
  padding: 1px 8px;
  font-weight: 700;
  font-size: 11px;
}
.pill.done { background: #e5f7ea; color: #0d7a32; }
.pill.wait { background: #fff1d2; color: #8a5a00; }
.pill.other { background: #eee; color: #444; }

.check { width: 16px; height: 16px; vertical-align: middle; }
.miss { color: #b0b0b0; }

.chart-page {
  min-height: calc(100% - 8px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.chart-card {
  width: min(860px, 100%);
  padding: 16px 18px 12px;
  background: #fff;
}
.chart-card h2 { text-align: center; font-size: 18px; letter-spacing: 0.04em; }
.chart-card .sub { text-align: left; margin: 8px 0 4px; }
.chart-card svg.plot { width: 100%; height: auto; display: block; }
.caption { margin: 8px 0 0; color: var(--muted); font-size: 11px; }
.filter-note { margin: 6px 0 0; font-size: 12px; }

.legend { display: flex; gap: 14px; justify-content: center; margin: 4px 0 8px; font-size: 12px; }
.swatch { display: inline-block; width: 12px; height: 12px; margin-right: 4px; vertical-align: -1px; }
.swatch.a { background: #1e88e5; }
.swatch.b { background: #5eb0ea; }
.swatch.c { background: #0d8a45; }

.empty-note { color: var(--muted); padding: 12px 4px; }
