/* ==========================================================================
   System2 Configurator - Power & Network Planner panel (Phase 5.1)
   Scoped under .pl-panel. Light, no dark elements. Responsive: the two cards
   stack on narrow screens.

   In-house design tokens (kept local with a .pl- prefix so this stylesheet
   stands alone and never collides with the shared :root tokens). Values match
   the estate palette named in the spec.
   ========================================================================== */

.pl-panel {
  /* railway-poster palette (2026-06-12) - keep in step with configurator.css */
  --pl-accent: #0f4a39;
  --pl-accent-light: #dfe8e0;
  --pl-success: #2f8a5b;
  --pl-success-light: #e2efe7;
  --pl-success-border: #bcd9c8;
  --pl-warning: #c2611d;
  --pl-warning-light: #f6e7d3;
  --pl-warning-border: #e8c9a8;
  --pl-muted: #897654;
  --pl-border: #ddcca4;
  --pl-section-bg: #f1e7cf;
  --pl-bg: #fbf5e6;
  --pl-fg: #241a10;
  --pl-radius: 12px;
  --pl-radius-sm: 8px;
  --pl-shadow-sm: 0 1px 2px rgba(40, 24, 8, 0.08);
  --pl-shadow-md: 0 4px 14px rgba(40, 24, 8, 0.12);
  --pl-font: 'Hanken Grotesk', 'Segoe UI', system-ui, -apple-system, sans-serif;

  font-family: var(--pl-font);
  color: var(--pl-fg);
  font-size: 14px;
  line-height: 1.55;
}

.pl-panel * {
  box-sizing: border-box;
}

/* ---------- panel header ---------- */
.pl-panel-head {
  margin-bottom: 16px;
}
.pl-panel-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--pl-fg);
}
.pl-panel-sub {
  margin: 4px 0 0;
  color: var(--pl-muted);
  font-size: 13px;
}

/* ---------- two-card grid ---------- */
.pl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  align-items: start;
}

.pl-card {
  background: var(--pl-bg);
  border: 1px solid var(--pl-border);
  border-radius: var(--pl-radius);
  box-shadow: var(--pl-shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.18s ease;
}
.pl-card:hover {
  box-shadow: var(--pl-shadow-md);
}

.pl-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--pl-border);
  background: var(--pl-section-bg);
}
.pl-card-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.pl-card-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--pl-muted);
}
.pl-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--pl-radius-sm);
  background: var(--pl-accent-light);
  color: var(--pl-accent);
  flex: 0 0 auto;
}

.pl-body {
  padding: 16px;
}
.pl-muted {
  color: var(--pl-muted);
}

/* ---------- empty / none state ---------- */
.pl-none {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 0;
}
.pl-none-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--pl-radius-sm);
  background: var(--pl-section-bg);
  color: var(--pl-muted);
  flex: 0 0 auto;
}
.pl-none-title {
  font-weight: 700;
  font-size: 14px;
}
.pl-none-text {
  margin: 3px 0 0;
  color: var(--pl-muted);
  font-size: 13px;
}

/* ---------- BOM line list (PSUs / network parts) ---------- */
.pl-line-list {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pl-line {
  border: 1px solid var(--pl-border);
  border-radius: var(--pl-radius-sm);
  padding: 10px 12px;
  background: var(--pl-bg);
}
.pl-line-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.pl-line-qty {
  font-weight: 800;
  font-size: 13px;
  color: var(--pl-accent);
  white-space: nowrap;
}
.pl-line-name {
  font-weight: 600;
  font-size: 13.5px;
  flex: 1 1 auto;
}
.pl-line-total {
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pl-line-reason {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--pl-muted);
}

/* voltage pill */
.pl-volts {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 800;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--pl-section-bg);
  color: var(--pl-muted);
  white-space: nowrap;
}
.pl-volts-12v {
  background: var(--pl-accent-light);
  color: var(--pl-accent);
}
.pl-volts-24v {
  background: var(--pl-warning-light);
  color: var(--pl-warning);
}

.pl-doc-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--pl-accent);
  text-decoration: none;
}
.pl-doc-link:hover {
  text-decoration: underline;
}

/* ---------- power estimate breakdown ---------- */
.pl-breakdown {
  margin-top: 14px;
  border: 1px solid var(--pl-border);
  border-radius: var(--pl-radius-sm);
  background: var(--pl-section-bg);
  padding: 12px 14px;
}
.pl-breakdown-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
}
.pl-est-figure {
  font-size: 18px;
  font-weight: 800;
  color: var(--pl-accent);
  font-variant-numeric: tabular-nums;
}
.pl-calc {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.pl-calc td {
  padding: 3px 0;
  vertical-align: top;
  border-bottom: 1px dashed var(--pl-border);
}
.pl-calc tr:last-child td {
  border-bottom: none;
}
.pl-calc-label {
  font-weight: 600;
  white-space: nowrap;
  padding-right: 10px !important;
}
.pl-calc-expr {
  width: 100%;
}
.pl-calc-val {
  text-align: right;
  white-space: nowrap;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding-left: 10px !important;
}
.pl-est-note {
  margin: 9px 0 0;
  font-size: 11.5px;
  color: var(--pl-muted);
  line-height: 1.5;
}

/* ---------- power budget meter ---------- */
.pl-meter-wrap {
  margin-top: 14px;
}
.pl-meter-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 5px;
}
.pl-meter {
  height: 8px;
  border-radius: 999px;
  background: var(--pl-border);
  overflow: hidden;
}
.pl-meter-fill {
  height: 100%;
  background: var(--pl-success);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.pl-meter-fill.tight {
  background: var(--pl-warning);
}
.pl-meter-fill.over {
  background: #dc2626;
}

/* ---------- network board count ---------- */
.pl-board-count {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--pl-border);
  border-radius: var(--pl-radius-sm);
  background: var(--pl-section-bg);
  margin-bottom: 12px;
}
.pl-board-num {
  font-size: 24px;
  font-weight: 800;
  color: var(--pl-accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.pl-board-label {
  font-size: 12.5px;
  color: var(--pl-muted);
}

/* ---------- network rule chips ---------- */
.pl-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.pl-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  padding: 7px 11px;
  border: 1px solid var(--pl-border);
  border-radius: var(--pl-radius-sm);
  background: var(--pl-bg);
}
.pl-chip-strong {
  font-weight: 700;
  font-size: 12.5px;
}
.pl-chip-rest {
  font-size: 11.5px;
  color: var(--pl-muted);
}

/* ---------- notes ---------- */
.pl-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 0 0;
  font-size: 12.5px;
  padding: 9px 11px;
  border-radius: var(--pl-radius-sm);
}
.pl-note-icon {
  flex: 0 0 auto;
  display: inline-flex;
  line-height: 0;
  margin-top: 1px;
}
.pl-note-info {
  background: var(--pl-accent-light);
  color: #1e40af;
}
.pl-note-muted {
  background: var(--pl-section-bg);
  color: var(--pl-muted);
}

/* ---------- warnings ---------- */
.pl-warn-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pl-warn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 11px;
  border-radius: var(--pl-radius-sm);
  background: var(--pl-warning-light);
  color: var(--pl-warning);
}
.pl-warn-icon {
  flex: 0 0 auto;
  display: inline-flex;
  line-height: 0;
  margin-top: 1px;
}
.pl-warn-advisory {
  background: var(--pl-warning-light);
  color: var(--pl-warning);
}

/* ---------- responsive: stack on narrow screens ---------- */
@media (max-width: 640px) {
  .pl-grid {
    grid-template-columns: 1fr;
  }
  .pl-calc-expr {
    font-size: 12px;
  }
}
