:root {
  --bg: #eef5f9;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --brand-blue: #0b72b9;
  --brand-blue-dark: #07528a;
  --brand-gold: #b08a36;
  --green: #4fb600;
  --orange: #ff8200;
  --cyan: #13b7df;
  --yellow: #f8bf00;
  --teal: #02c85a;
  --red: #f23253;
  --line: #ecedf0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 0%, rgba(19, 183, 223, .18), transparent 28%),
    radial-gradient(circle at 92% 0%, rgba(11, 114, 185, .18), transparent 30%),
    linear-gradient(180deg, #f7fbfd 0%, var(--bg) 46%, #eef4e7 100%);
  color: var(--text);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

.locked { display: none !important; }

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 8% 0%, rgba(19, 183, 223, .18), transparent 28%),
    radial-gradient(circle at 92% 0%, rgba(11, 114, 185, .18), transparent 30%),
    linear-gradient(180deg, #f7fbfd 0%, var(--bg) 100%);
}

.login-screen.hidden { display: none; }

.login-box,
.admin-panel {
  width: min(460px, 100%);
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(11, 114, 185, .12);
  box-shadow: 0 24px 70px rgba(9, 35, 59, .14);
  padding: 34px;
}

.login-box h1,
.admin-panel h1 {
  margin: 0;
  color: #09233b;
  font-size: 28px;
  font-weight: 900;
}

.login-box p,
.admin-panel p {
  margin: 12px 0 22px;
  color: #667085;
  font-size: 14px;
  line-height: 1.65;
  font-weight: 700;
}

.login-box input,
.admin-input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #d8e4ed;
  border-radius: 8px;
  padding: 0 12px;
  color: #0b1f35;
  font-size: 15px;
  font-weight: 800;
  outline: none;
}

.login-box input:focus,
.admin-input:focus {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(11, 114, 185, .14);
}

.login-box button,
.admin-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  border: 0;
  border-radius: 999px;
  background: var(--brand-blue);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

.login-box a,
.admin-links a {
  display: inline-block;
  margin-top: 16px;
  color: var(--brand-blue-dark);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.login-error,
.admin-status.bad {
  margin-top: 12px;
  color: #d92d20;
  font-size: 13px;
  font-weight: 800;
}

.admin-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.admin-kicker {
  margin: 0 0 8px !important;
  color: var(--brand-gold) !important;
  font-size: 12px !important;
  letter-spacing: .08em;
}

.field-label {
  display: block;
  margin: 18px 0 8px;
  color: #344054;
  font-size: 13px;
  font-weight: 900;
}

.file-input {
  padding: 10px 12px;
}

.admin-submit:disabled {
  cursor: not-allowed;
  opacity: .65;
}

.admin-status {
  min-height: 22px;
  margin: 14px 0 0 !important;
  color: #667085;
  font-weight: 800 !important;
}

.admin-status.ok {
  color: #12805c;
}

.page {
  width: min(1560px, 100%);
  margin: 0 auto;
  padding: 28px 24px 54px;
}

.page-header {
  position: relative;
  text-align: center;
  padding-top: 4px;
}

h1 {
  margin: 0 0 16px;
  font-size: 34px;
  line-height: 1.1;
  font-weight: 900;
  color: #09233b;
}

.toolbar {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.view-switch {
  display: flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
}

.view-switch button,
.refresh-btn,
.export-btn {
  border: 0;
  min-width: 116px;
  min-height: 38px;
  border-radius: 999px;
  padding: 0 18px;
  background: transparent;
  color: #46602f;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

.toolbar-actions {
  position: absolute;
  right: 0;
  top: 50%;
  display: flex;
  gap: 8px;
  transform: translateY(-50%);
}

.toolbar-actions .refresh-btn,
.toolbar-actions .export-btn {
  min-width: 98px;
  min-height: 34px;
  padding: 0 14px;
  font-size: 13px;
}

.view-switch button.active,
.refresh-btn {
  background: var(--brand-blue);
  color: #fff;
}

.refresh-btn {
  background: var(--brand-blue-dark);
}

.export-btn {
  background: var(--brand-gold);
  color: #fff;
}

.source-line {
  min-height: 20px;
  margin: 12px 0 34px;
  color: #5c6751;
  font-size: 13px;
  font-weight: 700;
}

.view { display: none; }
.view:not(.active-view) { display: none !important; }
.view.active-view { display: grid; }

.dashboard,
.cockpit {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.card {
  min-width: 0;
  background: var(--card);
  border: 1px solid rgba(11, 114, 185, .08);
  border-radius: 18px;
  padding: 24px;
  overflow: hidden;
  box-shadow: 0 16px 42px rgba(9, 35, 59, .08);
}

.poster-dashboard {
  align-items: stretch;
}

.poster-hero {
  grid-column: span 12;
  min-height: 118px;
  border-radius: 22px;
  padding: 26px 34px;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  color: #fff;
  background:
    linear-gradient(120deg, rgba(3, 57, 97, .92), rgba(11, 114, 185, .84)),
    linear-gradient(45deg, #118bd0, #68c8f0);
  box-shadow: 0 20px 50px rgba(11, 114, 185, .22);
}

.brand-mark {
  width: 68px;
  height: 68px;
  border: 2px solid rgba(255,255,255,.84);
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 44px;
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 900;
  background: rgba(255,255,255,.12);
}

.brand-name {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0;
}

.brand-subtitle {
  margin-top: 8px;
  color: rgba(255,255,255,.82);
  font-size: 18px;
  font-weight: 700;
}

.brand-profile {
  max-width: 390px;
  border-left: 1px solid rgba(255,255,255,.32);
  padding-left: 22px;
  color: rgba(255,255,255,.88);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 800;
}

.kpi {
  min-height: 170px;
  display: grid;
  place-items: center;
  text-align: center;
}

.kpi.small { grid-column: span 3; }
.kpi.cost { grid-column: span 6; }

.kpi-value {
  font-size: 66px;
  line-height: 1;
  font-weight: 900;
  color: var(--brand-blue);
}

.kpi-value.orange { color: var(--orange); }
.kpi-unit {
  display: inline-block;
  margin-left: 10px;
  font-size: 38px;
  vertical-align: 12px;
}

.kpi-label {
  margin-top: 18px;
  font-size: 22px;
  font-weight: 800;
  color: var(--brand-blue-dark);
}

.kpi-label.orange { color: var(--orange); }

.section-title {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 900;
  color: #0b1f35;
}

.wide-left { grid-column: span 6; }
.wide-right { grid-column: span 6; }
.third { grid-column: span 3; }
.text-mid { grid-column: span 3; }
.bar-wide { grid-column: span 6; }
.performance-overview,
.performance-list-card,
.cost-overview { grid-column: span 4; }
.bottom-left { grid-column: span 4; }
.bottom-mid { grid-column: span 4; }
.bottom-right { grid-column: span 4; }
.poster-span-12 { grid-column: span 12; }

.chart-card { min-height: 440px; }
.perf-card { min-height: 390px; }
.performance-overview,
.performance-list-card,
.cost-overview {
  position: relative;
  min-height: 460px;
}

.performance-overview::before,
.performance-list-card::before,
.cost-overview::before {
  content: "";
  position: absolute;
  left: 24px;
  right: 24px;
  top: 0;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-gold));
}

.legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 4px;
  color: #4b5563;
  font-size: 13px;
}

.legend.centered { justify-content: center; }

.legend span::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 13px;
  margin-right: 7px;
  vertical-align: -2px;
  background: currentColor;
}

.chart-box {
  min-height: 350px;
}

svg {
  max-width: 100%;
  display: block;
}

.donut-svg {
  width: 100%;
  height: 405px;
}

.company-chart-clean {
  min-height: 350px;
  display: grid;
  grid-template-columns: minmax(260px, 0.92fr) minmax(260px, 1.08fr);
  gap: 22px;
  align-items: center;
  padding: 8px 8px 0;
}

.company-donut-panel {
  display: grid;
  place-items: center;
}

.donut-svg-clean {
  width: min(300px, 100%);
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 10px 22px rgba(17, 24, 39, .08));
}

.company-rank-clean {
  display: grid;
  gap: 8px;
}

.company-rank-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) 48px 72px;
  gap: 10px;
  align-items: center;
  min-height: 34px;
  border-radius: 8px;
  padding: 6px 10px;
  background: #fbfcf8;
  border: 1px solid #edf1e7;
  font-size: 14px;
  font-weight: 800;
}

.company-rank-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.company-rank-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #26351f;
}

.company-rank-num,
.company-rank-pct {
  text-align: right;
  color: #4b5563;
  font-variant-numeric: tabular-nums;
}

.line-svg {
  width: 100%;
  height: 360px;
}

.perf-overview-grid {
  display: grid;
  grid-template-columns: minmax(160px, .95fr) minmax(170px, 1.05fr);
  gap: 18px;
  align-items: center;
  min-height: 288px;
  padding-top: 6px;
}

.pie-svg {
  width: 100%;
  height: auto;
  max-height: 245px;
  overflow: visible;
}

.perf-breakdown {
  display: grid;
  gap: 10px;
}

.perf-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 54px;
  gap: 10px;
  align-items: center;
  min-height: 30px;
  color: #344054;
  font-size: 13px;
  font-weight: 900;
}

.perf-row .track {
  height: 8px;
  background: #edf4f8;
}

.perf-row .fill {
  background: currentColor;
}

.bar-svg {
  width: 100%;
  height: 294px;
}

.text-card {
  min-height: 460px;
  max-height: none;
  padding: 24px 24px 20px;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 700;
  overflow: visible;
}

.red-title {
  color: #c01f2f;
  font-size: 17px;
  font-weight: 900;
  margin: 0 0 10px;
}

.employee-block {
  margin: 0 0 8px;
  padding: 9px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff, #f5f9fc);
  border: 1px solid rgba(11, 114, 185, .09);
}
.employee-block strong { font-weight: 900; }
.employee-block.top { border-left: 4px solid var(--brand-blue); }
.employee-block.low { border-left: 4px solid var(--red); }
.employee-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 5px;
  color: #5b6778;
  font-size: 12px;
  font-weight: 800;
}
.employee-grade {
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--brand-blue);
}
.employee-block.low .employee-grade { background: var(--red); }

.bottom-card {
  min-height: 332px;
  padding: 32px 30px;
  font-size: 18px;
  line-height: 1.8;
  font-weight: 700;
}

.green-title {
  color: #2f6b24;
  font-size: 24px;
  font-weight: 900;
  margin: 0 0 34px;
}

.orange-title {
  color: #ff6b00;
  font-size: 22px;
  font-weight: 900;
  margin: 0 0 8px;
}

.blue-title {
  color: #00b8e8;
  font-size: 22px;
  font-weight: 900;
  margin: 0 0 14px;
}

.spaced { margin-top: 28px; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 26px;
  row-gap: 8px;
}

.note { margin: 0 0 28px; }
.name { font-weight: 900; }

.cockpit .card {
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .08);
}

.cockpit-head {
  grid-column: span 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 2px 6px;
}

.cockpit-title {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
}

.cockpit-subtitle {
  margin: 6px 0 0;
  color: #667085;
  font-size: 14px;
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.filters select {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid #d7dfcc;
  background: #fff;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: #26351f;
}

.metric {
  grid-column: span 3;
  min-height: 132px;
  display: grid;
  align-content: space-between;
}

.metric-label {
  color: #667085;
  font-size: 14px;
  font-weight: 800;
}

.metric-value {
  margin-top: 18px;
  font-size: 34px;
  line-height: 1;
  font-weight: 900;
  color: #182230;
}

.metric-tag {
  margin-top: 14px;
  width: max-content;
  max-width: 100%;
  border-radius: 999px;
  padding: 5px 10px;
  background: #edf7e9;
  color: #31810a;
  font-size: 12px;
  font-weight: 900;
}

.metric-tag.warn { background: #fff3df; color: #c06b00; }
.metric-tag.bad { background: #fff0f1; color: #d82f49; }

.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }

.cockpit-chart { min-height: 326px; }

.bar-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.bar-item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
  min-height: 28px;
  font-size: 14px;
}

.bar-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #344054;
  font-weight: 800;
}

.track {
  height: 10px;
  border-radius: 999px;
  background: #edf1e7;
  overflow: hidden;
}

.fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #72bf00, #13b7df);
}

.bar-num {
  text-align: right;
  font-weight: 900;
}

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

.mini-stat {
  border: 1px solid #edf1e7;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcf8;
}

.mini-stat b {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  color: #315a28;
}

.risk-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.risk {
  border-left: 4px solid #ff8200;
  border-radius: 8px;
  background: #fff9ef;
  padding: 12px;
  font-size: 14px;
  line-height: 1.55;
}

.risk strong {
  display: block;
  margin-bottom: 4px;
  color: #111827;
}

.risk.red {
  border-color: #f23253;
  background: #fff4f6;
}

.matrix {
  width: 100%;
  border-collapse: collapse;
  margin-top: 14px;
  font-size: 14px;
}

.matrix th,
.matrix td {
  padding: 10px;
  border-bottom: 1px solid #edf1e7;
  text-align: left;
  white-space: nowrap;
}

.matrix th {
  color: #667085;
  background: #fbfcf8;
  font-weight: 900;
}

.rank-tag {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  background: #edf7e9;
  color: #31810a;
  font-size: 12px;
  font-weight: 900;
}

.rank-tag.warn {
  background: #fff3df;
  color: #c06b00;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  border-radius: 8px;
  padding: 12px 14px;
  background: #111827;
  color: #fff;
  font-size: 14px;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1200px) {
  .toolbar {
    justify-content: center;
    flex-wrap: wrap;
  }
  .toolbar-actions {
    position: static;
    transform: none;
    justify-content: center;
  }
  .kpi.small, .kpi.cost, .wide-left, .wide-right, .third, .text-mid, .bar-wide, .performance-overview, .performance-list-card, .cost-overview, .bottom-left, .bottom-mid, .bottom-right, .poster-span-12,
  .metric, .span-4, .span-5, .span-7, .span-8 {
    grid-column: span 12;
  }
  .poster-hero {
    grid-template-columns: 76px 1fr;
  }
  .brand-profile {
    grid-column: 1 / -1;
    max-width: none;
    border-left: 0;
    border-top: 1px solid rgba(255,255,255,.28);
    padding-left: 0;
    padding-top: 14px;
  }
  .kpi { min-height: 160px; }
  .kpi-value { font-size: 58px; }
  .chart-card, .perf-card, .text-card, .bottom-card { min-height: auto; }
  .cockpit-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .filters { justify-content: flex-start; }
}

@media (max-width: 700px) {
  .page { padding: 26px 12px; }
  h1 { font-size: 26px; }
  .poster-hero {
    grid-template-columns: 1fr;
    padding: 22px;
    text-align: center;
  }
  .brand-mark {
    margin: 0 auto;
  }
  .brand-name {
    font-size: 24px;
  }
  .brand-subtitle,
  .brand-profile {
    font-size: 14px;
  }
  .toolbar { align-items: stretch; }
  .view-switch { width: 100%; }
  .view-switch button { min-width: 0; flex: 1; }
  .toolbar-actions {
    width: 100%;
  }
  .toolbar-actions .refresh-btn,
  .toolbar-actions .export-btn {
    flex: 1;
    width: auto;
  }
  .card { border-radius: 12px; padding: 16px; }
  .kpi-value { font-size: 48px; }
  .kpi-unit { font-size: 24px; vertical-align: 8px; }
  .kpi-label { font-size: 18px; margin-top: 16px; }
  .legend { gap: 12px; font-size: 12px; }
  .chart-box { min-height: 320px; }
  .company-chart-clean { grid-template-columns: 1fr; }
  .perf-overview-grid { grid-template-columns: 1fr; }
  .company-rank-row { grid-template-columns: 10px minmax(0, 1fr) 44px 66px; font-size: 13px; }
  .text-card, .bottom-card { font-size: 15px; line-height: 1.75; }
  .two-col, .mini-grid { grid-template-columns: 1fr; }
  .bar-item { grid-template-columns: 86px minmax(0, 1fr) 36px; }
  .matrix-wrap { overflow-x: auto; }
}
