/* =======================================================================
   components.css — Buttons, Cards, Badges, Panels, Modals, Toasts
   Advanced Solar Load Calculator — Production CSS Architecture
   ======================================================================= */

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-lg);
  font-size: var(--fs-xs);
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1;
}

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

.btn-primary {
  background: linear-gradient(to left, var(--accent), var(--solar));
  color: #fff;
  box-shadow: 0 4px 14px rgba(255,106,0,0.3);
}
.btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(255,106,0,0.5);
}

.btn-secondary {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid var(--border-2);
  color: var(--text-2);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(30, 41, 59, 0.8);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-3);
  border: none;
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(30, 41, 59, 0.4);
  color: var(--text-2);
}

/* Icon button */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border-radius: var(--radius-md);
  border: none;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: var(--fs-sm);
}
.btn-icon:hover {
  background: rgba(30, 41, 59, 0.6);
  color: var(--text-2);
}
.btn-icon.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

/* Tab buttons (pill group) */
.tab-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
  padding: var(--sp-1);
  border-radius: var(--radius-lg);
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(42, 54, 86, 0.5);
}
.tab-btn {
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-md);
  font-size: var(--fs-xs);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-3);
  transition: all var(--transition-fast);
}
.tab-btn:hover {
  color: var(--text-2);
}
.tab-btn.active {
  background: linear-gradient(to left, var(--accent), var(--solar));
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* ── Cards ─────────────────────────────────────────────────────────── */
.card {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg-2);
  overflow: hidden;
}

.card-compact {
  padding: var(--sp-3);
}

.card-body {
  padding: var(--sp-5);
}

.card-header {
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* KPI card */
.kpi-card {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg-2);
  padding: var(--sp-4);
  transition: border-color var(--transition-fast);
}
.kpi-card:hover {
  border-color: var(--border-2);
}

.kpi-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  font-weight: 600;
}

.kpi-value {
  font-size: var(--fs-xl);
  font-weight: 700;
  margin-top: var(--sp-2);
}

.kpi-sub {
  font-size: var(--fs-xs);
  color: var(--text-3);
  margin-top: 2px;
}

/* KPI grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--sp-3);
}

/* Metric card (hero banner) */
.metric-card {
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border);
  padding: var(--sp-3);
}

.metric-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  font-weight: 500;
}

.metric-value {
  font-size: var(--fs-lg);
  font-weight: 700;
  margin-top: var(--sp-1);
}

/* Stage card */
.stage-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: linear-gradient(to bottom left, var(--panel), var(--bg-2));
  padding: var(--sp-4);
}

.stage-num {
  position: absolute;
  left: 0.5rem;
  top: 0.5rem;
  font-size: 3rem;
  font-weight: 900;
  color: rgba(30, 41, 59, 0.4);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1;
}

/* Stat / Summary card */
.stat-card {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg-2);
  padding: var(--sp-4);
}

.stat-label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  font-weight: 600;
}

.stat-value {
  font-size: var(--fs-2xl);
  font-weight: 700;
  margin-top: var(--sp-2);
}

.stat-sub {
  font-size: var(--fs-xs);
  color: var(--text-3);
  margin-top: 2px;
}

/* Status card */
.status-card {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg-2);
  padding: var(--sp-4);
}

/* ── Badges ────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
}

/* Category badges */
.cat-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 500;
  border: 1px solid transparent;
}
.cat-lighting   { background: rgba(234,179,8,0.2);   color: #fde047; border-color: rgba(234,179,8,0.3); }
.cat-hvac       { background: rgba(6,182,212,0.2);   color: #67e8f9; border-color: rgba(6,182,212,0.3); }
.cat-kitchen    { background: rgba(236,72,153,0.2);   color: #f9a8d4; border-color: rgba(236,72,153,0.3); }
.cat-pump       { background: rgba(59,130,246,0.2);   color: #93c5fd; border-color: rgba(59,130,246,0.3); }
.cat-medical    { background: rgba(239,68,68,0.2);    color: #fca5a5; border-color: rgba(239,68,68,0.3); }
.cat-it         { background: rgba(139,92,246,0.2);   color: #c4b5fd; border-color: rgba(139,92,246,0.3); }
.cat-industrial { background: rgba(249,115,22,0.2);   color: #fdba74; border-color: rgba(249,115,22,0.3); }
.cat-ev         { background: rgba(16,185,129,0.2);   color: #6ee7b7; border-color: rgba(16,185,129,0.3); }
.cat-security   { background: rgba(244,63,94,0.2);    color: #fda4af; border-color: rgba(244,63,94,0.3); }
.cat-water      { background: rgba(14,165,233,0.2);   color: #7dd3fc; border-color: rgba(14,165,233,0.3); }
.cat-office     { background: rgba(99,102,241,0.2);   color: #a5b4fc; border-color: rgba(99,102,241,0.3); }
.cat-laundry    { background: rgba(217,70,239,0.2);   color: #f0abfc; border-color: rgba(217,70,239,0.3); }
.cat-other      { background: rgba(100,116,139,0.2);  color: #94a3b8; border-color: rgba(100,116,139,0.3); }

/* Criticality badges */
.crit-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  font-weight: 600;
  border: 1px solid transparent;
}
.crit-critical   { background: rgba(239,68,68,0.2);  color: #fca5a5; border-color: rgba(239,68,68,0.3); }
.crit-essential  { background: rgba(245,158,11,0.2); color: #fcd34d; border-color: rgba(245,158,11,0.3); }
.crit-normal     { background: rgba(59,130,246,0.2);  color: #93c5fd; border-color: rgba(59,130,246,0.3); }
.crit-optional   { background: rgba(100,116,139,0.2); color: #94a3b8; border-color: rgba(100,116,139,0.3); }

/* Severity badges */
.sev-error      { background: rgba(239,68,68,0.1);  color: #fca5a5; border-color: rgba(239,68,68,0.3); }
.sev-warning    { background: rgba(245,158,11,0.1); color: #fcd34d; border-color: rgba(245,158,11,0.3); }
.sev-advisory   { background: rgba(59,130,246,0.1);  color: #93c5fd; border-color: rgba(59,130,246,0.3); }
.sev-info       { background: rgba(16,185,129,0.1);  color: #6ee7b7; border-color: rgba(16,185,129,0.3); }
.sev-assumption { background: rgba(139,92,246,0.1);  color: #c4b5fd; border-color: rgba(139,92,246,0.3); }

/* ── Hero Banner ───────────────────────────────────────────────────── */
.hero-banner {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-2xl);
  border: 1px solid var(--border);
  background: linear-gradient(to bottom left, var(--panel), var(--bg-2), var(--bg));
  padding: var(--sp-6);
  box-shadow: 0 0 40px rgba(245,158,11,0.15),
              0 0 80px rgba(255,106,0,0.08);
}

.hero-banner::before {
  content: '';
  position: absolute;
  left: -5rem;
  top: -5rem;
  width: 20rem;
  height: 20rem;
  border-radius: 50%;
  background: rgba(249,115,22,0.1);
  filter: blur(48px);
  pointer-events: none;
}

.hero-banner::after {
  content: '';
  position: absolute;
  right: -5rem;
  bottom: -5rem;
  width: 20rem;
  height: 20rem;
  border-radius: 50%;
  background: rgba(245,158,11,0.1);
  filter: blur(48px);
  pointer-events: none;
}

.hero-info {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  color: var(--accent-2);
  font-size: var(--fs-xs);
  font-weight: 500;
}

.hero-title {
  font-size: var(--fs-3xl);
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.hero-desc {
  color: var(--text-3);
  font-size: var(--fs-sm);
  max-width: 40rem;
  line-height: var(--lh-relaxed);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
  position: relative;
}

/* ── Panels ────────────────────────────────────────────────────────── */
.panel {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg-2);
  padding: var(--sp-5);
}

.panel-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* Insight item */
.insight-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-2);
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(30, 41, 59, 0.5);
}
.insight-ok .insight-icon  { color: var(--emerald); }
.insight-warn .insight-icon { color: var(--solar); }
.insight-icon { font-size: var(--fs-sm); flex-shrink: 0; margin-top: 2px; }
.insight-text { font-size: var(--fs-xs); color: var(--text-2); line-height: var(--lh-normal); }
.insight-sub  { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }

.insights-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

/* Top load item */
.top-load-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: var(--fs-xs);
}
.top-load-info { flex: 1; min-width: 0; }
.top-load-name {
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-load-meta {
  color: var(--text-4);
  font-size: var(--fs-xs);
}
.top-load-values { text-align: left; flex-shrink: 0; }
.top-load-daily {
  color: var(--accent-2);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}
.top-load-connected {
  color: var(--text-4);
  font-size: var(--fs-xs);
  display: block;
}

.top-loads-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  max-height: 18rem;
  overflow-y: auto;
}

/* Bar row (progress bars) */
.bar-row-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  margin-bottom: 4px;
}
.bar-row-track {
  height: 6px;
  border-radius: var(--radius-full);
  background: rgba(30, 41, 59, 1);
  overflow: hidden;
}
.bar-row-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}
.bar-row-fill.gradient-amber  { background: linear-gradient(to left, var(--accent), var(--solar)); }
.bar-row-fill.gradient-blue   { background: linear-gradient(to left, var(--indigo), var(--blue)); }
.bar-row-fill.gradient-red    { background: linear-gradient(to left, var(--red), var(--pink)); }
.bar-row-fill.gradient-green  { background: linear-gradient(to left, var(--emerald), var(--teal)); }
.bar-row-fill.gradient-purple { background: linear-gradient(to left, var(--purple), #a78bfa); }

/* ── Modal ─────────────────────────────────────────────────────────── */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}
.modal-root.modal-open {
  display: flex;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-dialog {
  position: relative;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: var(--radius-2xl);
  background: var(--bg-2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  animation: scaleIn 0.2s ease;
}

.modal-small  { max-width: 400px; }
.modal-medium { max-width: 640px; }
.modal-large  { max-width: 960px; }
.modal-fullscreen { max-width: 1200px; }

.modal-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 36, 0.95);
  backdrop-filter: blur(8px);
}

.modal-title {
  font-size: var(--fs-lg);
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-lg);
  border: none;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: var(--fs-lg);
  transition: all var(--transition-fast);
}
.modal-close:hover {
  background: rgba(30,41,59,0.6);
  color: var(--text-2);
}

.modal-body {
  padding: var(--sp-6);
}

/* ── Toast ─────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--sp-4);
  left: var(--sp-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}

.toast {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-lg);
  font-size: var(--fs-sm);
  color: var(--text);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(8px);
  transition: all var(--transition-base);
  max-width: 24rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid transparent;
}
.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-success { background: rgba(16,185,129,0.15); border-color: rgba(16,185,129,0.3); color: #6ee7b7; }
.toast-error   { background: rgba(239,68,68,0.15);  border-color: rgba(239,68,68,0.3);  color: #fca5a5; }
.toast-warning { background: rgba(245,158,11,0.15); border-color: rgba(245,158,11,0.3); color: #fcd34d; }
.toast-info    { background: rgba(59,130,246,0.15);  border-color: rgba(59,130,246,0.3);  color: #93c5fd; }

/* ── Alert box ─────────────────────────────────────────────────────── */
.alert {
  border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid transparent;
  font-size: var(--fs-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
}
.alert-error      { background: rgba(239,68,68,0.1);  border-color: rgba(239,68,68,0.3);  color: #fca5a5; }
.alert-warning    { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); color: #fcd34d; }
.alert-info       { background: rgba(59,130,246,0.1);  border-color: rgba(59,130,246,0.3);  color: #93c5fd; }
.alert-success    { background: rgba(16,185,129,0.1);  border-color: rgba(16,185,129,0.3);  color: #6ee7b7; }

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

/* ── Text color utilities ──────────────────────────────────────────── */
.text-orange-300  { color: #fdba74; }
.text-amber-300   { color: #fcd34d; }
.text-emerald-300 { color: #6ee7b7; }
.text-blue-300    { color: #93c5fd; }
.text-red-300     { color: #fca5a5; }
.text-pink-300    { color: #f9a8d4; }
.text-violet-300  { color: #c4b5fd; }
.text-cyan-300    { color: #67e8f9; }
.text-purple-300  { color: #d8b4fe; }
.text-indigo-300  { color: #a5b4fc; }
.text-yellow-300  { color: #fde047; }
.text-rose-300    { color: #fda4af; }
.text-sky-300     { color: #7dd3fc; }
.text-fuchsia-300 { color: #f0abfc; }
.text-teal-300    { color: #5eead4; }
.text-slate-300   { color: #cbd5e1; }
.text-slate-400   { color: #94a3b8; }
.text-slate-500   { color: #64748b; }
.text-white       { color: #ffffff; }

/* ── Responsive card grids ─────────────────────────────────────────── */
.grid-2  { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
.grid-3  { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3); }
.grid-4  { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); }
.grid-5  { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--sp-3); }
.grid-6  { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--sp-3); }

@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .grid-4, .grid-5, .grid-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-metrics { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-4, .grid-5, .grid-6 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .hero-metrics { grid-template-columns: 1fr; }
}

/* ── Insights panel ─────────────────────────────────────────────────── */
.insights-panel {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg-2);
  padding: var(--sp-5);
}

/* ── Top loads panel ───────────────────────────────────────────────── */
.top-loads-panel {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg-2);
  padding: var(--sp-5);
}

/* ── Inventory table wrapper ───────────────────────────────────────── */
.inventory-table-wrap {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--bg-2);
  overflow: hidden;
}

/* ── Load form (modal) ─────────────────────────────────────────────── */
.load-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* ── Value color classes ───────────────────────────────────────────── */
.value-w  { color: var(--accent-2); font-family: 'JetBrains Mono', monospace; }
.value-wh { color: var(--solar-2); font-family: 'JetBrains Mono', monospace; }

/* ── Toggle icon ───────────────────────────────────────────────────── */
.toggle-icon {
  font-size: var(--fs-lg);
  line-height: 1;
}

/* ── Section (for reports, forms) ──────────────────────────────────── */
.form-section {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: rgba(15, 20, 36, 0.6);
  padding: var(--sp-5);
  margin-bottom: var(--sp-5);
}

.form-section-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border);
}

.form-section-subtitle {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

/* ── Computed metrics row ──────────────────────────────────────────── */
.form-computed {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  padding: var(--sp-3);
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--border);
  font-size: var(--fs-xs);
  color: var(--text-2);
}

.form-computed span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── Form errors ───────────────────────────────────────────────────── */
.form-errors {
  margin-top: var(--sp-3);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(245,158,11,0.3);
  background: rgba(245,158,11,0.1);
  padding: var(--sp-3);
}

.form-error {
  font-size: var(--fs-xs);
  color: #fcd34d;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-1);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--border);
}

/* ── Library grid ──────────────────────────────────────────────────── */
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-2);
}

.library-item {
  text-align: right;
  padding: var(--sp-3);
  border-radius: var(--radius-lg);
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.library-item:hover {
  border-color: rgba(255,106,0,0.5);
  background: rgba(30,41,59,0.4);
}

.lib-name {
  font-weight: 500;
  font-size: var(--fs-sm);
  color: var(--text);
}
.library-item:hover .lib-name {
  color: var(--accent-2);
}

.lib-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}

/* ── Test runner ───────────────────────────────────────────────────── */
.test-summary {
  display: flex;
  gap: var(--sp-4);
  margin-bottom: var(--sp-4);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.test-passed { color: var(--emerald); }
.test-failed { color: var(--red); }
.test-total  { color: var(--text-3); }

.test-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.test-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  font-size: var(--fs-xs);
}
.test-item:hover {
  background: rgba(30,41,59,0.2);
}
.test-pass .test-status { color: var(--emerald); }
.test-fail .test-status { color: var(--red); }
.test-name { color: var(--text); flex: 1; }
.test-msg  { color: var(--text-3); }
.test-time { color: var(--text-4); font-family: 'JetBrains Mono', monospace; font-size: var(--fs-xs); }

/* ── Chart containers ──────────────────────────────────────────────── */
.chart-container {
  width: 100%;
  min-height: 200px;
  position: relative;
}
.chart-container canvas {
  max-width: 100%;
}

/* ── Report content area ───────────────────────────────────────────── */
.report-section-title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--sp-3);
  padding-right: var(--sp-3);
  border-right: 3px solid var(--accent);
}

/* ── Doc sidebar ───────────────────────────────────────────────────── */
.doc-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  font-size: var(--fs-xs);
  transition: all var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  color: var(--text-2);
  text-align: right;
}
.doc-nav-item:hover {
  background: rgba(30,41,59,0.4);
}
.doc-nav-item.active {
  background: rgba(255,106,0,0.15);
  color: var(--accent-2);
  border-color: rgba(255,106,0,0.3);
}
