/* Job Level Tables: layout and the parts only this tool has. A pure re-skin of the live page (same layout,
   same controls in the same places). Colours, type, borders and shape come from the design tokens in ui.css. */

/* ---------- the credit line, kept under the title where it was */
.jl-page .credit-bar { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); margin: 0 0 var(--sp-5); }
.jl-page .credit-bar p { margin: 0; }
.jl-page .credit-bar .cb-tag { flex: none; }

/* ---------- job list on the left, the chosen job on the right (one column at 960px and below) */
.shell { display: grid; grid-template-columns: 262px minmax(0, 1fr); align-items: start; }
.rail { background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--radius); padding: var(--sp-3) 0 var(--sp-4); }

.rail .search { position: relative; display: block; margin: 0 var(--sp-3) var(--sp-2); padding: 0; }
.rail .search svg { position: absolute; left: var(--sp-3); top: 50%; width: 16px; height: 16px; margin-top: -8px; color: var(--text-2); pointer-events: none; }
.rail .search .input { width: 100%; min-height: var(--tap, 44px); padding-left: calc(var(--sp-3) + 24px); }

.rgroup { padding: var(--sp-3) var(--sp-4) var(--sp-1); font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.jbtn {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  width: 100%; min-height: var(--tap, 44px); margin: 0; padding: var(--sp-1) var(--sp-4) var(--sp-1) calc(var(--sp-4) - 3px);
  border: 0; border-left: 3px solid transparent; border-radius: 0; background: none;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.jbtn:hover { background: var(--surface-2); }
.jbtn[aria-current="true"] { background: var(--surface-2); border-left-color: var(--accent); }
.jbtn b { font-weight: 600; font-size: var(--fs-md); line-height: var(--lh-tight); }
.jbtn span { flex: none; font-size: var(--fs-sm); color: var(--text-2); }

/* ---------- the chosen job */
.main { min-width: 0; padding: 0 0 var(--sp-6) var(--sp-6); }
.jhead { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-3) var(--sp-5); }
.jhead h2 { margin: 0; font-size: var(--fs-2xl); line-height: var(--lh-tight); }
.jhead p { margin: var(--sp-1) 0 0; color: var(--text-2); }

.vipwrap { display: flex; align-items: center; gap: var(--sp-2); flex: none; }
.vip-lbl { font-size: var(--fs-md); color: var(--text); cursor: pointer; }
/* the switch: 52 x 44 to press, a 28px track inside */
.sw { position: relative; flex: none; width: 52px; height: var(--tap, 44px); margin: 0; padding: 0; border: 0; background: none; cursor: pointer; }
.sw::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 28px; margin-top: -14px;
  border: var(--bw) solid var(--line-strong); border-radius: var(--radius-lg); background: var(--surface-3);
}
.sw i { position: absolute; left: 5px; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: var(--radius-lg); background: var(--text-2); transition: left .15s ease; }
.sw[aria-pressed="true"]::before { background: var(--accent); border-color: var(--accent); }
.sw[aria-pressed="true"] i { left: 29px; background: var(--accent-ink); }

.lbl { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.lvwrap { margin-top: var(--sp-5); }
.vwrap { margin-top: var(--sp-4); }
.lvwrap .lbl, .vwrap .lbl { margin-bottom: var(--sp-2); }

/* level buttons 0 to 10 in one row; the levels below the chosen one are tinted */
.pips.seg { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: var(--sp-1); width: 100%; }
.pips .pip { min-width: 0; min-height: var(--tap, 44px); padding: 0; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--fs-md); }
.pips .pip.done:not([aria-pressed="true"]) { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--text); }

/* pay-column buttons, wrapping */
.variants.seg { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.variants .vbtn { min-height: var(--tap, 44px); }

/* the value for the chosen level, with the two gains beside it */
.readout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: var(--sp-4); margin-top: var(--sp-5); }
.hero { min-width: 0; }
.hero .v { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.side.stats { display: flex; flex-direction: column; gap: var(--sp-3); margin: 0; }
.side .stat { margin: 0; }
.side .stat dd { margin: 0; }
.side .is-gain { color: var(--ok); }
.stat__muted { font-size: var(--fs-md); font-weight: 400; color: var(--text-2); }

/* formula and notes */
.formula {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3);
  margin-top: var(--sp-4); padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2); border: var(--bw) solid var(--line); border-radius: var(--radius);
}
.formula .k { flex: none; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.formula code { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--text); background: none; border: 0; padding: 0; overflow-wrap: anywhere; }
.jnote { margin: var(--sp-3) 0 0; max-width: var(--maxw-text); color: var(--text-2); line-height: var(--lh-body); }

/* the chart: labels drawn at a size that stays readable (the drawing is 960 units wide) */
.chartbox { margin-top: var(--sp-5); padding: var(--sp-4) var(--sp-5) var(--sp-3); background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--radius); }
.chartbox .chart-lbl { margin-bottom: var(--sp-3); }
.chartbox svg { display: block; width: 100%; height: auto; overflow: visible; }
.ch-grid { stroke: var(--line); }
.ch-area { fill: var(--accent); opacity: .12; }
.ch-line { stroke: var(--accent); }
.ch-now { stroke: var(--accent); opacity: .55; }
.ch-dot { fill: color-mix(in srgb, var(--accent) 45%, var(--surface)); stroke: var(--surface); }
.ch-dot.is-on { fill: var(--accent); }
.ch-y, .ch-x { fill: var(--text-2); font-family: var(--font-num); font-size: 14px; }
.ch-x.is-on { fill: var(--text); font-weight: 700; }

/* the level table */
.tablebox { margin-top: var(--sp-5); }
.tablebox table { min-width: 520px; }
.tablebox th, .tablebox td { white-space: nowrap; }
.tablebox tbody th { text-align: left; white-space: normal; }
.tablebox td.pick { font-weight: 700; }
.tablebox td.branchnote { white-space: normal; min-width: 16em; text-align: left; color: var(--text-2); font-size: var(--fs-sm); }

/* jobs where level does not change pay: one card per kind of work */
.branches { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: var(--sp-3); margin-top: var(--sp-5); }
.branch { background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--radius); padding: var(--sp-4); }
.branch h3 { margin: 0; font-size: var(--fs-lg); }
.branch .lv { font-size: var(--fs-sm); color: var(--text-2); }
.branch .pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--bw); margin: var(--sp-3) 0 0; background: var(--line); border: var(--bw) solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.branch .pair div { background: var(--surface-2); padding: var(--sp-2) var(--sp-3); }
.branch .pair dt { font-size: var(--fs-sm); color: var(--text-2); }
.branch .pair dd { margin: 0; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: var(--fs-lg); font-weight: 700; }
.branch p { margin: var(--sp-3) 0 0; padding-top: var(--sp-3); border-top: var(--bw) solid var(--line); font-size: var(--fs-sm); color: var(--text-2); }

/* the three notes under every job */
.caveats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--bw); margin: var(--sp-5) 0 0; background: var(--line); border: var(--bw) solid var(--line); border-radius: var(--radius); overflow: hidden; }
.caveats > div { background: var(--surface); padding: var(--sp-3) var(--sp-4); }
.caveats dt { margin-bottom: var(--sp-1); font-weight: 600; font-size: var(--fs-sm); }
.caveats dd { margin: 0; font-size: var(--fs-sm); line-height: var(--lh-body); color: var(--text-2); }

@media (max-width: 960px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { max-height: 250px; overflow-y: auto; }
  .main { padding: var(--sp-5) 0 var(--sp-6); }
  .readout { grid-template-columns: minmax(0, 1fr); }
  .side.stats { flex-direction: row; }
  .side .stat { flex: 1 1 0; min-width: 0; }
  .caveats { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .jhead h2 { font-size: var(--fs-xl); }
}

/* very narrow phones (360px and below): the 11 level buttons go on two rows so each stays at least 44px wide */
@media (max-width: 360px) {
  .pips.seg { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
