/* PC_Score03 Phase 4 — Client Portfolio Allocation Simulator
   Minimal, professional styling. No external font dependencies. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: #1a1a1a;
  background: #f5f5f5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ------------------------------------------------------------------
   Compliance banners (Items 13 & 14) — always visible, non-dismissible
   ------------------------------------------------------------------ */
.banner-item13 {
  background: #7a5c00;
  color: #fff8e1;
  padding: 8px 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  flex-shrink: 0;
}

.banner-item14 {
  background: #fff3cd;
  color: #664d03;
  border-bottom: 1px solid #ffc107;
  padding: 7px 20px;
  font-size: 12px;
  text-align: center;
  flex-shrink: 0;
}

/* ------------------------------------------------------------------
   Page header
   ------------------------------------------------------------------ */
.page-header {
  background: #fff;
  border-bottom: 2px solid #e0e0e0;
  padding: 16px 24px;
  flex-shrink: 0;
}

.page-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: #1a1a1a;
}

.page-header .as-of {
  font-size: 12px;
  color: #666;
  margin-top: 2px;
}

/* ------------------------------------------------------------------
   Caveat / limited-history notice
   ------------------------------------------------------------------ */
.caveat-notice {
  background: #e8f4f8;
  border-left: 4px solid #1976d2;
  margin: 12px 24px;
  padding: 10px 14px;
  font-size: 12px;
  color: #1a1a2e;
  border-radius: 2px;
  display: none;
}
.caveat-notice.visible { display: block; }

/* ------------------------------------------------------------------
   Main two-column layout
   ------------------------------------------------------------------ */
.main-layout {
  display: flex;
  gap: 16px;
  padding: 16px 24px;
  flex: 1;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------
   Input panel (left)
   ------------------------------------------------------------------ */
.inputs-panel {
  width: 340px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 14px 16px;
}

.panel h2 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #333;
  margin-bottom: 10px;
  border-bottom: 1px solid #eee;
  padding-bottom: 6px;
}

/* $/% toggle */
.toggle-group {
  display: flex;
  gap: 16px;
  margin-bottom: 10px;
  font-size: 13px;
}
.toggle-group label { cursor: pointer; display: flex; align-items: center; gap: 4px; }

/* Portfolio rows table */
#portfolio-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.asset-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.asset-row select {
  flex: 1;
  padding: 5px 6px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 12px;
  background: #fafafa;
}

.asset-row input[type="number"] {
  width: 100px;
  padding: 5px 6px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 12px;
  text-align: right;
}

.asset-row .remove-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 3px;
  color: #888;
  cursor: pointer;
  padding: 3px 7px;
  font-size: 13px;
  line-height: 1;
}
.asset-row .remove-btn:hover { background: #fee; border-color: #c00; color: #c00; }

#add-asset-btn {
  background: none;
  border: 1px dashed #aaa;
  border-radius: 3px;
  color: #555;
  cursor: pointer;
  padding: 5px 10px;
  font-size: 12px;
  width: 100%;
  margin-top: 4px;
}
#add-asset-btn:hover { background: #f5f5f5; }

/* Fund allocation, fund exposure scale, mode, date picker */
.field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.field-row label {
  font-size: 12px;
  color: #444;
  min-width: 120px;
  flex-shrink: 0;
}
.field-row input[type="number"],
.field-row select {
  flex: 1;
  padding: 5px 6px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 12px;
}

.mode-options {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 8px;
}
.mode-options label {
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.mode-options input[type="radio"] { margin-top: 2px; flex-shrink: 0; }

/* Compute button */
#compute-btn {
  background: #1a1a1a;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  letter-spacing: 0.03em;
}
#compute-btn:hover { background: #333; }
#compute-btn:disabled { background: #999; cursor: not-allowed; }

/* ------------------------------------------------------------------
   Results panel (right)
   ------------------------------------------------------------------ */
.results-panel {
  flex: 1;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-panel {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 14px 16px;
}

.chart-panel h2 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #333;
  margin-bottom: 10px;
}

.chart-legend {
  display: flex;
  gap: 20px;
  font-size: 11px;
  color: #555;
  margin-bottom: 8px;
}
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-swatch {
  width: 24px;
  height: 3px;
  border-radius: 1px;
  flex-shrink: 0;
}
.legend-swatch.blue  { background: #000; }
.legend-swatch.red   { background: #d62728; }

.chart-container {
  position: relative;
  height: 300px;
}

#error-msg {
  background: #fdecea;
  border: 1px solid #f44336;
  border-radius: 3px;
  color: #b71c1c;
  padding: 10px 14px;
  font-size: 12px;
  display: none;
}
#error-msg.visible { display: block; }

/* ------------------------------------------------------------------
   Narrative panel
   ------------------------------------------------------------------ */
.narrative-panel {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 14px 16px;
}

.narrative-panel h2 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #333;
  margin-bottom: 10px;
  border-bottom: 1px solid #eee;
  padding-bottom: 6px;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
  margin-bottom: 12px;
}

.stat-item { display: flex; flex-direction: column; }
.stat-label { font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-size: 18px; font-weight: 700; color: #1a1a1a; margin-top: 1px; }
.stat-sub   { font-size: 11px; color: #555; margin-top: 1px; }
.stat-value.positive { color: #2e7d32; }
.stat-value.negative { color: #c62828; }

.narrative-body {
  font-size: 13px;
  line-height: 1.6;
  color: #333;
}
.narrative-body p { margin-bottom: 8px; }
.narrative-body p:last-child { margin-bottom: 0; }
.narrative-body strong { font-weight: 600; }

.infeasible-notice {
  background: #fff8e1;
  border: 1px solid #ffc107;
  border-radius: 3px;
  padding: 8px 12px;
  font-size: 12px;
  color: #664d03;
  margin-top: 8px;
}

/* Mode B weight table */
.weight-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 8px;
}
.weight-table th {
  font-weight: 600;
  color: #555;
  text-align: left;
  padding: 4px 6px;
  border-bottom: 1px solid #ddd;
}
.weight-table td {
  padding: 4px 6px;
  border-bottom: 1px solid #f0f0f0;
}
.weight-table .delta-pos { color: #2e7d32; }
.weight-table .delta-neg { color: #c62828; }

/* Placeholder when no compute yet */
.placeholder-msg {
  color: #999;
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}

/* ------------------------------------------------------------------
   Loading overlay
   ------------------------------------------------------------------ */
#loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.85);
  z-index: 100;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #555;
}
#loading-overlay.visible { display: flex; }

/* ------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------ */
@media (max-width: 720px) {
  .main-layout { flex-direction: column; padding: 12px 12px; }
  .inputs-panel { width: 100%; }
}
