/* css/pension-optimizer.css — PENSION-OPT-05 hidden/dev Pension Optimizer UI.
   Palette: primary navy #1E3A5F, accent bronze #B87333.
   All text/background pairs chosen for WCAG 2.2 AA (≥4.5:1 body text;
   dark-on-tint cells). Tap targets ≥44px. Keyboard navigable (native
   buttons/inputs/details; visible focus outlines). */

:root {
  --po-navy: #1E3A5F;
  --po-bronze: #B87333;
  --po-navy-tint: #e8eef5;
  --po-bronze-tint: #f5ebe2;
  --po-ink: #1c2430;
  --po-bronze-ink: #5a3517;
  --po-gray: #f1f2f4;
  --po-line: #c8cdd4;
}

* { box-sizing: border-box; }
body.po-page {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--po-ink);
  background: #fff;
  line-height: 1.45;
}
.po-wrap { max-width: 900px; margin: 0 auto; padding: 16px; }

.po-header h1 { color: var(--po-navy); font-size: 1.5rem; margin: 8px 0 4px; }
.po-subtitle { color: #444a52; margin: 0 0 10px; font-size: 0.95rem; }
.po-footer-p { margin: 8px 0 0; }
.po-footer-p:first-child { margin-top: 0; }
.po-d5, .po-disclosure { background: var(--po-navy-tint); border-left: 4px solid var(--po-navy); padding: 10px 12px; font-size: 0.92rem; }

.po-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 12px 0; }
.po-steps li { padding: 10px 12px; min-height: 44px; display: flex; align-items: center; background: var(--po-gray); border-radius: 6px; font-size: 0.9rem; }
.po-steps li.active { background: var(--po-navy); color: #fff; }

fieldset { border: 1px solid var(--po-line); border-radius: 8px; margin: 20px 0; padding: 16px; }
legend { color: var(--po-navy); font-weight: 700; padding: 0 6px; }

/* 05D P1: two-column field rhythm on desktop; single column below 720px.
   (display:grid on fieldset applies to its anonymous content box; the
   rendered legend stays on the border — verified in the browser check.) */
@media (min-width: 720px) {
  fieldset { display: grid; grid-template-columns: 1fr 1fr; column-gap: 24px; row-gap: 2px; align-items: start; }
  fieldset > .po-full, fieldset > .po-check,
  fieldset > .po-note, fieldset > .po-disclosure, fieldset > .po-btn { grid-column: 1 / -1; }
}

.po-step-intro { color: #333940; margin: 4px 0 14px; font-size: 0.95rem; }
.po-hint { font-size: 0.82rem; color: #55606c; margin: 4px 0 0; }

.po-field { margin: 8px 0; }
.po-field label { display: block; font-size: 0.9rem; margin-bottom: 4px; }
.po-field input, .po-field select, .po-field textarea {
  width: 100%; min-height: 44px; padding: 10px; font-size: 1rem;
  border: 1px solid var(--po-line); border-radius: 6px; background: #fff; color: var(--po-ink);
}
.po-field textarea { min-height: 100px; font-family: ui-monospace, Menlo, monospace; }
.po-check { display: flex; align-items: center; gap: 10px; }
.po-check input[type="checkbox"] { width: 24px; height: 24px; min-height: 24px; margin: 10px; }
.po-check label { margin: 0; }

.po-btn {
  min-height: 44px; min-width: 44px; padding: 10px 18px; font-size: 1rem;
  border-radius: 8px; border: 2px solid var(--po-navy); cursor: pointer;
}
.po-btn.primary { background: var(--po-navy); color: #fff; }
.po-btn.secondary { background: #fff; color: var(--po-navy); }
.po-btn:focus-visible, .po-cell:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--po-bronze); outline-offset: 2px;
}
.po-nav { display: flex; gap: 10px; margin-top: 16px; }

.po-error { background: #fdecea; border-left: 4px solid #b3261e; color: #7a1a14; padding: 10px 12px; }
.po-note { color: #444a52; font-size: 0.9rem; }
.po-legend { font-size: 0.9rem; }

/* 05D P3: each option reads as one card — name + its pensions together. */
.po-option { border: 1px solid var(--po-line); border-left: 4px solid var(--po-bronze); border-radius: 8px; padding: 14px 16px; margin: 16px 0; background: #fcfbf9; }
.po-option fieldset { margin: 12px 0; background: #fff; }

/* ── 4×4 matrix ── */
.po-matrix { border-collapse: collapse; width: 100%; margin: 12px 0; }
.po-matrix th, .po-matrix td { border: 1px solid var(--po-line); padding: 4px; text-align: center; font-size: 0.85rem; }
.po-matrix thead th { background: var(--po-navy); color: #fff; }
.po-matrix tbody th { background: var(--po-navy-tint); color: var(--po-ink); }
.po-cell {
  width: 100%; min-width: 44px; min-height: 44px; border: 2px solid transparent;
  border-radius: 6px; font-size: 0.8rem; padding: 6px 4px; cursor: pointer; color: var(--po-ink);
}
.po-cell.A { background: var(--po-navy-tint); color: var(--po-navy); font-weight: 700; }
.po-cell.B { background: var(--po-bronze-tint); color: var(--po-bronze-ink); font-weight: 700; }
.po-cell.tie { background: var(--po-gray); }
.po-cell.blocked {
  background: repeating-linear-gradient(45deg, #f5f5f5, #f5f5f5 6px, #e4e4e4 6px, #e4e4e4 12px);
  color: #4a4f57;
}
.po-cell[aria-pressed="true"] { border-color: var(--po-bronze); box-shadow: 0 0 0 2px var(--po-bronze) inset; }

/* ── detail panel ── */
.po-detail h3 { color: var(--po-navy); margin-top: 20px; }
.po-lead { border: 1px solid var(--po-line); border-left: 4px solid var(--po-bronze); border-radius: 8px; padding: 12px; }
.po-assume { font-weight: 700; }
.po-dominance { display: inline-block; background: var(--po-navy); color: #fff; border-radius: 999px; padding: 8px 14px; font-size: 0.9rem; }
.po-blocked-msg { background: var(--po-gray); border-left: 4px solid #4a4f57; padding: 10px 12px; }

.po-chart-wrap { margin: 16px 0; }
.po-chart { width: 100%; height: auto; border: 1px solid var(--po-line); border-radius: 8px; background: #fff; }
.po-chart-label { font-size: 11px; fill: #444a52; }

.po-real { margin: 10px 0; }

.po-caveats { margin: 14px 0; }
.po-caveat { background: #fff8ef; border-left: 4px solid var(--po-bronze); padding: 8px 12px; font-size: 0.88rem; }

.po-table-wrap summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--po-navy); font-weight: 700; }
.po-table-scroll { overflow-x: auto; }
.po-table { border-collapse: collapse; font-size: 0.82rem; min-width: 640px; }
.po-table th, .po-table td { border: 1px solid var(--po-line); padding: 6px 8px; text-align: right; }
.po-table th { background: var(--po-navy); color: #fff; position: sticky; top: 0; }

.po-footer { margin: 24px 0 12px; padding: 12px; border-top: 3px solid var(--po-navy); font-size: 0.85rem; color: #333940; }

/* ── mobile (375px target) ── */
@media (max-width: 480px) {
  .po-wrap { padding: 10px; }
  .po-steps li { font-size: 0.78rem; padding: 8px; }
  .po-matrix th, .po-matrix td { padding: 2px; }
  .po-cell { font-size: 0.7rem; padding: 4px 2px; }
  .po-table { min-width: 560px; } /* horizontal scroll inside .po-table-scroll */
}
