/* ==========================================================================
   CSS: CHARTS / DASHBOARD / PLACEMENT PANELS
   ========================================================================== */

.charts-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100%;
  height: 100%;
}

.charts-sections-scroll {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: auto;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.02);
}

.charts-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.charts-subtabs-wrap {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

.charts-subtabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(132, 170, 251, 0.22);
  background: rgba(53, 53, 60, 0.55);
  background-image: var(--grain-bg);
  background-size: 20px 20px;
  background-blend-mode: overlay;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.charts-subtab-btn {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--app-font-family);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.charts-subtab-btn:hover,
.charts-subtab-btn:focus-visible {
  color: var(--text);
  border-color: rgba(132, 170, 251, 0.32);
  background: rgba(132, 170, 251, 0.08);
  outline: none;
}

.charts-subtab-btn.is-active {
  color: var(--text);
  border-color: rgba(132, 170, 251, 0.56);
  background: rgba(132, 170, 251, 0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

.charts-period-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.charts-period-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid rgba(132, 170, 251, 0.22);
  background: rgba(53, 53, 60, 0.55);
  background-image: var(--grain-bg);
  background-size: 20px 20px;
  background-blend-mode: overlay;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}

.charts-period-toggle .stats-mode-btn {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--app-font-family);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.charts-period-toggle .stats-mode-btn:hover,
.charts-period-toggle .stats-mode-btn:focus-visible {
  color: var(--text);
  border-color: rgba(132, 170, 251, 0.32);
  background: rgba(132, 170, 251, 0.08);
  outline: none;
}

.charts-period-toggle .stats-mode-btn.is-active {
  color: var(--text);
  border-color: rgba(132, 170, 251, 0.56);
  background: rgba(132, 170, 251, 0.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}


.charts-subpane {
  display: none;
}

.charts-subpane.is-active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}


.charts-rules-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(132, 170, 251, 0.18);
  background: rgba(53, 53, 60, 0.42);
  background-image: var(--grain-bg);
  background-size: 20px 20px;
  background-blend-mode: overlay;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
}


.charts-rules-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.charts-rules-title {
  font-size: 13px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text);
}

.charts-rules-title-wrap {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.charts-rules-subtitle {
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
}


.charts-rules-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.charts-rule-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid rgba(132, 170, 251, 0.14);
  background: rgba(255, 255, 255, 0.035);
}


.charts-rule-label {
  font-size: 11px;
  line-height: 1.25;
  color: var(--muted);
}

.charts-rule-value {
  font-size: 13px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text);
}

.charts-rule-note {
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
}


.dashboard-shell {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dashboard-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(53, 53, 60, 0.50);
  background-image: var(--grain-bg);
  background-size: 20px 20px;
  background-blend-mode: overlay;
}

.dashboard-head-title {
  font-size: 16px;
  line-height: 1.3;
  color: var(--text);
  font-weight: 700;
}

.dashboard-head-subtitle {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.dashboard-updated-at {
  flex: 0 0 auto;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
  white-space: nowrap;
}

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

.dashboard-total-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-height: 88px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(53, 53, 60, 0.50);
  background-image: var(--grain-bg);
  background-size: 20px 20px;
  background-blend-mode: overlay;
}

.dashboard-total-value {
  font-size: 26px;
  line-height: 1.05;
  font-weight: 700;
  color: var(--text);
}

.dashboard-total-label {
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}

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

.dashboard-chart-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(53, 53, 60, 0.50);
  background-image: var(--grain-bg);
  background-size: 20px 20px;
  background-blend-mode: overlay;
}

.dashboard-chart-card.is-wide {
  grid-column: 1 / -1;
}

.dashboard-chart-title {
  font-size: 15px;
  line-height: 1.35;
  color: var(--text);
}

.dashboard-chart-subtitle {
  margin-top: 4px;
  margin-bottom: 10px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}

.dashboard-chart-box {
  width: 100%;
  height: 320px;
}

.dashboard-chart-card.is-wide .dashboard-chart-box {
  height: 340px;
}

.dashboard-empty-note {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 320px;
  border-radius: 10px;
  border: 1px dashed rgba(255,255,255,0.09);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  padding: 12px;
}

@media (max-width: 1100px) {
  .dashboard-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

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

  .dashboard-chart-card.is-wide {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .dashboard-head {
    align-items: flex-start;
  }

  .dashboard-updated-at {
    white-space: normal;
  }

  .dashboard-kpi-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-total-card {
    min-height: 78px;
  }

  .dashboard-chart-box,
  .dashboard-chart-card.is-wide .dashboard-chart-box,
  .dashboard-empty-note {
    height: 280px;
  }
}

    
