/* pH Pool Service: the service ticket (left) and the job site + test bench (right). --tlg-* tokens for dark mode. */
.pp { position: absolute; inset: 0; display: grid; grid-template-columns: 392px minmax(0, 1fr); gap: 12px; padding: 10px 12px; color: var(--tlg-text); font-size: 16px; }

/* ── ticket ── */
.pp-ticket { min-width: 0; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; border-radius: 14px;
  background: var(--tlg-surface); border: 2px solid var(--tlg-border); box-shadow: 0 2px 0 var(--tlg-border);
  background-image: linear-gradient(90deg, transparent 0 calc(100% - 6px), color-mix(in srgb, var(--ps-accent) 70%, transparent) calc(100% - 6px)); }
.pp-ticket-head { display: flex; align-items: center; gap: 10px; }
.pp-ticket-icon svg { width: 30px; height: 30px; display: block; }
.pp-ticket-icon { font-size: 28px; line-height: 1; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: color-mix(in srgb, var(--ps-accent) 14%, var(--tlg-surface)); }
.pp-ticket-k { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--ps-accent); }
html[data-theme="dark"] .pp-ticket-k, html[data-theme="dark"] .pp-q-k { color: #7fd3e6; }
.pp-ticket-t { margin: 0; font-size: 18px; font-weight: 700; }
.pp-given { display: grid; grid-template-columns: auto auto; justify-content: space-between; gap: 2px 10px; padding: 5px 8px; border-radius: 10px; background: var(--tlg-bg-band); border: 1px dashed var(--tlg-border-strong); }
.pp-given-i { font-size: 16px; line-height: 1.3; white-space: nowrap; }
.pp-q { display: flex; flex-direction: column; gap: 4px; }
.pp-q-k { margin: 0; font-size: 16px; font-weight: 800; color: var(--ps-accent); line-height: 1.25; }
.pp-ap { display: inline-block; padding: 0 6px; margin-right: 4px; border-radius: 6px; background: var(--ps-accent); color: #fff; font-size: 16px; }
html[data-theme="dark"] .pp-ap { background: #7fd3e6; color: #10202a; }
.pp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-chips--two .pp-chip { flex: 1 1 0; }
.pp-chip { flex: 1 1 auto; min-height: 44px; padding: 4px 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px;
  border: 2px solid var(--tlg-border-strong); background: var(--tlg-surface); color: var(--tlg-text); font: inherit; font-size: 16px; cursor: pointer; text-align: left; transition: transform .12s, background .12s; }
.pp-chip:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--ps-accent); }
.pp-chip:focus-visible { outline: 3px solid var(--tlg-focus); outline-offset: 2px; }
.pp-chip small { display: block; font-size: 16px; color: var(--tlg-text-muted); }
.pp-chip[aria-checked="true"] { background: color-mix(in srgb, var(--ps-accent) 16%, var(--tlg-surface)); border-color: var(--ps-accent); box-shadow: inset 0 0 0 2px var(--ps-accent); }
.pp-chip[aria-checked="true"]::before { content: '✓'; font-weight: 900; color: var(--ps-accent); }
html[data-theme="dark"] .pp-chip[aria-checked="true"]::before { color: #7fd3e6; }
.pp-chip:disabled { cursor: default; }
.pp-jugdot { width: 18px; height: 26px; border-radius: 5px 5px 6px 6px; flex: none; box-shadow: inset -4px 0 0 rgba(0,0,0,.18); }
.pp-chip--acid .pp-jugdot { background: #d6532e; }
.pp-chip--base .pp-jugdot { background: #2f6fc8; }
.pp-chip--acid, .pp-chip--base { justify-content: flex-start; }

/* dose dial */
.pp-dose-row { display: flex; align-items: center; gap: 8px; }
.pp-step { flex: none; width: 44px; height: 44px; border-radius: 10px; border: 2px solid var(--tlg-border-strong); background: var(--tlg-surface); color: var(--tlg-text); font: inherit; font-size: 24px; font-weight: 800; cursor: pointer; }
.pp-step:focus-visible, .pp-range:focus-visible { outline: 3px solid var(--tlg-focus); outline-offset: 2px; }
.pp-range { flex: 1 1 auto; min-width: 60px; height: 44px; font-size: 16px; accent-color: var(--ps-accent); margin: 0; }
.pp-dose-out { flex: none; min-width: 96px; font-size: 16px; color: var(--tlg-text-muted); }
.pp-dose-n { font-size: 26px; font-weight: 900; color: var(--tlg-text); margin-right: 3px; font-variant-numeric: tabular-nums; }
.pp-dose.is-unset .pp-dose-n { color: var(--tlg-text-muted); }
.pp-pips { display: flex; gap: 4px; padding-left: 52px; padding-right: 156px; }
.pp-pip { flex: 1; height: 8px; border-radius: 4px; background: var(--tlg-bg-band); border: 1px solid var(--tlg-border); }
.pp-pip.is-on { background: var(--ps-accent); border-color: var(--ps-accent); }
html[data-theme="dark"] .pp-pip.is-on { background: #7fd3e6; border-color: #7fd3e6; }

/* number boxes */
.pp-num { display: flex; align-items: center; gap: 8px; }
.pp-num-in { width: 130px; min-height: 44px; padding: 6px 10px; border-radius: 10px; border: 2px solid var(--tlg-border-strong); background: var(--tlg-surface); color: var(--tlg-text); font: inherit; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pp-num-in:focus-visible { outline: 3px solid var(--tlg-focus); outline-offset: 2px; }
.pp-num-u { font-size: 16px; color: var(--tlg-text-muted); }
.pp-ticket.is-locked .pp-chip:not([aria-checked="true"]) { opacity: .6; }
.pp-ticket input:disabled { opacity: 1; }

.pp-ticket { position: relative; }
.pp-ticket-who { flex: 1 1 auto; min-width: 0; }
.pp-about { flex: none; align-self: flex-start; font-size: 16px; }
.pp-about summary { cursor: pointer; min-height: 36px; padding: 4px 10px; display: flex; align-items: center; gap: 4px; font-weight: 700; border: 1px solid var(--tlg-border-strong); border-radius: 999px; list-style: none; }
.pp-about summary::-webkit-details-marker { display: none; }
.pp-about summary:focus-visible { outline: 3px solid var(--tlg-focus); outline-offset: 2px; }
.pp-about[open] summary { background: var(--tlg-bg-band); }
.pp-about-pop { position: absolute; z-index: 5; left: 10px; right: 10px; top: 60px; padding: 10px 14px; border-radius: 12px; background: var(--tlg-surface); border: 2px solid var(--tlg-border-strong); box-shadow: var(--tlg-shadow-2, 0 6px 20px rgba(0,0,0,.2)); }
.pp-about-pop p { margin: 4px 0; line-height: 1.4; font-size: 16px; }
.pp-about-h { font-weight: 800; }

/* ── job site ── */
.pp-site { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.pp-svg { display: block; width: 100%; height: auto; max-height: 300px; border-radius: 14px; border: 2px solid var(--tlg-border); background: #e6f5fb; flex: none; }
.pp-svg text { font-family: var(--tlg-font, system-ui, sans-serif); }

/* ── test bench ── */
.pp-bench { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 8px 12px; border-radius: 14px; background: var(--tlg-surface); border: 2px solid var(--tlg-border); }
.pp-bench-k { margin: 0; font-size: 16px; font-weight: 800; }
.pp-bench-sub { font-weight: 400; color: var(--tlg-text-muted); }
.pp-bench-top { display: flex; align-items: center; gap: 10px; }
.pp-cup { flex: none; width: 54px; }
.pp-cup svg { display: block; width: 54px; height: auto; }
.pp-cup-liq { transition: fill .35s; }
.pp-meter { flex: none; width: 140px; display: grid; grid-template-columns: 1fr auto; align-items: baseline; padding: 4px 10px 6px; border-radius: 10px; background: #1d2b22; color: #b8ffca; border: 2px solid #0c120e; }
.pp-meter-k { grid-column: 1 / -1; font-size: 16px; color: #8fe0a4; line-height: 1.2; }
.pp-meter-v { font: 800 30px/1.1 ui-monospace, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; }
.pp-meter-u { font-size: 16px; font-weight: 700; color: #8fe0a4; }
.pp-meter.is-idle .pp-meter-v { color: #6fa883; }
.pp-scale-box { flex: 1 1 auto; min-width: 0; padding: 0 10px; }
.pp-scale { position: relative; padding: 24px 0 2px; }
.pp-scale-bar { position: relative; height: 22px; border-radius: 6px; border: 1px solid rgba(0,0,0,.35); }
.pp-band { position: absolute; top: -5px; bottom: -5px; min-width: 6px; border: 2px dashed #1b2238; border-radius: 4px; background: rgba(255,255,255,.55); }
html[data-theme="dark"] .pp-band { border-color: #ffffff; }
.pp-mk { position: absolute; top: 0; width: 0; height: 0; }
.pp-mk span { position: absolute; left: 0; transform: translateX(-50%); white-space: nowrap; font-size: 16px; font-weight: 800; line-height: 1; }
.pp-mk::after { content: ''; position: absolute; left: -7px; border: 7px solid transparent; }
.pp-mk--start { top: 0; }
.pp-mk--start span { top: 0; color: var(--tlg-text-muted); }
.pp-mk--start::after { top: 16px; border-top: 9px solid var(--tlg-text-muted); border-bottom-width: 0; }
.pp-mk--test, .pp-mk--pool { top: 46px; transition: left .25s; }
.pp-mk--test::after { top: 0; border-bottom: 10px solid var(--tlg-text); border-top-width: 0; }
.pp-mk--test span { top: 36px; display: none; }
.pp-mk--pool::after { top: 0; border-bottom: 10px solid var(--ps-accent); border-top-width: 0; }
.pp-mk--pool span { top: 36px; display: none; }
.pp-ticks { position: relative; height: 22px; margin-top: 10px; }
.pp-tick { position: absolute; top: 0; transform: translateX(-50%); font-size: 16px; color: var(--tlg-text-muted); font-variant-numeric: tabular-nums; }
.pp-tick--minor::before { content: ''; position: absolute; left: 50%; top: -10px; width: 1px; height: 6px; background: var(--tlg-text-muted); }
.pp-scale-words { display: flex; justify-content: space-between; font-size: 16px; color: var(--tlg-text-muted); }

.pp-pair { display: flex; flex-direction: column; gap: 3px; }
.pp-pair-k { margin: 0; font-size: 16px; font-weight: 700; }
.pp-pair-bar { display: flex; height: 18px; border-radius: 6px; overflow: hidden; border: 1px solid var(--tlg-border-strong); background: var(--tlg-bg-band); }
.pp-pair-acid { background: repeating-linear-gradient(45deg, #e3603a 0 6px, #f2a184 6px 10px); transition: width .25s; }
.pp-pair-base { background: #3f7fd6; transition: width .25s; }
.pp-pair-t { margin: 0; font-size: 16px; line-height: 1.3; }
.pp-key { display: inline-block; width: 14px; height: 14px; border-radius: 3px; margin: 0 4px -2px 0; border: 1px solid rgba(0,0,0,.3); }
.pp-key--acid { background: repeating-linear-gradient(45deg, #e3603a 0 4px, #f2a184 4px 7px); }
.pp-key--base { background: #3f7fd6; }

.pp-cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.pp-cmp-h { grid-column: 1 / -1; margin: 0; font-size: 16px; font-weight: 700; }
.pp-cmp-c { min-width: 0; }
.pp-cmp-k, .pp-cmp-v { margin: 0; font-size: 16px; line-height: 1.25; }
.pp-cmp-v { font-weight: 700; font-variant-numeric: tabular-nums; }
.pp-cmp-s { font-weight: 400; color: var(--tlg-text-muted); }
.pp-cmp-bar { height: 8px; border-radius: 4px; background: var(--tlg-bg-band); overflow: hidden; margin-top: 2px; }
.pp-cmp-bar span { display: block; height: 100%; background: var(--ps-accent); transition: width .25s; }

.pp--buffer .pp-scale-words { display: none; }
.pp--buffer .pp-bench { gap: 4px; }
.pp-result { margin: 0; min-height: 0; font-size: 16px; }
.pp-result:empty { display: none; }
.pp-result.is-ok { color: #14632d; }
.pp-result.is-bad { color: #9b1c1c; }
html[data-theme="dark"] .pp-result.is-ok { color: #7ee2a0; }
html[data-theme="dark"] .pp-result.is-bad { color: #ff9c9c; }

/* worked example */
.pp-ex { display: block; width: 100%; height: auto; color: var(--tlg-text); }
.pp-ex text { font-family: var(--tlg-font, system-ui, sans-serif); }

html[data-theme="dark"] .pp-svg { border-color: #33414d; }

@media (max-width: 900px) {
  .pp { position: static; grid-template-columns: 1fr; }
  .pp-ticket { overflow: visible; }
  .pp-bench-top { flex-wrap: wrap; }
  .pp-scale-box { flex-basis: 100%; }
  .pp-pips { padding-right: 0; }
  .pp-given { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .pp *, .pp *::before, .pp *::after { transition: none !important; animation: none !important; }
}
