/* =====================================================================
   PORTAL LAYOUT: shared by partner.html and employer.html.
   Desktop-first, stacks to one column on phones. Values come from tokens.css.
   ===================================================================== */

/* ---- Top bar ---- */
.pbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: var(--bg); box-shadow: var(--shadow-bar);
}
.pbar-inner {
  max-width: var(--portal-width); margin: 0 auto;
  padding: var(--space-4) var(--space-5);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
}
.pbar-brand { display: flex; align-items: center; gap: var(--space-3); }
.pbar-brand > .pbar-who { padding-left: var(--space-3); box-shadow: inset 1px 0 0 var(--line); font-family: var(--font-display); font-style: italic; font-size: 20px; color: var(--ink-muted); }
.pbar-who { font-size: var(--fs-sm); color: var(--ink-muted); }
.pbar-links { display: flex; align-items: center; gap: var(--space-4); }

/* ---- Page ---- */
.pmain {
  max-width: var(--portal-width); margin: 0 auto;
  padding: var(--space-6) var(--space-5) var(--space-8);
  display: flex; flex-direction: column; gap: var(--space-6);
}
.view { display: flex; flex-direction: column; gap: var(--space-5); }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.view-head > div { display: flex; flex-direction: column; gap: var(--space-2); max-width: 60ch; }
.view-head .page-title { font-size: 44px; }

/* ---- Stepper: the steps really are a sequence ---- */
.stepper { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); list-style: none; margin: 0; padding: 0; box-shadow: inset 0 -1px 0 var(--line); }
.step {
  display: flex; align-items: baseline; gap: var(--space-3);
  padding: var(--space-3) 0 var(--space-4);
  color: var(--ink-faint);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
}
.step-num { font-family: var(--font-display); font-size: 22px; font-weight: var(--fw-regular); line-height: 1; }
.step-num .icon { width: 16px; height: 16px; stroke-width: 2; color: var(--accent); transform: translateY(2px); }
.step.is-done { color: var(--ink-muted); }
.step.is-current { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
.step.is-current .step-num { color: var(--accent); }

/* ---- Grids ---- */
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--space-5); align-items: start; }
.form-card { padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-5); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.narrow { max-width: 520px; width: 100%; margin: 0 auto; }
.sticky { position: sticky; top: 96px; }
@media (max-width: 860px) {
  .split { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
@media (max-width: 520px) {
  .pbar-inner, .pmain { padding-inline: var(--space-4); }
  .pbar-brand > .pbar-who { display: none; }
  .step { flex-direction: column; gap: var(--space-1); font-size: var(--fs-xs); }
  .view-head .page-title { font-size: 34px; }
  .form-row { grid-template-columns: 1fr; }
  .form-card { padding: var(--space-5); }
}

/* ---- Note boxes ---- */
.note {
  display: grid; grid-template-columns: auto 1fr; gap: var(--space-3); align-items: start;
  padding: var(--space-4) 0 0;
  box-shadow: inset 0 1px 0 var(--line);
  font-size: var(--fs-sm); color: var(--ink-muted); line-height: 1.5;
}
.note strong { color: var(--ink); font-weight: var(--fw-medium); }
.note .icon { width: 18px; height: 18px; color: var(--ink-muted); margin-top: 1px; }
.note-good { padding: var(--space-4); border-radius: var(--radius-input); background: var(--accent-soft); box-shadow: none; }
.note-good .icon, .note-good strong { color: var(--accent); }

/* ---- In-app preview (phone-ish panel) ---- */
.preview {
  background: var(--fill); border-radius: var(--radius-card);
  padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3);
}

/* ---- Stat tiles ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.stat { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); }
.stats .stat { background: none; border-radius: 0; box-shadow: inset -1px 0 0 var(--line); padding: var(--space-5) var(--space-5) var(--space-5) 0; }
.stats .stat + .stat { padding-left: var(--space-5); }
.stats .stat:last-child { box-shadow: none; }
.stat-label { font-size: var(--fs-sm); color: var(--ink-muted); }
.stat-value { font-family: var(--font-display); font-size: 48px; font-weight: var(--fw-regular); letter-spacing: var(--tracking-tight); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-foot { font-size: var(--fs-xs); color: var(--ink-muted); }
.stat-foot.is-up { color: var(--accent); }

/* ---- Bar chart (vertical, single series) ---- */
.chart-card { padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-4); }
.vbars {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px;
  align-items: end; height: 180px;
  box-shadow: inset 0 -1px 0 var(--chart-grid);
}
.vbar { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; outline-offset: 0; }
.vbar-fill { width: min(28px, 70%); background: var(--chart-bar); border-radius: 2px 2px 0 0; min-height: 2px; }
.vbar:last-child .vbar-fill { background: var(--ink); }
.vbar-value { font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--ink); margin-bottom: var(--space-1); font-variant-numeric: tabular-nums; }
.vbar-axis { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; font-size: var(--fs-xs); color: var(--ink-muted); text-align: center; }
.tip {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  padding: var(--space-1) var(--space-2); border-radius: 8px;
  background: var(--ink); color: var(--bg);
  font-size: var(--fs-xs); white-space: nowrap; pointer-events: none;
  opacity: 0;
}
.vbar:hover .tip, .vbar:focus .tip, .hbar:hover .tip, .hbar:focus .tip { opacity: 1; }

/* ---- Bar chart (horizontal, single series) ---- */
.hbars { display: flex; flex-direction: column; gap: var(--space-4); }
.hbar { position: relative; display: grid; grid-template-columns: 110px 1fr auto; gap: var(--space-3); align-items: center; font-size: var(--fs-sm); }
.hbar-track { height: 8px; box-shadow: inset 1px 0 0 var(--chart-grid); }
.hbar-fill { height: 100%; background: var(--chart-bar); border-radius: 0 2px 2px 0; }
.hbar-value { font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; }
.hbar .tip { left: auto; right: 0; transform: none; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; font-size: var(--fs-xs); font-weight: var(--fw-medium); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--ink-muted); padding: var(--space-3); white-space: nowrap; box-shadow: inset 0 -1px 0 var(--ink); }
.table td { padding: var(--space-3); vertical-align: middle; }
.table tr + tr td { box-shadow: inset 0 1px 0 var(--line); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .strong { font-weight: var(--fw-medium); }

/* ---- Stat strip on narrower screens (after the base rules so they win) ---- */
@media (max-width: 860px) {
  .stats { grid-template-columns: 1fr 1fr; border-bottom: 0; }
  .stats .stat, .stats .stat + .stat { padding: var(--space-4) var(--space-4) var(--space-4) 0; box-shadow: inset 0 -1px 0 var(--line); }
  .stats .stat:nth-child(even) { padding-left: var(--space-4); box-shadow: inset 0 -1px 0 var(--line), inset 1px 0 0 var(--line); }
  .stat-value { font-size: 40px; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
  .stats .stat, .stats .stat + .stat, .stats .stat:nth-child(even) { padding-inline: 0; box-shadow: inset 0 -1px 0 var(--line); }
  .stat-value { font-size: 34px; }
}
