/* ==========================================================================
   Wepsol Weekly Report Canvas - Metrics & 3-Period Inspector
   KPI Cards, Delta Badges, 3-Period Deep Dive Drawer & Progression Visualizer
   ========================================================================== */

/* Metrics Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 14px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(16, 18, 27, .03);
  transition: all .15s ease;
  cursor: pointer;
  position: relative;
  user-select: none;
}

.metric-card:hover {
  border-color: rgba(228,0,79, .35);
  box-shadow: 0 4px 14px rgba(228,0,79, .08);
  transform: translateY(-2px);
}

.metric-card.active-inspect {
  border-color: var(--brand);
  background: rgba(228,0,79, .02);
  box-shadow: 0 0 0 2px rgba(228,0,79, .22), 0 4px 16px rgba(228,0,79, .1);
}

.metric-card.hidden {
  display: none;
}

.card-inspect-hint {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 10px;
  font-weight: 600;
  color: var(--brand);
  opacity: 0;
  transform: translateX(2px);
  transition: all .15s ease;
}

.metric-card:hover .card-inspect-hint,
.metric-card.active-inspect .card-inspect-hint {
  opacity: 1;
  transform: translateX(0);
}

.metric-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}

.metric-value {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 30px;
  line-height: 1;
  font-weight: 400;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}

.metric-comparison {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.delta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  font-variant-numeric: tabular-nums;
}

.delta-badge.good {
  background: rgba(15, 157, 110, .12);
  color: var(--good);
}

.delta-badge.bad {
  background: rgba(220, 61, 61, .12);
  color: var(--bad);
}

.delta-badge.neutral {
  background: rgba(20, 22, 31, .06);
  color: var(--muted);
}

.prev-text {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   3-Period Trajectory Graph Drawer (Clean & Minimalist - Graph Only)
   ========================================================================== */

.history-inspector-card {
  background: var(--surface);
  border: 1px solid rgba(228,0,79, .22);
  border-radius: 14px;
  padding: 16px 20px;
  display: none;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 8px 24px -4px rgba(228,0,79, .08);
  margin-top: 2px;
  animation: inspectSlideDown .2s cubic-bezier(0.16, 1, 0.3, 1);
}

.history-inspector-card.open {
  display: flex;
}

@keyframes inspectSlideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.inspector-title-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inspector-tag {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--brand);
  background: rgba(228,0,79, .08);
  padding: 3px 8px;
  border-radius: 6px;
}

.inspector-titles h4 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}

.inspector-sub {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--muted);
}

/* Concise stat pills in header */
.inspector-header-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.header-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 11.5px;
  color: var(--ink2);
}

.header-stat-pill.p1-stat {
  border-color: rgba(228,0,79, .25);
  background: rgba(228,0,79, .04);
}

.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.pill-dot.p1-dot { background: var(--brand); }
.pill-dot.p2-dot { background: #ff5c8d; }
.pill-dot.p3-dot { background: #94a3b8; }

.pill-name {
  font-weight: 600;
  font-size: 10.5px;
  text-transform: uppercase;
  color: var(--muted);
}

.pill-val {
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.pill-delta {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 9999px;
  font-variant-numeric: tabular-nums;
}

.pill-delta.good {
  background: rgba(15, 157, 110, .12);
  color: var(--good);
}

.pill-delta.bad {
  background: rgba(220, 61, 61, .12);
  color: var(--bad);
}

.pill-note {
  font-size: 10.5px;
  color: var(--muted);
}

.inspector-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-subtle {
  background: rgba(228,0,79, .08);
  border: 1px solid rgba(228,0,79, .2);
  color: var(--brand);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all .15s ease;
  font-family: inherit;
}

.btn-subtle:hover {
  background: var(--brand);
  color: #ffffff;
}

.btn-close-inspector {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all .12s ease;
}

.btn-close-inspector:hover {
  background: rgba(20, 22, 31, .06);
  color: var(--ink);
}

/* Dedicated Chart Body */
.inspector-chart-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inspector-graph-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 4px;
}

.legend-series-group {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--ink2);
}

.legend-line {
  display: inline-block;
  width: 20px;
  border-radius: 2px;
}

.legend-line.p1-line {
  height: 3px;
  background: var(--brand);
}

.legend-line.p2-line {
  height: 0;
  border-top: 2.5px dashed #ff5c8d;
}

.legend-line.p3-line {
  height: 0;
  border-top: 2.5px dotted #94a3b8;
}

.net-pill-badge {
  background: rgba(15, 157, 110, .12);
  color: var(--good);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 9999px;
  font-variant-numeric: tabular-nums;
}

.net-pill-badge.bad {
  background: rgba(220, 61, 61, .12);
  color: var(--bad);
}

/* Responsive SVG Chart Container */
.inspector-svg-wrap {
  position: relative;
  width: 100%;
  height: 250px;
}

.inspector-svg-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
