* {
  box-sizing: border-box;
}

:root {
  --pc-blue: #0d6efd;
  --pc-blue-soft: rgba(13, 110, 253, 0.10);
  --pc-yellow: #ffc107;
  --pc-yellow-soft: rgba(255, 193, 7, 0.12);
  --pc-text: #15315b;
  --pc-muted: #66758a;
  --pc-border: #d9e2ef;
  --pc-card: #ffffff;
  --pc-bg: #f5f7fb;
  --pc-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

body {
  background: var(--pc-bg);
}

body.modal-open {
  overflow: hidden;
}

.page-header {
  margin-bottom: 16px;
}

.page-title {
  margin: 0;
  color: var(--pc-text);
}

.page-subtitle {
  margin-top: 6px;
  color: var(--pc-muted);
}

.section-spacing {
  margin-top: 16px;
}

.alert-box {
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--pc-shadow);
}

.alert-error {
  background: #fff4f4;
  color: #b42318;
  border: 1px solid #f0c8c8;
}

.alert-success {
  background: #edf8f0;
  color: #156f3c;
  border: 1px solid #c5e6cf;
}

.content-card {
  background: var(--pc-card);
  border: 1px solid var(--pc-border);
  border-radius: 14px;
  box-shadow: var(--pc-shadow);
}

.content-card-body {
  padding: 18px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 14px;
  align-items: end;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--pc-text);
}

.form-group input,
.form-group select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--pc-border);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 13px;
  background: #fff;
  font-family: inherit;
  color: #0f172a;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--pc-blue);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.10);
}

.action-group {
  display: flex;
  align-items: end;
}

.btn {
  height: 42px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.btn-primary {
  width: 100%;
  background: var(--pc-blue);
  color: #fff;
  border-color: var(--pc-blue);
}

.btn-primary:hover {
  background: #0b5ed7;
}

.btn-outline {
  background: #fff;
  color: var(--pc-text);
  border-color: var(--pc-border);
}

.btn-outline:hover {
  background: #f8fbff;
}

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

.summary-grid {
  display: grid;
  gap: 14px;
}

.summary-grid-5 {
  grid-template-columns: repeat(4, 1fr);
}

.summary-card {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--pc-border);
  background: #fff;
}

.summary-card-accent {
  background: linear-gradient(180deg, #fff 0%, #fffcf1 100%);
  border-color: rgba(255, 193, 7, 0.35);
}

.summary-label {
  font-size: 12px;
  color: var(--pc-muted);
  margin-bottom: 10px;
  font-weight: 700;
}

.summary-value {
  font-size: 24px;
  line-height: 1.25;
  font-weight: 800;
  color: var(--pc-text);
}

.summary-value-text {
  font-size: 18px;
}

.chart-grid {
  display: grid;
  gap: 16px;
}

.chart-grid-2 {
  grid-template-columns: 1fr 1fr;
}

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.chart-head-between {
  align-items: center;
}

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

.section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--pc-text);
}

.chart-subtitle {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--pc-muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(13, 110, 253, 0.08);
  color: var(--pc-text);
  font-weight: 700;
  font-size: 12px;
  border: 1px solid rgba(13, 110, 253, 0.12);
}

.chart-container {
  position: relative;
  width: 100%;
  height: 320px;
  margin-top: 8px;
}

.chart-container-lg {
  height: 360px;
}

.chart-container-modal {
  height: 520px;
}

.chart-container canvas {
  max-width: 100%;
}

.loading-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.34);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  gap: 14px;
  color: #fff;
  font-weight: 700;
}

.loading-mask.d-none {
  display: none;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.chart-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
}

.chart-modal[hidden] {
  display: none;
}

.chart-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.46);
}

.chart-modal-dialog {
  position: relative;
  width: min(1100px, calc(100% - 32px));
  margin: 32px auto;
  background: #fff;
  border: 1px solid var(--pc-border);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.chart-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--pc-border);
}

.chart-modal-header h3 {
  margin: 0;
  color: var(--pc-text);
  font-size: 18px;
}

.chart-modal-header p {
  margin: 4px 0 0;
  color: var(--pc-muted);
  font-size: 12px;
}

.chart-modal-body {
  padding: 18px;
}

@media (max-width: 1199px) {
  .summary-grid-5 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 991px) {
  .filter-grid,
  .chart-grid-2,
  .summary-grid-5 {
    grid-template-columns: 1fr;
  }

  .chart-container,
  .chart-container-lg {
    height: 300px;
  }

  .chart-container-modal {
    height: 420px;
  }
}

@media (max-width: 767px) {
  .content-card-body,
  .chart-modal-body,
  .chart-modal-header {
    padding: 14px;
  }

  .summary-value {
    font-size: 22px;
  }

  .summary-value-text {
    font-size: 16px;
  }

  .chart-head,
  .chart-head-between,
  .chart-modal-header {
    flex-direction: column;
    align-items: stretch;
  }

  .chart-head-actions {
    justify-content: space-between;
  }

  .chart-modal-dialog {
    width: calc(100% - 16px);
    margin: 8px auto;
  }
}


.btn-icon {
  width: 42px;
  min-width: 42px;
  padding: 0;
}

.icon-expand,
.icon-close {
  display: inline-block;
  position: relative;
  width: 16px;
  height: 16px;
}

.icon-expand::before,
.icon-expand::after,
.icon-close::before,
.icon-close::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.icon-expand::before {
  width: 10px;
  height: 10px;
  right: 1px;
  top: 1px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  background: transparent;
}

.icon-expand::after {
  width: 10px;
  height: 10px;
  left: 1px;
  bottom: 1px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  background: transparent;
}

.icon-close::before,
.icon-close::after {
  width: 16px;
  height: 2px;
  left: 0;
  top: 7px;
  border-radius: 999px;
}

.icon-close::before {
  transform: rotate(45deg);
}

.icon-close::after {
  transform: rotate(-45deg);
}

.chart-expand-btn {
  flex-shrink: 0;
}
