/* Site overview dashboard — dense, scannable layout */

.dashboard-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 18px 24px;
  box-sizing: border-box;
}

[data-card-id][hidden] { display: none !important; }
.dashboard-panel-sub { display: block; margin-top: 2px; font-size: 0.68rem; color: var(--shell-muted); }
.opportunity-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.opportunity-card { padding: 14px; border: 1px solid var(--shell-border); border-left: 4px solid var(--accent); border-radius: var(--radius-md); background: var(--shell-elevated); }
.opportunity-card.is-critical { border-left-color: var(--danger); }
.opportunity-card.is-high { border-left-color: var(--warn); }
.opportunity-card.is-positive { border-left-color: var(--success); }
.opportunity-card-top, .opportunity-actions, .opportunity-evidence { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.opportunity-card-top { justify-content: space-between; }
.opportunity-kind { font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--shell-muted); }
.opportunity-impact { font-size: 0.7rem; font-weight: 700; color: var(--warn); }
.opportunity-card h3 { margin: 9px 0 5px; font-size: 0.95rem; color: var(--shell-text); }
.opportunity-card p { margin: 0 0 10px; font-size: 0.78rem; color: var(--shell-muted); }
.opportunity-evidence span { padding: 3px 7px; border-radius: var(--radius-full); background: var(--surface-inset); font-size: 0.68rem; color: var(--shell-muted); }
.opportunity-actions { margin-top: 12px; }

.dashboard-customizer { position: fixed; inset: 0; z-index: 1200; display: grid; justify-items: end; }
.dashboard-customizer[hidden] { display: none; }
.dashboard-customizer-backdrop { position: absolute; inset: 0; border: 0; background: color-mix(in srgb, var(--text) 35%, transparent); cursor: default; }
.dashboard-customizer-panel { position: relative; width: min(420px, 92vw); height: 100%; background: var(--shell-panel); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; }
.dashboard-customizer-body { padding: 18px; overflow: auto; flex: 1; }
.dashboard-customizer-body > p { margin-top: 0; color: var(--shell-muted); font-size: 0.82rem; }
.dashboard-card-option { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--shell-border); }
.dashboard-card-option label { display: flex; align-items: center; gap: 9px; font-size: 0.82rem; font-weight: 600; }
.dashboard-density { display: grid; gap: 6px; margin-top: 18px; font-size: 0.75rem; font-weight: 700; }
.dashboard-density select { padding: 8px; border: 1px solid var(--shell-border); border-radius: var(--radius-sm); background: var(--shell-elevated); }
.dashboard-customizer-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--shell-border); }
.dashboard-page.is-compact { gap: 7px; padding-top: 8px; }
.dashboard-page.is-compact .dashboard-panel-body { padding: 7px; }
.dashboard-page.is-compact .dashboard-kpi { min-height: 60px; padding: 7px 9px; }

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

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

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

.dashboard-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-sm);
  background: var(--shell-panel);
  min-height: 72px;
}

.dashboard-kpi.is-live { border-color: var(--success-border); background: var(--success-soft); }
.dashboard-kpi.is-danger { border-color: var(--danger-border); background: var(--danger-soft); }
.dashboard-kpi.is-warn { border-color: var(--warn-border); background: var(--warn-soft); }

.dashboard-kpi-label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--shell-muted);
}

.dashboard-kpi-value {
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--shell-text);
  line-height: 1.1;
}

.dashboard-kpi-hint {
  font-size: 0.68rem;
  color: var(--shell-muted);
  margin-top: auto;
}

.dashboard-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr);
  gap: 12px;
}

@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

.dashboard-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.dashboard-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-md);
  background: var(--shell-panel);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.dashboard-panel.is-grow {
  flex: 1;
}

.dashboard-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--shell-border);
  background: linear-gradient(180deg, #fff 0%, var(--shell-elevated) 100%);
  flex-shrink: 0;
}

.dashboard-panel-head h2 {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--shell-muted);
}

.dashboard-panel-head a {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}

.dashboard-panel-head a:hover { text-decoration: underline; }

.dashboard-panel-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 10px 12px 12px;
}

.dashboard-chart-wrap {
  position: relative;
  height: 200px;
  padding: 0;
}

.liquid-chart-wrap {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 55%, #f1f5f9 100%);
  border-radius: 16px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 8px 24px rgba(79, 70, 229, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  padding: 8px 10px 4px;
  overflow: hidden;
}

.liquid-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  min-height: 160px;
  display: block;
}

.liquid-chart-panel .dashboard-panel-head h2 {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--shell-muted);
}

.liquid-chart-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid var(--success-border);
  padding: 3px 9px;
  border-radius: var(--radius-full);
}

.dashboard-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  min-height: 180px;
  display: block;
}

.dashboard-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 12px 10px;
  font-size: 0.68rem;
  color: var(--shell-muted);
}

.dashboard-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dashboard-chart-legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

.dashboard-feed {
  display: grid;
  gap: 6px;
}

.dashboard-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-sm);
  background: var(--shell-elevated);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: border-color 0.12s, background 0.12s;
}

.dashboard-row:hover {
  border-color: var(--accent-muted);
  background: var(--accent-soft);
}

.dashboard-row-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dashboard-row-dot.is-live { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2); }
.dashboard-row-dot.is-warn { background: #f59e0b; }
.dashboard-row-dot.is-danger { background: #ef4444; }
.dashboard-row-dot.is-muted { background: var(--shell-muted); }

.dashboard-row-main {
  min-width: 0;
}

.dashboard-row-title {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--shell-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-row-sub {
  display: block;
  font-size: 0.68rem;
  color: var(--shell-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 2px;
}

.dashboard-row-meta {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--shell-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.dashboard-health {
  display: grid;
  gap: 10px;
}

.dashboard-meter {
  display: grid;
  gap: 4px;
}

.dashboard-meter-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--shell-text-secondary);
}

.dashboard-meter-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--shell-border);
  overflow: hidden;
}

.dashboard-meter-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.3s ease;
}

.dashboard-meter-bar.is-warn span { background: #f59e0b; }
.dashboard-meter-bar.is-danger span { background: #ef4444; }

.dashboard-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dashboard-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--shell-border);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--shell-text-secondary);
  background: var(--shell-elevated);
}

.dashboard-pill.is-on {
  border-color: var(--success-border);
  background: var(--success-soft);
  color: #166534;
}

.dashboard-pill.is-off {
  border-color: var(--shell-border);
  color: var(--shell-muted);
}

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

.dashboard-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid var(--shell-border);
  border-radius: var(--radius-sm);
  background: var(--shell-elevated);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--shell-text);
  text-decoration: none;
  transition: border-color 0.12s, background 0.12s;
}

.dashboard-action:hover {
  border-color: var(--accent-muted);
  background: var(--accent-soft);
  color: var(--accent);
}

.dashboard-empty {
  padding: 20px 12px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--shell-muted);
}

.dashboard-loading {
  padding: 24px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--shell-muted);
}

.dashboard-activity-item {
  display: grid;
  grid-template-columns: 52px 8px 1fr;
  gap: 8px;
  align-items: start;
  padding: 6px 4px;
  border-bottom: 1px solid var(--shell-border);
}

.dashboard-activity-item:last-child { border-bottom: none; }

.dashboard-activity-time {
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
  color: var(--shell-muted);
}

.dashboard-activity-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 4px;
  justify-self: center;
}

.dashboard-activity-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--shell-text);
}

.dashboard-activity-sub {
  font-size: 0.66rem;
  color: var(--shell-muted);
  margin-top: 1px;
}
