.performance-shell {
  width: min(1320px, calc(100vw - 28px));
}

.performance-topbar {
  grid-template-columns: minmax(0, 1fr);
}

.performance-filter-panel {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.date-filter {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.date-filter summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  cursor: pointer;
  list-style: none;
  color: var(--ink);
  font-weight: 900;
}

.date-filter summary::-webkit-details-marker {
  display: none;
}

.date-filter summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.date-grid {
  display: grid;
  gap: 12px;
}

.date-grid {
  grid-template-columns: repeat(2, minmax(0, 220px));
  margin-top: 12px;
}

.quick-date-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.quick-date-row button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--teal-dark);
  padding: 0 11px;
  font-size: 13px;
  font-weight: 900;
}

.quick-date-row button.active {
  border-color: var(--teal-dark);
  background: var(--teal-dark);
  color: #fff;
}

.performance-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.performance-derived-kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

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

.performance-breakdowns .panel {
  min-width: 0;
  margin-bottom: 0;
}

.filter-card-grid {
  display: grid;
  gap: 9px;
}

.filter-metric,
.empty-filter-card {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  text-align: left;
}

.filter-metric {
  display: grid;
  gap: 4px;
  color: var(--ink);
}

.filter-metric span,
.filter-metric small,
.empty-filter-card {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.filter-metric span {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.filter-metric strong {
  color: var(--teal-dark);
  font-size: 20px;
  line-height: 1.18;
}

.filter-metric.active {
  border-color: var(--teal);
  background: #edf8f5;
  box-shadow: 0 0 0 3px rgba(16, 118, 111, 0.12);
}

.performance-table-wrap {
  overflow-x: auto;
}

.performance-table {
  width: 100%;
  min-width: 1320px;
  border-collapse: collapse;
}

.performance-table th,
.performance-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 9px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

.performance-table th {
  color: var(--muted);
  background: var(--surface-strong);
  font-weight: 900;
  white-space: nowrap;
}

.performance-table td {
  color: var(--ink);
  font-weight: 700;
}

.performance-table tbody tr:hover {
  background: #f7faf8;
}

.number-cell {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.empty-cell {
  padding: 22px 12px !important;
  color: var(--muted) !important;
  text-align: center !important;
}

.monthly-dialog {
  width: min(1240px, calc(100vw - 24px));
  max-height: min(860px, calc(100vh - 24px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.monthly-panel {
  max-height: min(860px, calc(100vh - 24px));
  overflow: auto;
}

.monthly-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  justify-content: flex-end;
}

.monthly-month-field {
  width: 160px;
}

.monthly-month-field input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.monthly-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 230px);
  gap: 14px;
  align-items: start;
}

.monthly-main-table,
.monthly-date-table {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.monthly-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.monthly-table.compact {
  min-width: 0;
}

.monthly-table th,
.monthly-table td {
  border-bottom: 1px solid var(--line);
  padding: 7px 8px;
  color: var(--ink);
  font-size: 14px;
  white-space: nowrap;
}

.monthly-table th {
  color: var(--muted);
  font-weight: 900;
  text-align: left;
}

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

.monthly-table .highlight-col {
  background: #ffff00;
}

.monthly-table .total-row td {
  background: #fff;
  font-weight: 900;
}

@media (max-width: 900px) {
  .performance-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .performance-derived-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .performance-breakdowns {
    grid-template-columns: 1fr;
  }

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

  .monthly-layout {
    grid-template-columns: 1fr;
  }

  .monthly-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .performance-shell {
    width: min(100vw - 20px, 1320px);
  }

  .performance-kpis {
    grid-template-columns: 1fr;
  }

  .performance-derived-kpis {
    grid-template-columns: 1fr;
  }

  .date-filter summary {
    align-items: flex-start;
    flex-direction: column;
  }
}
