.kpi-page-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1540px;
  margin: 0 auto;
  padding: 18px 14px 30px;
  color: #10213a;
}

.kpi-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: 24px;
  padding: 22px 24px;
  background:
    radial-gradient(circle at top right, rgba(255, 206, 86, 0.35), transparent 30%),
    linear-gradient(135deg, #0f4c81 0%, #146c94 56%, #19a7ce 100%);
  color: #fff;
  box-shadow: 0 16px 40px rgba(15, 76, 129, 0.25);
}

.kpi-kicker {
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kpi-title {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
}

.kpi-subtitle {
  margin: 8px 0 0;
  max-width: 760px;
  font-size: 15px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.88);
}

.kpi-badge {
  flex: 0 0 auto;
  min-width: 120px;
  padding: 14px 18px;
  border-radius: 18px;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(6px);
}

.kpi-card {
  border: 1px solid #dbe7f3;
  border-radius: 22px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
  padding: 18px;
}

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

.kpi-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.kpi-field label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.kpi-field input {
  height: 44px;
  padding: 10px 13px;
  border-radius: 14px;
  border: 1px solid #c9d8e7;
  background: #fff;
  font-size: 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.kpi-field input:focus {
  outline: none;
  border-color: #1d4ed8;
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.14);
}

.kpi-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.kpi-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  min-width: auto;
  height: 27px;
  padding: 2px 10px;
  border: 1px solid #b8bec8;
  border-radius: 3px;
  background: linear-gradient(180deg, #ffffff 0%, #e9edf3 100%);
  color: #111827;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  transition: filter 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
}

.kpi-btn:hover {
  filter: brightness(1.03);
}

.kpi-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  filter: none;
}

.kpi-btn-primary {
  background: linear-gradient(180deg, #ffffff 0%, #e9edf3 100%);
  border: 1px solid #b8bec8;
  color: #111827;
  box-shadow: none;
}

.kpi-btn-secondary {
  background: linear-gradient(180deg, #ffffff 0%, #e9edf3 100%);
  border: 1px solid #b8bec8;
  color: #111827;
  box-shadow: none;
}

.kpi-status {
  min-height: 22px;
  font-size: 13px;
  font-weight: 700;
  color: #0f4c81;
}

.kpi-status.is-error {
  color: #b91c1c;
}

.kpi-status.is-warn {
  color: #92400e;
}

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

.kpi-tabs-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.kpi-tabs {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid #dbe7f3;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  align-self: flex-start;
}

.kpi-tab-btn {
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  background: transparent;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.kpi-tab-btn.is-active {
  background: linear-gradient(135deg, #0f4c81, #1d4ed8);
  color: #fff;
  box-shadow: 0 8px 16px rgba(29, 78, 216, 0.18);
}

.kpi-tab-panel[hidden] {
  display: none !important;
}

.kpi-report-narrative {
  font-size: 13px;
  line-height: 1.5;
  color: #1f2937;
}

.kpi-report-narrative h4 {
  margin: 0 0 8px;
  font-size: 13px;
}

.kpi-report-narrative ol {
  margin: 0;
  padding-left: 20px;
}

.kpi-report-narrative li {
  margin: 0 0 6px;
}

.kpi-report-note {
  margin-top: 10px;
  font-weight: 600;
}

.kpi-report-copy-btn {
  align-self: flex-start;
}

.kpi-summary-card {
  border-radius: 20px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(245, 250, 255, 0.98)), #fff;
  border: 1px solid #d9e6f2;
}

.kpi-summary-card h4 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
}

.kpi-summary-value {
  margin: 0;
  font-size: 30px;
  font-weight: 900;
  color: #0f172a;
}

.kpi-summary-foot {
  margin-top: 6px;
  font-size: 12px;
  color: #64748b;
}

.kpi-main-grid {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.kpi-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.kpi-card-header h3 {
  margin: 0;
  font-size: 18px;
}

.kpi-card-note {
  font-size: 12px;
  color: #64748b;
}

.kpi-metric-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kpi-manage-note {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid #dbe7f3;
  background: #f8fbff;
  color: #475569;
  font-size: 13px;
  line-height: 1.5;
}

.kpi-metric-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid #d9e6f2;
  background: #fff;
}

.kpi-metric-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.kpi-metric-main input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 3px;
}

.kpi-metric-title {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
}

.kpi-metric-meta {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
}

.kpi-metric-meta.warn {
  color: #92400e;
}

.kpi-metric-side {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-weight-label {
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
}

.kpi-weight-input {
  width: 100%;
  height: 40px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
}

.kpi-metric-extra {
  grid-column: 1 / -1;
  padding-top: 4px;
  border-top: 1px dashed #dbe7f3;
}

.kpi-metric-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 160px));
  gap: 10px;
}

.kpi-metric-setting {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-metric-setting span {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}

.kpi-metric-setting input {
  height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 700;
  background: #fff;
}

.kpi-table-wrap {
  overflow: auto;
}

.kpi-table {
  width: max-content;
  min-width: 0;
  border-collapse: collapse;
  border: 1px solid #d7e3ef;
  border-radius: 18px;
  overflow: hidden;
}

.kpi-table th,
.kpi-table td {
  border: 1px solid #d7e3ef;
  padding: 9px 5px;
  text-align: center;
  vertical-align: middle;
}

.kpi-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #e7f1ff;
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
}

.kpi-table td.left {
  text-align: left;
}

.kpi-table tbody tr:nth-child(odd) {
  background: #fff;
}

.kpi-table tbody tr:nth-child(even) {
  background: #f8fbff;
}

.kpi-total-score {
  font-size: 14px;
  font-weight: 900;
}

.kpi-score-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  min-width: 72px;
}

.kpi-score-chip strong {
  font-size: 13px;
}

.kpi-score-chip span {
  font-size: 11px;
  color: #64748b;
}

.kpi-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.kpi-status-pill.high {
  background: #dcfce7;
  color: #166534;
}

.kpi-status-pill.mid {
  background: #fef3c7;
  color: #92400e;
}

.kpi-status-pill.low {
  background: #fee2e2;
  color: #b91c1c;
}

.kpi-inline-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  min-width: auto;
  height: 27px;
  padding: 2px 10px;
  border: 1px solid #b8bec8;
  border-radius: 3px;
  background: linear-gradient(180deg, #ffffff 0%, #e9edf3 100%);
  color: #111827;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: none;
  transition: filter 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
}

.kpi-inline-btn:hover {
  filter: brightness(1.03);
}

.kpi-empty {
  padding: 28px 16px;
  border-radius: 18px;
  background: #f8fbff;
  border: 1px dashed #bfd3e6;
  text-align: center;
  color: #64748b;
  font-weight: 700;
}

.kpi-drawer {
  position: fixed;
  inset: 0;
  z-index: 10005;
  background: rgba(15, 23, 42, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.kpi-drawer[hidden] {
  display: none !important;
}

.kpi-drawer-card {
  width: min(1080px, 96vw);
  max-height: 92vh;
  overflow: auto;
  border-radius: 24px;
  background: #fff;
  border: 1px solid #dce7f1;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
}

.kpi-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 10px;
  border-bottom: 1px solid #e2e8f0;
}

.kpi-drawer-header h3 {
  margin: 0;
  font-size: 22px;
}

.kpi-drawer-meta {
  margin-top: 6px;
  font-size: 13px;
  color: #64748b;
}

.kpi-drawer-close {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: #e2e8f0;
  font-size: 22px;
  cursor: pointer;
}

.kpi-drawer-body {
  padding: 18px;
}

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

.kpi-detail-card {
  border-radius: 18px;
  padding: 14px;
  border: 1px solid #d8e5f0;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
}

.kpi-detail-card h4 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.kpi-detail-card strong {
  font-size: 24px;
  color: #0f172a;
}

.kpi-detail-table {
  width: 100%;
  border-collapse: collapse;
}

.kpi-detail-table th,
.kpi-detail-table td {
  border: 1px solid #d8e5f0;
  padding: 9px 8px;
  text-align: center;
}

.kpi-detail-table th {
  background: #eff6ff;
  font-size: 12px;
}

.kpi-detail-table td.left {
  text-align: left;
}

@media (max-width: 1080px) {
  .kpi-filter-grid,
  .kpi-summary-grid,
  .kpi-main-grid,
  .kpi-detail-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .kpi-page-shell {
    padding: 12px 8px 20px;
  }

  .kpi-card,
  .kpi-hero {
    border-radius: 18px;
    padding: 14px;
  }

  .kpi-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .kpi-btn {
    width: 100%;
  }
}

:root {
  --kpi-bg: #eef4fb;
  --kpi-surface: rgba(255, 255, 255, 0.84);
  --kpi-surface-strong: #ffffff;
  --kpi-border: rgba(148, 163, 184, 0.22);
  --kpi-border-strong: rgba(96, 165, 250, 0.26);
  --kpi-text: #10213a;
  --kpi-muted: #64748b;
  --kpi-primary: #124b7f;
  --kpi-primary-strong: #1d4ed8;
  --kpi-success: #16a34a;
  --kpi-warning: #d97706;
  --kpi-danger: #dc2626;
  --kpi-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

.kpi-page-shell {
  position: relative;
  gap: 20px;
  padding-top: 22px;
}

.kpi-page-shell::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 300px;
  background:
    radial-gradient(circle at 0% 0%, rgba(59, 130, 246, 0.16), transparent 38%),
    radial-gradient(circle at 100% 0%, rgba(20, 184, 166, 0.14), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent);
  pointer-events: none;
}

.kpi-page-shell > * {
  position: relative;
  z-index: 1;
}

.kpi-hero {
  border: 1px solid rgba(255, 255, 255, 0.22);
  min-height: 180px;
  align-items: stretch;
}

.kpi-hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.kpi-hero-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-width: 260px;
}

.kpi-hero-pills {
  display: grid;
  gap: 10px;
}

.kpi-hero-pill {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(10px);
}

.kpi-filter-card,
.kpi-tabs-shell .kpi-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(248,251,255,0.92));
  box-shadow: var(--kpi-shadow);
  border: 1px solid var(--kpi-border);
}

.kpi-card-header {
  margin-bottom: 16px;
}

.kpi-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kpi-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--kpi-border-strong);
  background: rgba(255, 255, 255, 0.9);
  color: var(--kpi-primary);
  font-size: 12px;
  font-weight: 800;
}

.kpi-filter-grid {
  grid-template-columns: 180px 180px minmax(260px, 1fr);
  align-items: end;
}

.kpi-field input,
.kpi-toolbar-field input,
.kpi-toolbar-field select,
.kpi-metric-setting input,
.kpi-weight-input {
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.kpi-tabs-shell {
  gap: 18px;
}

.kpi-tabs {
  padding: 7px;
  border-radius: 20px;
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(10px);
}

.kpi-tab-btn {
  min-width: 112px;
}

.kpi-tab-btn.is-active {
  background: linear-gradient(135deg, #0f3f69, #2563eb);
}

.kpi-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.kpi-summary-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
}

.kpi-summary-card::after {
  content: "";
  position: absolute;
  inset: auto -24px -24px auto;
  width: 88px;
  height: 88px;
  border-radius: 999px;
  background: rgba(255,255,255,0.55);
}

.kpi-summary-card.tone-blue {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
}

.kpi-summary-card.tone-dark {
  background: linear-gradient(135deg, #e0f2fe, #dbeafe);
}

.kpi-summary-card.tone-green {
  background: linear-gradient(135deg, #ecfdf3, #dcfce7);
}

.kpi-summary-card.tone-red {
  background: linear-gradient(135deg, #fff1f2, #fee2e2);
}

.kpi-summary-card.tone-amber {
  background: linear-gradient(135deg, #fff8eb, #fde68a);
}

.kpi-summary-card.tone-purple {
  background: linear-gradient(135deg, #f5f3ff, #e9d5ff);
}

.kpi-summary-card.tone-neutral {
  background: linear-gradient(135deg, #ffffff, #eff6ff);
}

.kpi-table-toolbar {
  display: flex;
  justify-content: flex-start;
  gap: 16px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 18px;
  border: 1px solid var(--kpi-border);
  background: linear-gradient(180deg, rgba(245,250,255,0.96), rgba(255,255,255,0.9));
}

.kpi-table-toolbar-main {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  flex: 1 1 auto;
}

.kpi-toolbar-shot-wrap {
  display: flex;
  align-items: flex-end;
}

.kpi-toolbar-shot-wrap .kpi-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.kpi-table-shot-root {
  background: #ffffff;
}

.kpi-table-toolbar-side {
  display: none;
}

.kpi-toolbar-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 240px;
  min-width: 200px;
  max-width: 420px;
}

.kpi-toolbar-field span {
  font-size: 12px;
  font-weight: 800;
  color: var(--kpi-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-toolbar-field input,
.kpi-toolbar-field select {
  height: 40px;
  padding: 9px 12px;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 700;
  color: var(--kpi-text);
}

.kpi-table-meta {
  min-width: 240px;
  align-self: center;
  color: var(--kpi-muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}

.kpi-table-hint {
  font-size: 12px;
  font-weight: 800;
  color: var(--kpi-primary);
}

.kpi-table-meta,
.kpi-table-hint {
  display: none;
}

.kpi-table-shell {
  overflow: auto;
  border-radius: 20px;
  border: 1px solid var(--kpi-border);
  background: rgba(255,255,255,0.92);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.kpi-table-stats {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px 2px;
}

.kpi-table-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kpi-table-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(255, 255, 255, 0.82);
  color: var(--kpi-muted);
  font-size: 11px;
  font-weight: 700;
}

.kpi-table-stat strong {
  color: var(--kpi-text);
  font-size: 12px;
  font-weight: 900;
}

.kpi-table-formula {
  margin: 0;
  color: #7b8aa1;
  font-size: 11px;
  line-height: 1.45;
  text-transform: lowercase;
}

.kpi-table {
  width: max-content;
  min-width: 0;
  border: none;
  background: transparent;
  border-collapse: separate;
  border-spacing: 0;
}

.kpi-table th,
.kpi-table td {
  border: none;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  padding: 9px 5px;
}

.kpi-table th {
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, #edf5ff, #e4eefb);
  white-space: nowrap;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
}

.kpi-header-btn i {
  font-size: 11px;
  color: #6b7c93;
}

.kpi-table tbody tr {
  transition: transform 0.14s ease, background-color 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.kpi-table tbody tr:hover {
  background: linear-gradient(180deg, rgba(248,251,255,0.95), rgba(239,246,255,0.95));
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.kpi-table tbody tr:nth-child(odd),
.kpi-table tbody tr:nth-child(even) {
  background: transparent;
}

.kpi-table .is-sticky-col {
  position: sticky;
  z-index: 1;
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(8px);
}

.kpi-table th.is-sticky-col {
  z-index: 4;
  background: linear-gradient(180deg, #edf5ff, #e4eefb);
}

.sticky-rank { left: 0; min-width: 44px; width: 44px; }
.sticky-code { left: 44px; min-width: 70px; width: 70px; }
.sticky-name { left: 114px; min-width: 158px; width: 158px; max-width: 158px; }

.kpi-table tbody td {
  font-variant-numeric: tabular-nums;
}

.kpi-table tbody td.left strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 132px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-table tbody td.left strong::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #60a5fa, #22c55e);
  box-shadow: 0 0 0 4px rgba(96,165,250,0.12);
}

.kpi-total-score {
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.kpi-total-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  padding: 6px 7px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background:
    linear-gradient(90deg, rgba(37, 99, 235, 0.18) 0%, rgba(37, 99, 235, 0.18) var(--score-pct), rgba(241, 245, 249, 0.95) var(--score-pct), rgba(241, 245, 249, 0.95) 100%);
  overflow: hidden;
}

.kpi-total-pill.high {
  background:
    linear-gradient(90deg, rgba(34, 197, 94, 0.22) 0%, rgba(34, 197, 94, 0.22) var(--score-pct), rgba(241, 245, 249, 0.95) var(--score-pct), rgba(241, 245, 249, 0.95) 100%);
}

.kpi-total-pill.mid {
  background:
    linear-gradient(90deg, rgba(245, 158, 11, 0.22) 0%, rgba(245, 158, 11, 0.22) var(--score-pct), rgba(241, 245, 249, 0.95) var(--score-pct), rgba(241, 245, 249, 0.95) 100%);
}

.kpi-total-pill.low {
  background:
    linear-gradient(90deg, rgba(239, 68, 68, 0.18) 0%, rgba(239, 68, 68, 0.18) var(--score-pct), rgba(241, 245, 249, 0.95) var(--score-pct), rgba(241, 245, 249, 0.95) 100%);
}

.kpi-score-chip {
  display: inline-grid;
  grid-template-columns: minmax(34px, auto) minmax(30px, auto);
  align-items: stretch;
  justify-content: center;
  min-width: 86px;
  gap: 0;
  padding: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(241,245,249,0.96));
  border: 1px solid rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.kpi-score-main,
.kpi-score-raw {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  white-space: nowrap;
}

.kpi-score-main {
  padding: 0 8px;
  font-size: 15px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--kpi-text);
}

.kpi-score-raw {
  padding: 0 7px;
  border-left: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(255,255,255,0.42);
  color: var(--kpi-muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.kpi-score-chip.is-strong {
  border-color: rgba(34,197,94,0.24);
}

.kpi-score-chip.is-mid {
  border-color: rgba(245,158,11,0.24);
}

.kpi-score-chip.is-low {
  border-color: rgba(239,68,68,0.2);
}

.kpi-raw-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 30px;
  padding: 0 7px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(241,245,249,0.96));
  border: 1px solid rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.kpi-raw-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  color: var(--kpi-text);
  font-variant-numeric: tabular-nums;
}

.kpi-raw-chip.is-strong {
  border-color: rgba(34,197,94,0.24);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(240,253,244,0.96));
}

.kpi-raw-chip.is-mid {
  border-color: rgba(245,158,11,0.24);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,251,235,0.96));
}

.kpi-raw-chip.is-low {
  border-color: rgba(239,68,68,0.2);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(254,242,242,0.96));
}

.kpi-row-high td:first-child {
  box-shadow: inset 3px 0 0 #22c55e;
}

.kpi-row-mid td:first-child {
  box-shadow: inset 3px 0 0 #f59e0b;
}

.kpi-row-low td:first-child {
  box-shadow: inset 3px 0 0 #ef4444;
}

.kpi-context-menu {
  position: fixed;
  z-index: 10020;
  width: min(320px, calc(100vw - 24px));
  padding: 7px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(255,255,255,0.92);
  box-shadow: 0 24px 48px rgba(15,23,42,0.2);
  backdrop-filter: blur(16px);
}

.kpi-context-menu[hidden] {
  display: none !important;
}

.kpi-context-action {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  border: none;
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(248,251,255,0.98), rgba(239,246,255,0.98));
  cursor: pointer;
  text-align: left;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.kpi-context-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(37,99,235,0.12);
  background: linear-gradient(180deg, rgba(239,246,255,1), rgba(219,234,254,1));
}

.kpi-context-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0f4c81, #2563eb);
  color: #fff;
  font-size: 10px;
  box-shadow: 0 6px 12px rgba(37,99,235,0.14);
}

.kpi-context-action strong {
  display: block;
  margin-bottom: 0;
  font-size: 12px;
  line-height: 1.15;
  color: var(--kpi-text);
}

.kpi-context-action small {
  display: block;
  font-size: 10px;
  line-height: 1.1;
  color: var(--kpi-muted);
}

.kpi-table tbody tr {
  cursor: context-menu;
}

.kpi-header-filter-modal {
  position: fixed;
  inset: 0;
  z-index: 10030;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.kpi-header-filter-modal[hidden] {
  display: none !important;
}

.kpi-header-filter-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.32);
  backdrop-filter: blur(6px);
}

.kpi-header-filter-card {
  position: relative;
  width: min(540px, 96vw);
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,250,255,0.96));
  box-shadow: 0 30px 60px rgba(15,23,42,0.18);
  overflow: hidden;
}

.kpi-header-filter-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.kpi-header-filter-kicker {
  font-size: 11px;
  font-weight: 800;
  color: var(--kpi-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.kpi-header-filter-top h3 {
  margin: 6px 0 0;
  font-size: 24px;
  color: var(--kpi-text);
}

.kpi-header-filter-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 12px;
  background: #e2e8f0;
  font-size: 20px;
  cursor: pointer;
}

.kpi-header-filter-body {
  padding: 18px 20px 20px;
}

.kpi-header-filter-modal .kpi-table-stats {
  display: none !important;
}

.kpi-filter-section + .kpi-filter-section {
  margin-top: 18px;
}

.kpi-filter-section h4 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  color: var(--kpi-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-filter-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.kpi-filter-action {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(241,245,249,0.98));
  color: var(--kpi-text);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.kpi-filter-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(37,99,235,0.08);
}

.kpi-filter-action.is-active {
  border-color: rgba(37,99,235,0.26);
  background: linear-gradient(135deg, rgba(219,234,254,0.98), rgba(239,246,255,0.98));
  color: #124b7f;
}

.kpi-filter-footer {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

.kpi-filter-clear {
  padding: 8px 12px;
  border: none;
  border-radius: 12px;
  background: #eef2f7;
  color: var(--kpi-text);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.kpi-metric-row {
  grid-template-columns: minmax(0, 1fr) 88px;
  padding: 14px;
  border-radius: 18px;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.kpi-metric-row.is-active {
  border-color: rgba(37, 99, 235, 0.24);
  box-shadow: 0 12px 22px rgba(37, 99, 235, 0.08);
}

.kpi-metric-row.is-muted {
  opacity: 0.84;
}

.kpi-detail-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1180px) {
  .kpi-table-toolbar {
    flex-direction: column;
  }

  .kpi-table-toolbar-main {
    width: 100%;
  }

  .kpi-toolbar-field {
    max-width: none;
  }

  .kpi-hero-side {
    min-width: 100%;
  }
}

@media (max-width: 860px) {
  .kpi-filter-grid {
    grid-template-columns: 1fr;
  }

  .kpi-toolbar-shot-wrap {
    width: 100%;
  }

  .kpi-toolbar-shot-wrap .kpi-btn {
    width: 100%;
    justify-content: center;
  }

  .sticky-name {
    min-width: 168px;
    width: 168px;
    max-width: 168px;
  }

  .kpi-chip-row {
    justify-content: flex-start;
  }
}

/* Compact Excel-like redesign overrides */
.kpi-page-shell {
  font-family: "Segoe UI", "Inter", sans-serif;
  font-size: 12px;
}

.kpi-page-shell h1,
.kpi-page-shell h2,
.kpi-page-shell h3,
.kpi-page-shell h4,
.kpi-page-shell strong,
.kpi-page-shell label,
.kpi-page-shell .kpi-card-note,
.kpi-page-shell .kpi-table-meta,
.kpi-page-shell .kpi-table-hint {
  font-weight: 600;
}

.kpi-page-shell small,
.kpi-page-shell .kpi-summary-foot,
.kpi-page-shell .kpi-table-formula,
.kpi-page-shell .kpi-kicker {
  font-size: 11px;
}

.kpi-card,
.kpi-filter-card,
.kpi-tabs-shell .kpi-card,
.kpi-table-shell,
.kpi-table-toolbar {
  border-radius: 10px;
  box-shadow: none;
}

.kpi-card {
  padding: 12px;
}

.kpi-card-header {
  margin-bottom: 10px;
}

.kpi-card-header h3 {
  font-size: 14px;
  font-weight: 600;
}

.kpi-tabs-shell {
  gap: 10px;
}

.kpi-tabs {
  gap: 6px;
  padding: 3px;
  border-radius: 6px;
  border: 1px solid #cfd6e0;
  background: #f3f5f8;
  box-shadow: none;
  backdrop-filter: none;
}

.kpi-tab-btn {
  min-width: 0;
  height: 28px;
  padding: 4px 10px;
  border: 1px solid #c5ccd6;
  border-radius: 6px;
  background: #edf1f5;
  color: #334155;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  box-shadow: none;
  transition: filter 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}

.kpi-tab-btn:hover {
  filter: brightness(1.02);
}

.kpi-tab-btn.is-active {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e3a8a;
  box-shadow: none;
}

.kpi-btn,
.kpi-btn-primary,
.kpi-btn-secondary,
.kpi-inline-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  min-width: auto;
  height: 27px;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  box-shadow: none;
}

.kpi-summary-grid {
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.kpi-summary-card {
  padding: 10px;
  border-radius: 10px;
  background: #f8fafc;
  box-shadow: none;
}

.kpi-summary-card::after {
  display: none;
}

.kpi-summary-card.tone-blue,
.kpi-summary-card.tone-dark,
.kpi-summary-card.tone-green,
.kpi-summary-card.tone-red,
.kpi-summary-card.tone-amber,
.kpi-summary-card.tone-purple,
.kpi-summary-card.tone-neutral {
  background: #f8fafc;
}

.kpi-summary-card h4 {
  margin: 0 0 4px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
}

.kpi-summary-value {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.15;
}

.kpi-summary-foot {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.2;
}

.kpi-field input,
.kpi-toolbar-field input,
.kpi-toolbar-field select,
.kpi-metric-setting input,
.kpi-weight-input {
  height: 31px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.kpi-toolbar-field span,
.kpi-field label {
  font-size: 11px;
  font-weight: 600;
}

.kpi-table-toolbar {
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 10px;
}

.kpi-tabs {
  display: inline-flex;
  align-items: stretch;
  gap: 6px;
}

.kpi-tab-btn {
  min-width: 120px;
  max-width: 150px;
  min-height: 32px;
  height: auto;
  padding: 4px 12px;
  font-size: 11px;
  line-height: 1.15;
  white-space: normal;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
