/* ── Detail Panel (Màn 2) ── */
#detail-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--panel-w);
  height: 100%;
  background: var(--bg-primary);
  box-shadow: var(--shadow-panel);
  transform: translateX(0);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 20;
  overflow-y: auto;
  overflow-x: hidden;
}

#detail-panel.panel-hidden {
  transform: translateX(100%);
}

/* Close button */
#panel-close {
  position: sticky;
  top: 0;
  z-index: 2;
  float: right;
  margin: 12px 12px 0 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
  box-shadow: var(--shadow-card);
}

#panel-close:hover {
  background: var(--bg-muted);
  color: var(--text-title);
}

/* Panel content */
#panel-content {
  padding: 16px 20px 24px;
  clear: both;
}

/* Panel header */
.panel-header {
  margin-bottom: 16px;
  padding-top: 4px;
}

.panel-name {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-title);
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin-bottom: 8px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  border: 1.5px solid;
  font-size: 13px;
  font-weight: 600;
}

.status-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

/* Metrics grid */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.metric-card {
  background: var(--bg-muted);
  border-radius: var(--radius-card);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-card.full-width {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.metric-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-title);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.metric-unit {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
}

.metric-time {
  font-size: 14px;
  color: var(--text-body);
  font-weight: 500;
}

/* Chart area */
.chart-section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

#history-chart {
  width: 100%;
  height: 220px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
}

#chart-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 220px;
  font-size: 13px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}

/* Action buttons row */
.panel-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}

.panel-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: 6px;
  transition: background 0.15s, opacity 0.15s;
}

.btn-twin {
  background: var(--accent);
  color: #fff;
}
.btn-twin:hover { background: #1d4ed8; }

.btn-pump {
  background: #059669;
  color: #fff;
}
.btn-pump:hover { background: #047857; }

.btn-stats {
  background: #7c3aed;
  color: #fff;
  margin-top: 0;
  grid-column: 1 / -1;
}
.btn-stats:hover { background: #6d28d9; }

/* Divider */
.panel-divider {
  height: 1px;
  background: var(--border);
  margin: 18px 0;
}
