:root {
  --ink: #071c36;
  --ink-2: #385371;
  --muted: #71849b;
  --line: #d6e1ee;
  --line-soft: #edf2f7;
  --surface: #ffffff;
  --canvas: #f5f8fc;
  --blue: #2f5d86;
  --navy: #0b3558;
  --teal: #009898;
  --red: #d92d24;
  --red-soft: #f05b57;
  --green: #058a45;
  --green-bg: #e6f7ee;
  --red-bg: #fff1ef;
  --shadow: 0 12px 30px rgba(13, 54, 89, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  background: #f4f8fc;
  color: var(--ink);
  font-family: "Segoe UI Variable", "Segoe UI", "Aptos", sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.login-page {
  display: grid;
  min-width: 0;
  min-height: 100vh;
  place-items: center;
  background: radial-gradient(circle at 50% 0%, #ffffff 0, #f4f8fc 44%, #edf4fb 100%);
}

.login-shell {
  width: min(440px, calc(100vw - 32px));
}

.login-card {
  display: grid;
  gap: 22px;
  padding: 34px;
  border: 1px solid #d5e2ef;
  border-radius: 18px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 22px 50px rgba(7, 28, 54, .10);
}

.login-card img {
  width: 148px;
  height: auto;
}

.login-card h1 {
  margin: 0;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.login-card p {
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 14px;
}

.google-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}

.login-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

button,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.app-frame {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 24px 14px;
  border-right: 1px solid #dbe4ef;
  background: rgba(255, 255, 255, .92);
  box-shadow: 4px 0 18px rgba(13, 54, 89, .025);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 108px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line-soft);
}

.brand img,
.brand-logo {
  width: 150px;
  max-height: 86px;
  height: auto;
  display: block;
  object-fit: contain;
}

.side-nav {
  display: grid;
  gap: 12px;
  margin-bottom: 34px;
}

.side-link {
  height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 16px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.side-link:hover,
.side-link.active {
  background: #e9f0ff;
  color: #1254ff;
}

.upload-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
}

.upload-title {
  color: var(--ink);
  font-size: 15px;
  font-weight: 750;
}

.upload-card p {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.upload-button {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.upload-button input {
  display: none;
}

.upload-status {
  min-height: 14px;
  margin-top: 9px;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
}

.upload-history {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.app-version,
.login-version {
  color: #7b91a8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}

.app-version {
  margin-top: auto;
  padding-top: 18px;
  text-align: center;
}

.login-version {
  margin: 16px 0 0;
  text-align: center;
}

.history-label {
  color: #617996;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .03em;
  line-height: 1;
  text-transform: uppercase;
}

.history-latest {
  margin-top: 5px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.1;
}

.history-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #385371;
  font-size: 11px;
  line-height: 1;
}

.history-item small {
  color: #6d8198;
  font-size: 10px;
  white-space: nowrap;
}

.content-shell {
  min-width: 0;
  padding: 22px 26px 34px;
}

.loading,
.error {
  width: min(760px, 92vw);
  margin: 18vh auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topbar,
.pages {
  width: min(1560px, 100%);
  max-width: none;
  margin-inline: 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.user-chip {
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 5px 4px 12px;
  border: 1px solid #dbe6f1;
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  color: var(--ink);
  box-shadow: none;
  font-size: 12px;
  font-weight: 700;
}

.user-chip.visible {
  display: inline-flex;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #eaf2ff;
  border: 1px solid #cfe0f1;
  color: var(--navy);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
}

.user-meta {
  display: grid;
  gap: 1px;
  min-width: 52px;
  line-height: 1;
}

.user-meta strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.user-meta small {
  color: #7b91a8;
  font-size: 9px;
  font-weight: 600;
}

.user-chip a,
.logout-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 28px;
  padding: 0 8px;
  border-left: 1px solid #e2ebf4;
  border-radius: 999px;
  color: #496783;
  font-size: 11px;
  font-weight: 750;
  text-decoration: none;
}

.logout-link:hover {
  background: #f3f8fd;
  color: #062744;
}

.app-title h1 {
  max-width: none;
  font-size: 32px;
  line-height: 1.05;
  letter-spacing: 0;
}

.app-title p {
  margin-top: 6px;
  color: #4d6682;
  font-size: 15px;
  font-weight: 550;
  line-height: 1.25;
}

.title h1 {
  margin: 0;
  color: var(--ink);
  font-size: 32px;
  line-height: 1.05;
  font-weight: 760;
  letter-spacing: 0;
}

.title p {
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 15px;
  font-weight: 550;
}

.page-title {
  margin: 2px 0 10px;
}

.page-title h1 {
  font-size: 30px;
}

.page-title p {
  font-size: 14px;
}

.period-line {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 750;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, .74);
  box-shadow: 0 8px 24px rgba(13, 54, 89, .045);
}

.page-tabs,
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filters > select.control {
  display: none;
}

.custom-select {
  position: relative;
  z-index: 20;
  width: 178px;
}

.custom-select[data-filter="unit"] {
  width: 188px;
}

.custom-select[data-filter="machine"] {
  width: 202px;
}

.custom-select[data-filter="start"],
.custom-select[data-filter="end"] {
  width: 126px;
}

.select-trigger {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14px;
  align-items: center;
  width: 100%;
  height: 40px;
  padding: 0 14px;
  border: 1px solid #c9d9eb;
  border-radius: 9px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: #082744;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .92), 0 8px 16px rgba(13, 54, 89, .035);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-align: left;
}

.select-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-trigger i {
  width: 7px;
  height: 7px;
  margin-left: auto;
  border-right: 2px solid #315577;
  border-bottom: 2px solid #315577;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .14s ease;
}

.custom-select.open .select-trigger {
  border-color: #1b5a8a;
  box-shadow: 0 0 0 3px rgba(0, 152, 152, .10), 0 8px 18px rgba(13, 54, 89, .08);
}

.custom-select.open .select-trigger i {
  transform: translateY(2px) rotate(225deg);
}

.select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: none;
  max-height: 286px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #c9d9eb;
  border-radius: 10px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 18px 34px rgba(7, 28, 54, .14);
}

.custom-select.open {
  z-index: 80;
}

.custom-select.open .select-menu {
  display: grid;
  gap: 2px;
}

.select-option {
  display: flex;
  align-items: center;
  min-height: 34px;
  width: 100%;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #123555;
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
}

.select-option:hover {
  background: #edf5ff;
  color: #062b4d;
}

.select-option.selected {
  background: #0b3558;
  color: #ffffff;
}

.control,
.button {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 14px;
  box-shadow: none;
}

.control {
  min-width: 112px;
}

#unitFilter {
  min-width: 144px;
}

#machineFilter {
  min-width: 156px;
}

.button {
  cursor: pointer;
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}

.button:hover,
.button.active {
  background: var(--navy);
  border-color: var(--navy);
  color: white;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.kpi {
  min-height: 96px;
  padding: 16px 20px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 8px 18px rgba(13, 54, 89, 0.035);
  position: relative;
}

.kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--navy);
}

.kpi.teal {
  border-top-color: var(--line);
}

.kpi.teal::before {
  background: var(--teal);
}

.kpi.red {
  border-top-color: var(--line);
}

.kpi.red::before {
  background: var(--red);
}

.kpi .label {
  color: #5e7896;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .04em;
  line-height: 1;
  text-transform: uppercase;
}

.kpi .value {
  margin-top: 10px;
  color: var(--ink);
  font-size: 32px;
  font-weight: 760;
  line-height: 1;
}

.metric-number {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  color: inherit;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.metric-number small {
  color: currentColor;
  font-size: .62em;
  font-weight: 760;
  line-height: 1;
}

.metric-number.count {
  gap: 0;
}

.kpi .meta {
  margin-top: 7px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.1;
}

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

.kpi.teal .value {
  color: var(--teal);
}

.panel {
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 8px 18px rgba(13, 54, 89, 0.032);
}

.panel-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 15px 22px 13px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-title {
  color: var(--ink);
  font-size: 21px;
  font-weight: 760;
  line-height: 1;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  height: 26px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #55779b;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.meta-pill.bad {
  border-color: #ffc0bc;
  background: var(--red-bg);
  color: var(--red);
}

.meta-pill.good {
  border-color: #b8e8cc;
  background: var(--green-bg);
  color: var(--green);
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.trend-page {
  display: grid;
  gap: 14px;
}

.trend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.trend-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 3px solid var(--blue);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(13, 54, 89, .055);
}

.trend-card-availability {
  border-top-color: var(--teal);
}

.trend-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px 10px;
}

.trend-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.trend-title-wrap > i {
  width: 5px;
  height: 32px;
  border-radius: 999px;
  background: var(--blue);
}

.trend-card-availability .trend-title-wrap > i {
  background: var(--teal);
}

.trend-title-wrap div {
  display: grid;
  gap: 2px;
}

.trend-title-wrap span,
.trend-stat span,
.trend-current span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.trend-title-wrap strong {
  color: var(--ink);
  font-size: 17px;
  line-height: 1;
}

.trend-status {
  padding: 6px 9px;
  border: 1px solid;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}

.trend-status.good {
  border-color: #a9dfc1;
  background: var(--green-bg);
  color: var(--green);
}

.trend-status.bad {
  border-color: #ffc0bc;
  background: var(--red-bg);
  color: var(--red);
}

.trend-status.neutral {
  border-color: var(--line);
  background: var(--canvas);
  color: var(--muted);
}

.trend-summary {
  display: grid;
  grid-template-columns: 1.25fr repeat(3, 1fr);
  margin: 0 16px 6px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: #f7fafd;
}

.trend-current,
.trend-stat {
  display: grid;
  align-content: center;
  min-height: 64px;
  padding: 9px 12px;
  border-right: 1px solid var(--line-soft);
}

.trend-stat:last-child {
  border-right: 0;
}

.trend-current strong {
  margin-top: 2px;
  color: var(--blue);
  font-size: 24px;
  line-height: 1;
}

.trend-card-availability .trend-current strong {
  color: var(--teal);
}

.trend-stat strong {
  margin-top: 5px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1;
}

.trend-stat strong.positive {
  color: var(--green);
}

.trend-stat strong.negative {
  color: var(--red);
}

.trend-current small,
.trend-stat small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
}

.trend-scroll {
  overflow-x: auto;
  padding: 0 8px 4px;
}

.trend-svg {
  display: block;
  width: 100%;
  min-width: 620px;
  height: auto;
}

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

.trend-target-line {
  stroke: var(--red);
  stroke-width: 1.5;
  stroke-dasharray: 6 5;
}

.trend-target-line.availability {
  stroke: var(--teal);
}

.trend-line {
  fill: none;
  stroke: var(--trend-color);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trend-point {
  fill: #fff;
  stroke: var(--trend-color);
  stroke-width: 3;
}

.trend-axis-label,
.trend-period-label,
.trend-year-label,
.trend-value-label,
.trend-missing-label {
  fill: var(--ink-2);
  font-family: "Segoe UI Variable", "Segoe UI", "Aptos", sans-serif;
  font-size: 11px;
  font-weight: 650;
}

.trend-period-label {
  font-size: 10px;
  font-weight: 750;
}

.trend-month-swatch {
  opacity: .95;
}

.trend-year-rule {
  stroke: #cbd9e8;
  stroke-width: 1;
}

.trend-year-label {
  fill: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .08em;
}

.trend-value-label {
  fill: var(--ink);
  font-weight: 750;
  paint-order: stroke;
  stroke: #fff;
  stroke-linejoin: round;
  stroke-width: 3px;
}

.trend-missing-label {
  fill: var(--muted);
}

.chart {
  padding: 0 18px 14px;
}

.chart-shell {
  --chart-canvas-height: 306px;
  --chart-card-height: 250px;
  --chart-label-height: 38px;
  --chart-plot-inset: 9px;
  --chart-canvas-padding-top: 14px;
  display: grid;
  overflow: hidden;
  max-width: 100%;
  grid-template-columns: 58px minmax(0, 1fr);
  height: 318px;
}

.axis {
  position: relative;
  height: calc(var(--chart-card-height) - var(--chart-label-height) - var(--chart-plot-inset));
  margin-top: calc(var(--chart-canvas-height) - var(--chart-card-height) + var(--chart-plot-inset) - var(--chart-canvas-padding-top));
}

.axis span {
  position: absolute;
  right: 10px;
  transform: translateY(50%);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.chart-canvas {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(var(--machine-card-width, 172px), 1fr);
  align-items: end;
  gap: 12px;
  height: var(--chart-canvas-height);
  overflow-x: auto;
  padding: var(--chart-canvas-padding-top) 2px 0;
}

.chart-card {
  display: grid;
  grid-template-rows: 1fr var(--chart-label-height);
  min-width: var(--machine-card-width, 172px);
  height: var(--chart-card-height);
  border: 1px solid #bfd0e3;
  border-radius: 10px;
  background: #f8fbff;
  box-shadow: inset 0 3px 0 rgba(47, 93, 134, .08);
}

.chart-card:nth-child(even) {
  background: #f1f6fc;
}

.bar-group {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 5px;
  margin-top: var(--chart-plot-inset);
  padding: 0 9px;
  border-bottom: 1px solid var(--line);
}

.target-line {
  position: absolute;
  right: 0;
  left: 0;
  opacity: .85;
  border-top: 1px dashed var(--red);
  z-index: 3;
}

.target-line.availability {
  border-top-color: var(--teal);
}

.grid-line {
  position: absolute;
  right: 0;
  left: 0;
  z-index: 0;
  border-top: 1px solid rgba(207, 224, 241, .62);
}

.bar {
  position: relative;
  flex: 0 0 16px;
  width: 16px;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  z-index: 2;
}

.bar.missing {
  height: 0 !important;
  min-height: 0;
  background: transparent !important;
  pointer-events: none;
}

.bar span {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--ink);
  padding: 1px 2px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .74);
  color: #082744;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  display: none;
}

.chart-card.show-labels .bar span {
  display: block;
}

.bar:hover {
  z-index: 8;
  outline: 2px solid rgba(7, 42, 77, .18);
  outline-offset: 2px;
}

.bar:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: -28px;
  transform: translateX(-50%);
  min-width: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 18px rgba(13, 54, 89, .14);
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

.machine-label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-top: 1px solid #c9d8e8;
  background: rgba(255, 255, 255, .72);
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  padding: 9px 4px 0;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 650;
}

.legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 5px;
  border-radius: 3px;
  vertical-align: -1px;
}

.ranking-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.ranking-list {
  padding: 5px 14px 10px;
}

.rank-row {
  display: grid;
  grid-template-columns: 24px 128px minmax(120px, 1fr) 52px;
  align-items: center;
  gap: 8px;
  min-height: 26px;
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid rgba(214, 225, 238, .58);
  border-radius: 0;
  background: transparent;
}

.rank-row.alert {
  box-shadow: inset 1px 0 0 rgba(240, 91, 87, .72);
}

.rank-index,
.rank-unit,
.rank-machine,
.rank-equipment,
.rank-site,
.rank-value {
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-index {
  text-align: center;
}

.rank-unit {
  color: var(--ink-2);
}

.rank-machine,
.rank-equipment,
.rank-site {
  color: #082744;
}

.rank-value {
  color: var(--ink);
  font-size: 12px;
  font-weight: 760;
  text-align: right;
}


.rank-value.bad {
  color: #c81910;
}

.rank-value.good {
  color: #008f8f;
}

.bar-track {
  position: relative;
  height: 7px;
  border-radius: 999px;
  background: transparent;
}

.bar-track::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 3px;
  transform: translateY(-50%);
  background: #cbd8e6;
  border-radius: 999px;
}

.bar-fill {
  position: absolute;
  top: 50%;
  left: 0;
  display: block;
  height: 3px;
  min-width: 2px;
  transform: translateY(-50%);
  border-radius: 999px;
  border: 0;
  background: currentColor;
}

.bar-fill.blue {
  color: #2f5d86;
}

.bar-fill.teal {
  color: #008787;
}

.bar-fill.red {
  color: #d92d24;
}

.site-row {
  grid-template-columns: 36px 116px minmax(150px, 1fr) 72px 88px;
  gap: 16px;
  min-height: 54px;
  padding-block: 0;
}

.site-row .rank-index,
.site-row .rank-site,
.site-row .rank-value {
  font-size: 12px;
}

.small-note {
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
}

.report-page {
  display: grid;
  gap: 16px;
}

.report-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 62px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--navy);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(13, 54, 89, .035);
}

.report-eyebrow {
  margin-bottom: 4px;
  color: #647c99;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.report-hero h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.08;
}

.report-hero p {
  margin: 4px 0 0;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 650;
}

.report-actions {
  display: flex;
  gap: 10px;
  flex-wrap: nowrap;
  align-items: center;
}

.report-button {
  min-width: 122px;
  height: 36px;
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
  padding-inline: 14px;
}

.report-button.secondary {
  background: #ffffff;
  border-color: #9edcbd;
  color: #04784c;
}

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

.report-card {
  display: block;
  width: 100%;
  text-align: left;
  min-height: 78px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--navy);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 6px 14px rgba(13, 54, 89, .03);
}

.clickable-card {
  cursor: pointer;
  font: inherit;
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}

.clickable-card:hover {
  transform: translateY(-1px);
  border-color: #ffb6b0;
  box-shadow: 0 12px 24px rgba(217, 45, 36, .08);
}

.clickable-card:focus-visible {
  outline: 3px solid rgba(47, 93, 134, .22);
  outline-offset: 2px;
}

.report-card.warning {
  border-left-color: var(--red);
}

.report-card span {
  display: block;
  color: #647c99;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.report-card strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.report-card small {
  display: block;
  margin-top: 6px;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  border-color: transparent;
}

.report-metric {
  min-height: 78px;
  padding: 14px 16px 12px;
  border: 1px solid rgba(214, 225, 238, .9);
  border-left: 3px solid var(--navy);
  border-radius: 10px;
  background: #ffffff;
}

.report-metric.accent-teal {
  border-left-color: var(--teal);
}

.report-metric.accent-red {
  border-left-color: var(--red);
}

.report-metric span {
  display: block;
  color: #647c99;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.report-metric strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.report-metric.accent-teal strong {
  color: var(--teal);
}

.report-metric.accent-red strong {
  color: var(--red);
}

.report-metric > small {
  display: block;
  margin-top: 5px;
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 700;
}

.report-metric .metric-number small {
  display: inline;
  margin: 0;
  color: currentColor;
  font-size: .62em;
  font-weight: 760;
}

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

.empty-state {
  margin: 0;
  padding: 16px 0;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 700;
}

.report-attention {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 18px 22px 22px;
}

.report-attention h3 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 17px;
}

.report-attention p {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
}

.attention-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 34px;
  border-bottom: 1px solid rgba(214, 225, 238, .6);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.attention-row strong {
  color: var(--red);
  font-size: 15px;
}

@media print {
  body {
    min-width: 0;
    background: #fff;
  }

  .sidebar,
  .filters,
  .report-actions {
    display: none !important;
  }

  .app-frame {
    display: block;
  }

  .content-shell {
    padding: 0;
  }

  .topbar,
  .pages {
    width: 100%;
  }

  .page {
    display: none !important;
  }

  .page.active {
    display: block !important;
  }

  .panel,
  .kpi,
  .report-metric,
  .report-card,
  .report-hero {
    box-shadow: none;
    break-inside: avoid;
  }

  .report-page {
    gap: 10px;
  }

  .report-hero,
  .report-summary,
  .report-metrics {
    margin-bottom: 0;
  }
}

@media (max-width: 1600px), (max-height: 900px) {
  body {
    min-width: 0;
  }

  .app-frame {
    grid-template-columns: 188px minmax(0, 1fr);
  }

  .sidebar {
    padding: 16px 10px;
  }

  .brand {
    min-height: 82px;
    margin-bottom: 14px;
  }

  .brand img,
  .brand-logo {
    width: 124px;
    max-height: 70px;
  }

  .side-nav {
    gap: 6px;
    margin-bottom: 20px;
  }

  .side-link {
    height: 40px;
    padding: 0 12px;
    font-size: 13px;
  }

  .upload-card {
    padding: 12px;
  }

  .upload-title {
    font-size: 13px;
  }

  .upload-card p {
    margin: 6px 0 10px;
    font-size: 11px;
  }

  .upload-button {
    height: 34px;
    font-size: 11px;
  }

  .history-latest {
    font-size: 12px;
  }

  .history-item {
    font-size: 9px;
  }

  .history-item small {
    font-size: 8px;
  }

  .content-shell {
    padding: 16px 18px 28px;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 12px;
  }

  .app-title h1 {
    font-size: 26px;
  }

  .app-title p {
    margin-top: 4px;
    font-size: 13px;
  }

  .filters {
    gap: 8px;
    margin-left: auto;
  }

  .custom-select[data-filter="unit"] {
    width: 160px;
  }

  .custom-select[data-filter="machine"] {
    width: 174px;
  }

  .custom-select[data-filter="start"],
  .custom-select[data-filter="end"] {
    width: 108px;
  }

  .select-trigger {
    height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }

  .user-chip {
    min-height: 34px;
  }

  .kpis {
    gap: 10px;
    margin-bottom: 10px;
  }

  .kpi {
    min-height: 84px;
    padding: 12px 14px 11px;
  }

  .kpi .label {
    font-size: 10px;
  }

  .kpi .value {
    margin-top: 8px;
    font-size: 27px;
  }

  .kpi .meta {
    margin-top: 5px;
    font-size: 11px;
  }

  .panel {
    margin-bottom: 12px;
  }

  .panel-header {
    padding: 12px 16px 11px;
  }

  .panel-title {
    font-size: 18px;
  }

  .chart {
    padding: 0 12px 10px;
  }

  .chart-shell {
    --chart-canvas-height: 270px;
    --chart-card-height: 224px;
    --chart-label-height: 34px;
    --chart-plot-inset: 8px;
    --chart-canvas-padding-top: 12px;
    grid-template-columns: 50px minmax(0, 1fr);
    height: 282px;
  }

  .axis span {
    right: 8px;
    font-size: 12px;
  }

  .chart-canvas {
    grid-auto-columns: minmax(var(--machine-card-width, 148px), 1fr);
    gap: 7px;
    height: var(--chart-canvas-height);
    padding-top: var(--chart-canvas-padding-top);
  }

  .chart-card {
    grid-template-rows: 1fr var(--chart-label-height);
    min-width: var(--machine-card-width, 148px);
    height: var(--chart-card-height);
  }

  .bar-group {
    gap: 4px;
    margin-top: var(--chart-plot-inset);
    padding: 0 7px;
  }

  .bar {
    flex-basis: 13px;
    width: 13px;
  }
}

@media (max-width: 1350px) {
  .trend-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1000px) {
  .app-frame {
    grid-template-columns: 176px minmax(0, 1fr);
  }

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

  .filters {
    width: 100%;
    margin-left: 0;
  }

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

  .toolbar {
    justify-content: start;
    flex-wrap: wrap;
  }

  .kpis,
  .report-metrics,
  .report-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ranking-grid,
  .report-grid,
  .report-attention {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-frame {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .brand,
  .upload-card,
  .app-version {
    display: none;
  }

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

  .content-shell {
    padding: 14px;
  }

  .filters > .custom-select {
    width: calc(50% - 4px);
  }

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

  .trend-current,
  .trend-stat {
    border-bottom: 1px solid var(--line-soft);
  }

  .trend-stat:nth-child(2) {
    border-right: 0;
  }

  .trend-stat:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .kpis,
  .report-metrics,
  .ranking-grid,
  .report-grid,
  .report-summary,
  .report-attention {
    grid-template-columns: 1fr;
  }

  .chart-shell {
    grid-template-columns: 42px minmax(0, 1fr);
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 8mm;
  }

  html,
  body {
    width: auto;
    min-width: 0;
    background: #fff;
  }

  .content-shell {
    padding: 0 !important;
  }

  .topbar {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 6px;
    margin-bottom: 8px;
  }

  .app-title h1 {
    font-size: 24px;
    line-height: 1.05;
  }

  .app-title p {
    font-size: 12px;
    line-height: 1.25;
  }

  .report-page {
    gap: 8px;
  }

  .report-hero {
    min-height: 0;
    padding: 10px 14px;
  }

  .report-hero h2 {
    font-size: 18px;
  }

  .report-hero p {
    font-size: 11px;
  }

  .report-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 8px;
  }

  .report-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 8px;
    padding: 8px;
  }

  .report-grid,
  .report-attention {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  .report-card,
  .report-metric {
    min-height: 0;
    padding: 9px 11px;
  }

  .report-card strong,
  .report-metric strong {
    font-size: 18px;
  }

  .report-card small,
  .report-metric small {
    font-size: 10px;
  }

  .panel-header {
    min-height: 38px;
    padding: 8px 12px;
  }

  .panel-title {
    font-size: 16px;
  }

  .ranking-list,
  .report-attention {
    padding: 10px 12px 12px;
  }

  .rank-row {
    min-height: 30px;
    font-size: 11px;
  }

  .attention-row {
    min-height: 26px;
    font-size: 11px;
  }
}
