/* tires-overview.css — Plan › Tires: summary line, controls, life chart and
 * the table (tires-overview.js, tire-strategy.js). Rates' wear inputs share
 * the .tov-inputs rules. Every rule is scoped
 * under #sub11 and every new class starts tov-: other sheets use short
 * prefixes too. */

/* ---- Top bar: one summary line, then the controls ---- */
#sub11 .tov-bar { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
#sub11 .tov-summary { margin: 0; font-size: 14px; color: var(--text-2); line-height: 1.4; }
#sub11 .tov-summary[hidden] { display: none; }
#sub11 .tov-summary b { color: var(--text-hi); font-variant-numeric: tabular-nums; }
#sub11 .tov-summary .tov-crit,
#sub11 .tov-summary .tov-crit b { color: var(--crit); }
/* Fits / short / rain: small chips after the line. */
#sub11 .tov-chip { display: inline-block; margin: 2px 4px 0 0; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
    border: 1px solid var(--line-2, var(--line)); color: var(--text-2); vertical-align: 1px; }
#sub11 .tov-chip.tov-ok { color: var(--accent); border-color: var(--accent); }
#sub11 .tov-chip.tov-warn { color: var(--warn); border-color: var(--warn); }
#sub11 .tov-summary .tov-chip.tov-crit { color: var(--crit); border-color: var(--crit); }
#sub11 .tov-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
#sub11 .tov-alloc-link { font-size: 13px; }
#sub11 .tov-bar .tire-shortage[hidden] { display: none; }

/* ---- The life chart ---- */
#sub11 .tov-chart { margin: 12px 0; min-width: 0; padding: 8px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
#sub11 .tov-chart[hidden] { display: none; }
#sub11 .tov-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; margin-bottom: 4px;
    font-size: var(--fs-micro, 11px); color: var(--text-3); }
#sub11 .tov-head > span:first-child { text-transform: uppercase; letter-spacing: .08em; color: var(--text-4); }
#sub11 .tov-key { display: flex; flex-wrap: wrap; gap: 2px 12px; }
#sub11 .tov-k { white-space: nowrap; }
#sub11 .tov-sw { display: inline-block; width: 14px; height: 0; margin-right: 4px; vertical-align: 3px; border-top: 2px solid var(--accent); }
#sub11 .tov-sw.tov-FR, #sub11 .tov-sw.tov-RR { border-top-color: var(--info); }
#sub11 .tov-sw.tov-RL, #sub11 .tov-sw.tov-RR { border-top-style: dashed; }
#sub11 .tov-key-wet { display: inline-block; width: 12px; height: 8px; margin-right: 4px; background: var(--info-dim); border-radius: 2px; }
#sub11 .tov-plot { position: relative; min-width: 0; }
#sub11 .tov-plot svg { display: block; max-width: 100%; overflow: visible; outline: none; }
#sub11 .tov-plot svg:focus-visible { outline: 2px solid var(--ring, var(--accent)); outline-offset: 2px; border-radius: 3px; }
#sub11 .tov-wetband { fill: var(--info-dim); }
#sub11 .tov-grid-l { stroke: var(--line); stroke-width: 1; }
#sub11 .tov-stop { stroke: var(--line-3, var(--line)); stroke-width: 1; stroke-dasharray: 1 3; }
#sub11 .tov-axis text, #sub11 .tov-min-t { font-size: 10px; fill: var(--text-4); font-variant-numeric: tabular-nums; }
#sub11 .tov-min-t { fill: var(--crit); }
#sub11 .tov-min { stroke: var(--crit); stroke-width: 1; stroke-dasharray: 4 3; opacity: .8; }
#sub11 .tov-life { fill: none; stroke: var(--accent); stroke-width: 1.5; stroke-linejoin: round; }
#sub11 .tov-life.tov-FR, #sub11 .tov-life.tov-RR { stroke: var(--info); }
#sub11 .tov-life.tov-RL, #sub11 .tov-life.tov-RR { stroke-dasharray: 5 3; }
#sub11 .tov-life.tov-under { stroke: var(--crit); stroke-width: 2; }
#sub11 .tov-cursor { stroke: var(--text-2); stroke-width: 1; }
#sub11 .tov-tip { position: absolute; top: -6px; transform: translateY(-100%); z-index: 4; padding: 4px 8px; pointer-events: none;
    background: var(--panel-2); border: 1px solid var(--line-2, var(--line)); border-radius: 4px;
    font-size: 12px; line-height: 1.4; color: var(--text-hi); white-space: nowrap; font-variant-numeric: tabular-nums; }
#sub11 .tov-tip[hidden] { display: none; }
#sub11 .tov-tip .tov-crit { color: var(--crit); }

/* ---- Rates' wear inputs: dry and wet side by side ---- */
#planRates .tov-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; align-items: start;
    padding: 8px 12px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); }
#planRates .tov-wear { display: grid; gap: 4px; min-width: 0; }
#planRates .tov-wh { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; }
#planRates .tov-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
    font-size: var(--fs-micro, 11px); letter-spacing: .08em; color: var(--text-4); text-align: center; }
/* Corner names only label the four boxes, not the one average box. */
#planRates .tov-wear:has(> .tov-avg:not([hidden])) > .tov-cols { display: none; }
#planRates .tov-inputs .ti-row { grid-column: auto; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
#planRates .tov-inputs .ti-row[hidden] { display: none; }
#planRates .tov-inputs input { width: 100%; min-width: 0; min-height: 30px; padding: 4px 6px; text-align: center; }
#planRates .tov-inputs .seg-toggle button { min-height: 0; margin: 0; }

/* ---- More options: start life and Clear manual changes ---- */
#sub11 .tov-more > summary { cursor: pointer; font-size: 13px; color: var(--text-3); }
#sub11 .tov-more[open] { display: grid; gap: 6px; }
#sub11 .tov-more .ti-row { display: grid; grid-template-columns: repeat(4, minmax(0, 72px)); gap: 8px; }
#sub11 .tov-more input { width: 100%; min-width: 0; text-align: center; }
#sub11 #btnClearTirePins[hidden] { display: none; }
#sub11 .tov-more .ti-more-note { margin: 0; }

/* ---- Table: what each stop fits, then the life left on each corner ---- */
#sub11 #tireScheduleTable .tl-change { text-align: left; min-width: 16ch; }
#sub11 #tireScheduleTable thead th:nth-child(n+4) { text-align: center; }
#sub11 #tireScheduleTable .tire-stop { min-height: 26px; padding: 2px 10px; border-radius: 6px; border: 1px solid var(--line-2, var(--line));
    background: none; color: var(--text-hi, var(--text)); font-weight: 600; font-size: 13px; text-align: left; white-space: normal; cursor: pointer; }
#sub11 #tireScheduleTable .tire-stop:hover { border-color: var(--accent); }
#sub11 #tireScheduleTable .tire-stop.pinned { border-color: var(--text-3); }
#sub11 #tireScheduleTable .tire-stop.is-grid { border: 0; padding-left: 0; cursor: default; color: var(--text-3); }
#sub11 #tireScheduleTable .tire-stop.is-fitted { border-style: dashed; color: var(--text-2); cursor: not-allowed; }
#sub11 #tireScheduleTable .tl-warn { display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 600; color: var(--crit); }
#sub11 #tireScheduleTable .tl-c { text-align: center; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--accent); white-space: nowrap; }
#sub11 #tireScheduleTable .tl-c.tl-near { color: var(--warn); }
#sub11 #tireScheduleTable .tl-c.tl-crit { color: var(--crit); }
#sub11 #tireScheduleTable .tl-pill { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; font-size: 10px;
    font-weight: 700; letter-spacing: .06em; text-transform: uppercase; vertical-align: 2px; }
#sub11 #tireScheduleTable .tl-pill.new { background: var(--info-dim); color: var(--info); }
#sub11 #tireScheduleTable .tl-pill.used { background: var(--warn-dim); color: var(--warn-soft, var(--warn)); }
#sub11 #tireScheduleTable .tl-pill.wet { background: var(--info-dim); color: var(--info); }
#sub11 #tireScheduleTable .tl-pill.tl-brake { background: var(--warn-dim); color: var(--warn-soft, var(--warn)); }
#sub11 #tireScheduleTable tr.is-locked td { opacity: .75; }

/* Header stays in view on a wide screen. Phones keep the sideways-scrolling
   wrapper, which is what a sticky header would need to give up. */
@media (min-width: 1100px) {
    #sub11 .table-wrap:has(> #tireScheduleTable) { overflow: visible; }
    #sub11 #tireScheduleTable thead th { top: calc(var(--tk-h, 0px) + var(--tabs-h, 0px) + var(--tov-stick, 0px)); z-index: 3;
        background-color: var(--panel); background-image: linear-gradient(var(--accent-dim), var(--accent-dim)); }
}

/* Phones: # · Change · the four corners, each life over its new/used tag. The driver is on Stints. */
@media (max-width: 600px) {
    html body #sub11 #tireScheduleTable { min-width: 0; width: 100%; }
    html body #sub11 #tireScheduleTable :is(th, td):is(:nth-child(2), :nth-child(4)) { display: none; }
    html body #sub11 #tireScheduleTable :is(th, td) { padding: 4px 3px; }
    html body #sub11 #tireScheduleTable .tl-change { min-width: 0; }
    html body #sub11 #tireScheduleTable .tire-stop { padding: 2px 6px; font-size: 12px; }
    html body #sub11 #tireScheduleTable .tl-c { font-size: 13px; }
    html body #sub11 #tireScheduleTable .tl-pill { display: block; width: max-content; margin: 2px auto 0; font-size: 9px; }
}

@media (max-width: 768px) {
    #planRates .tov-inputs { grid-template-columns: minmax(0, 1fr); }
    #sub11 .tov-summary { font-size: 13px; }
}
#planRates .rates-wear { margin-bottom: 12px; }

/* Fuel saving wear: read-only corners, lined up with the boxes above. */
#planRates .tov-ro span { min-height: 30px; line-height: 30px; text-align: center; font-variant-numeric: tabular-nums; color: var(--text-3); }
#sub11 .tov-minlife { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted, var(--text)); white-space: nowrap; }
#sub11 .tov-minlife input { width: 4.5em; min-height: 30px; }
