/* The calculators module: the phone's ledger idiom on the web.
 *
 * Label on the left, box on the right, and a computed answer in the SAME row
 * shape as an input, greyed and not typeable. Read down the left edge to find
 * your quantity and across to the number, and never work out which things are
 * answers. Colours come from tokens.css; the page is the light paper the rest
 * of the web app uses, with white cards on it, so the notes the phone prints
 * on its ink are muted ink here.
 */
.cx-page { max-width: 720px; margin: 0 auto; padding: 22px 8px 56px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ss-brand-ink); }

/* ---- header ------------------------------------------------------------ */
.cx-head { margin-bottom: 14px; }
.cx-up { display: inline-block; margin-bottom: 6px; color: var(--ss-chrome-rule); text-decoration: none; font-size: .95rem; font-weight: 600; }
.cx-up:hover { color: var(--ss-chrome-navy); text-decoration: underline; }
.cx-titlerow { display: flex; align-items: center; gap: 12px; }
.cx-title { flex: 1 1 auto; font-size: 1.7rem; font-weight: 800; color: var(--ss-chrome-navy); letter-spacing: -.01em; margin: 0; line-height: 1.15; }
.cx-lede { margin: 6px 0 0; color: var(--ss-chrome-muted); font-size: 1.02rem; line-height: 1.4; }
.cx-miss { color: var(--ss-brand-ink); font-size: 1rem; line-height: 1.5; }

/* ---- lists of cards (the pack, a group, favorites) ---------------------- */
.cx-section { margin: 18px 0 8px; font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ss-chrome-muted); }
.cx-list { display: flex; flex-direction: column; gap: 8px; }
.cx-item { display: flex; align-items: center; gap: 8px; background: var(--ss-chrome-card); border: 1px solid var(--ss-chrome-cardLine); border-radius: 14px; padding-right: 14px;
           transition: border-color .12s, box-shadow .12s; }
.cx-item:hover { border-color: var(--ss-chrome-rule); box-shadow: 0 4px 16px rgba(26,61,107,.10); }
.cx-tap { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 16px; padding: 14px 16px; color: inherit; text-decoration: none; }
.cx-tap:hover, .cx-tap:focus-visible { color: inherit; outline: none; }
.cx-tap .ss-ic { width: 34px; height: 34px; flex: none; }
.cx-body { flex: 1 1 auto; min-width: 0; }
.cx-t { font-size: 16.5px; font-weight: 600; color: var(--ss-chrome-navy); line-height: 1.25; }
.cx-s { color: var(--ss-chrome-cardSub); font-size: .9rem; line-height: 1.35; margin-top: 2px; }
.cx-count { color: var(--ss-chrome-cardSub); opacity: .75; font-size: .85rem; margin-top: 3px; }
.cx-chev { color: var(--ss-chrome-cardSub); font-size: 22px; line-height: 1; }
.cx-hint { color: var(--ss-chrome-cardSub); text-align: center; margin: 16px 0 0; font-size: .9rem; }

/* the star: filled when starred, outlined when not; outside the link */
.cx-star { flex: none; width: 40px; height: 40px; padding: 0; border: 0; background: transparent; border-radius: 10px; cursor: pointer; display: grid; place-items: center; }
.cx-star svg { width: 24px; height: 24px; }
.cx-star path { fill: none; stroke: #B6C0CB; stroke-width: 1.8; stroke-linejoin: round; transition: fill .12s, stroke .12s; }
.cx-star:hover path { stroke: var(--ss-brand-accent); }
.cx-star.is-on path { fill: var(--ss-brand-accent); stroke: var(--ss-brand-accent); }
.cx-star:focus-visible { outline: 2px solid var(--ss-chrome-rule); outline-offset: 2px; }
.cx-star-lg { width: 44px; height: 44px; }
.cx-star-lg svg { width: 28px; height: 28px; }

/* ---- the calculator body ------------------------------------------------ */
.cx-calc { display: flex; flex-direction: column; gap: 8px; }
.cx-example { display: flex; align-items: center; gap: 7px; padding: 0 2px; margin-bottom: 2px; font-size: .86rem; font-style: italic; color: #9a6a12; }
.cx-example::before { content: ""; width: 7px; height: 7px; border-radius: 4px; background: #e8b339; flex: none; }
.cx-card { display: flex; flex-direction: column; gap: 8px; background: var(--ss-chrome-card); border: 1px solid var(--ss-chrome-cardLine); border-radius: 14px; padding: 16px; }
.cx-field { display: flex; flex-direction: column; gap: 4px; }
.cx-row { display: flex; align-items: center; gap: 16px; min-height: 46px; }
.cx-label { flex: 1 1 auto; min-width: 0; font-size: 16px; line-height: 1.3; color: var(--ss-brand-ink); }
.cx-label.is-strong { font-weight: 700; }
.cx-boxwrap { flex: none; width: 210px; display: flex; align-items: center; gap: 8px; }
.cx-box { flex: 1 1 auto; min-width: 0; min-height: 44px; border: 1.5px solid var(--ss-chrome-line); border-radius: 14px; padding: 8px 14px; font-size: 17px; line-height: 1.3;
          background: #fff; color: var(--ss-brand-ink); font-family: inherit; }
input.cx-box { -moz-appearance: textfield; }
input.cx-box::-webkit-outer-spin-button, input.cx-box::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input.cx-box:focus { outline: none; border-color: var(--ss-brand-accent); box-shadow: 0 0 0 3px var(--ss-chrome-accentSoft); }
input.cx-box.is-bad { border-color: var(--ss-brand-danger); }
input.cx-box.is-owned { border-color: var(--ss-brand-accent); }
.cx-box.is-result { display: flex; align-items: center; justify-content: center; text-align: center; background: #EDF0EA; font-weight: 600; font-variant-numeric: tabular-nums; }
.cx-box.is-result.is-empty { color: var(--ss-chrome-muted); }
.cx-box.is-result.is-text { font-size: 14px; line-height: 1.25; padding: 6px 10px; }
.cx-box.is-result.is-strong { border: 2px solid var(--ss-brand-accent); color: var(--ss-brand-accent); font-size: 20px; }
.cx-box.is-result.is-strong.is-text { font-size: 15px; }
.cx-box.is-result.tone-ok { border: 2px solid var(--ss-chrome-good); color: var(--ss-chrome-good); }
.cx-box.is-result.tone-warn { border: 2px solid var(--ss-brand-warning); color: var(--ss-brand-warning); }
.cx-box.is-result.tone-bad { border: 2px solid var(--ss-brand-danger); color: var(--ss-brand-danger); }
.cx-box.is-result.is-empty.tone-ok, .cx-box.is-result.is-empty.tone-warn, .cx-box.is-result.is-empty.tone-bad { color: var(--ss-chrome-muted); }
button.cx-box { cursor: text; font-family: inherit; }
button.cx-box.is-hint { font-size: 14px; font-weight: 500; }
.cx-suffix { flex: none; width: 44px; font-size: 13px; color: var(--ss-chrome-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-err { font-size: .86rem; color: var(--ss-brand-danger); }
.cx-busy { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--ss-chrome-line); border-top-color: var(--ss-chrome-muted); border-radius: 50%; animation: cxspin .8s linear infinite; }
@keyframes cxspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cx-busy { animation: none; } }

/* a two-way (or five-way) choice that changes the sums */
.cx-seg { display: inline-flex; border: 1.5px solid var(--ss-brand-accent); border-radius: 14px; overflow: hidden; }
.cx-seg button { min-width: 62px; padding: 9px 16px; border: 0; background: transparent; color: var(--ss-brand-accent); font: 700 13px/1.2 inherit; font-family: inherit; cursor: pointer; }
.cx-seg button + button { border-left: 1.5px solid var(--ss-brand-accent); }
.cx-seg button.is-on { background: var(--ss-brand-accent); color: #fff; }
.cx-seg button:focus-visible { outline: 2px solid var(--ss-chrome-navy); outline-offset: -2px; }
.cx-seg.is-full { display: flex; }
.cx-seg.is-full button { flex: 1 1 0; min-width: 0; padding: 12px 4px; }
.cx-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cx-chips button { min-width: 64px; padding: 9px 16px; border: 1.5px solid var(--ss-brand-accent); border-radius: 14px; background: transparent; color: var(--ss-brand-accent); font: 700 13px/1.2 inherit; font-family: inherit; cursor: pointer; }
.cx-chips button.is-on { background: var(--ss-brand-accent); color: #fff; }
.cx-stack { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }

/* the fetch row under a looked-up field */
.cx-fetch { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cx-fetchbtn { display: inline-flex; align-items: center; gap: 8px; padding: 6px 0; border: 0; background: transparent; color: var(--ss-brand-accent); font: 700 13px/1.2 inherit; font-family: inherit; cursor: pointer; }
.cx-fetchbtn:disabled { opacity: .6; cursor: default; }
.cx-fetchbtn svg { width: 18px; height: 18px; }
.cx-linkbtn { border: 0; background: transparent; padding: 4px 0; color: var(--ss-chrome-muted); font: 13px/1.2 inherit; font-family: inherit; cursor: pointer; text-decoration: underline; }

/* a line of context under a group: where a number came from, or a caveat */
.cx-note { margin: 4px 2px 0; font-size: .9rem; line-height: 1.45; color: var(--ss-chrome-muted); }
.cx-ref { margin: 12px 0 4px; border-left: 3px solid var(--ss-chrome-rule); padding-left: 14px; display: flex; flex-direction: column; gap: 2px; }
.cx-ref i { font-size: .86rem; line-height: 1.4; color: var(--ss-chrome-muted); }
.cx-refpage { white-space: nowrap; }
.cx-ref a { font-size: .86rem; font-weight: 600; color: var(--ss-chrome-rule); text-decoration: none; }
.cx-ref a:hover { text-decoration: underline; }

/* where a fetched number came from and when */
.cx-prov { margin-top: 2px; padding: 8px 12px; border-radius: 8px; background: var(--ss-chrome-paper); border: 1px solid var(--ss-chrome-pale); display: flex; flex-direction: column; gap: 2px; }
.cx-provrow { display: flex; align-items: center; gap: 8px; }
.cx-provpin { color: var(--ss-brand-accent); width: 16px; text-align: center; font-size: 16px; line-height: 18px; }
.cx-provrow b { font-size: .9rem; color: var(--ss-chrome-navy); }
.cx-provrow span { font-size: .86rem; color: var(--ss-chrome-muted); }
.cx-provrow span.is-stale { color: var(--ss-brand-warning); }

/* the pressure trend card */
.cx-trend { margin-top: 6px; border-radius: 10px; border: 1px solid var(--ss-chrome-cardLine); background: var(--ss-chrome-card); padding: 10px 12px; }
.cx-trendhead { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 0; text-align: left; cursor: pointer; font-family: inherit; }
.cx-trendhead b { display: block; font-size: .9rem; color: var(--ss-chrome-navy); }
.cx-trendhead span { display: block; font-size: .86rem; color: var(--ss-chrome-muted); }
.cx-trendhead em { font-style: normal; font-weight: 700; font-size: .86rem; color: var(--ss-brand-accent); white-space: nowrap; }
.cx-trendbody { margin-top: 8px; }
.cx-trendbody svg { display: block; width: 100%; height: auto; }
.cx-trendmsg { font-size: .86rem; color: var(--ss-chrome-muted); }
.cx-trendtake { font-size: .9rem; line-height: 1.4; color: var(--ss-brand-ink); margin-top: 4px; }
.cx-trendsrc { font-size: .76rem; color: var(--ss-chrome-cardSub); margin-top: 4px; }

/* ---- settings ----------------------------------------------------------- */
.cx-settings { display: flex; flex-direction: column; gap: 16px; background: var(--ss-chrome-card); border: 1px solid var(--ss-chrome-cardLine); border-radius: 14px; padding: 16px; }
.cx-setrow { display: flex; align-items: center; gap: 16px; }
.cx-setwhat { flex: 1 1 auto; min-width: 0; }
.cx-setlabel { font-size: 16px; font-weight: 600; color: var(--ss-brand-ink); }
.cx-setsub { font-size: .86rem; color: var(--ss-chrome-muted); }
.cx-setrule { height: 1px; background: var(--ss-chrome-cardLine); }
.cx-seg.cx-seg-sub button { min-width: 78px; display: flex; flex-direction: column; align-items: center; padding: 8px 16px; }
.cx-seg.cx-seg-sub small { font-size: 11px; line-height: 14px; margin-top: 1px; font-weight: 400; }

/* ---- phones ------------------------------------------------------------- */
@media (max-width: 640px) {
  .cx-page { padding-top: 12px; }
  .cx-title { font-size: 1.45rem; }
  .cx-boxwrap { width: 168px; }
  .cx-box { padding: 8px 12px; }
  .cx-tap { gap: 12px; padding: 12px 14px; }
  .cx-setrow { flex-wrap: wrap; }
}
@media (max-width: 380px) {
  .cx-boxwrap { width: 150px; }
  .cx-row { gap: 10px; }
}
