/* ============================================================
   SPUN Medika — shared components
   Geometry and posture traced from RECON/original-recon-summary.md:
   pill chips/inputs/secondary buttons, 8px auth + promo CTAs,
   1px borders, very low-alpha shadow, border-led containment.
   ============================================================ */

/* ---------- header ---------- */
.hdr {
  position: sticky; top: 0; z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--hairline);
}
.hdr-in { display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: flex; align-items: baseline; gap: 7px; font-weight: 700; font-size: 19px; letter-spacing: -.01em; }
.brand b { color: var(--fg); }
.brand span { color: var(--accent); font-weight: 600; font-size: 15px; }
.hdr-nav { display: flex; gap: 22px; font: var(--t-ctrl); color: var(--fg-control); }
.hdr-nav a { padding: 6px 0; border-bottom: 2px solid transparent; }
.hdr-nav a:hover { border-bottom-color: var(--accent); }
.hdr-nav a[aria-current="page"] { border-bottom-color: var(--fg); }
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
@media (max-width: 900px) { .hdr-nav { display: none; } }
/* Below 520px the currency pill + two buttons overflow the viewport.
   Drop the secondary affordances rather than let the page scroll sideways. */
@media (max-width: 520px) {
  .hdr-in { gap: 12px; height: 58px; }
  .hdr-right { gap: 6px; }
  .hdr [data-od-id="currency-pill"],
  .hdr [data-od-id="cta-login"] { display: none; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: var(--t-ctrl); color: var(--fg-control);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 12px 16px; min-height: 44px;
  cursor: pointer; box-shadow: var(--sh-1);
  transition: background .15s, border-color .15s, transform .12s, box-shadow .15s;
}
.btn:hover { border-color: var(--muted-light); transform: translateY(-1px); box-shadow: var(--sh-2); }
.btn:active { transform: translateY(0); box-shadow: var(--sh-1); }
.btn--ctrl { border-radius: var(--r-ctrl); }
.btn--primary {
  background: linear-gradient(180deg,
    color-mix(in oklch, var(--accent) 92%, #ffffff),
    var(--accent));
  color: #ffffff; border-color: color-mix(in oklch, var(--accent) 70%, var(--fg-control));
  box-shadow: 0 1px 2px rgba(23,20,18,.10), inset 0 1px 0 rgba(255,255,255,.28);
}
.btn--primary:hover { border-color: var(--fg-control); box-shadow: 0 6px 18px color-mix(in oklch, var(--accent) 30%, transparent); }
.btn--quiet { background: transparent; border-color: transparent; box-shadow: none; }
.btn--quiet:hover { background: var(--surface-chip); border-color: transparent; box-shadow: none; }
.btn--sm { padding: 8px 14px; min-height: 36px; border-radius: var(--r-ctrl); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  font: var(--t-ctrl); color: var(--fg-control);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 9px 16px; min-height: 40px;
  cursor: pointer; box-shadow: var(--sh-1); transition: background .15s, border-color .15s;
}
.chip:hover { background: var(--surface-warm); border-color: var(--muted-light); }
.chip[aria-pressed="true"], .chip.is-on {
  background: var(--fg-control); color: #ffffff; border-color: var(--fg-control);
}
.chip--flat { background: var(--surface-chip); box-shadow: none; border-color: transparent; cursor: default; }
.chip--flat:hover { background: var(--surface-chip); border-color: transparent; }
.chiprow { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chiprow::-webkit-scrollbar { display: none; }

/* ---------- tags / badges ---------- */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font: 600 11.5px/1 var(--f); letter-spacing: .04em; text-transform: uppercase;
  border-radius: var(--r-tag); padding: 5px 8px;
}
.tag--save  { background: var(--accent-2); color: #ffffff; text-transform: none; letter-spacing: 0; font-size: 12px; }
.tag--promo { background: var(--accent-wash); color: var(--accent); }
.tag--code  { background: var(--surface-chip); color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 500; }

/* provenance badges — the evidence grade of a price row */
.prov { display: inline-flex; align-items: center; gap: 4px; font: 500 11.5px/1 var(--f); border-radius: var(--r-tag); padding: 4px 7px; white-space: nowrap; }
.prov--acuan { background: var(--ok-wash);   color: color-mix(in oklch, var(--ok) 75%, var(--fg-control)); }
.prov--quote { background: var(--accent-wash); color: color-mix(in oklch, var(--accent) 78%, var(--fg-control)); }
.prov--est   { background: var(--warn-wash); color: color-mix(in oklch, var(--warn) 80%, var(--fg-control)); }
.prov--unk   { background: var(--risk-wash); color: color-mix(in oklch, var(--risk) 78%, var(--fg-control)); }

/* confidence — semantic layer, icon + label always */
.conf { display: inline-flex; align-items: center; gap: 6px; font: var(--t-ctrl); border-radius: var(--r-pill); padding: 7px 13px; }
.conf--hi  { background: var(--ok-wash);   color: color-mix(in oklch, var(--ok) 72%, var(--fg-control)); }
.conf--mid { background: var(--warn-wash); color: color-mix(in oklch, var(--warn) 78%, var(--fg-control)); }
.conf--lo  { background: var(--risk-wash); color: color-mix(in oklch, var(--risk) 75%, var(--fg-control)); }
.conf svg { flex: none; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-card); box-shadow: var(--sh-1);
}
.card--link { display: block; transition: transform .16s, box-shadow .16s, border-color .16s; }
.card--link:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--muted-light); }
.card .card { box-shadow: none; }

.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 940px) { .grid3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid3, .grid2 { grid-template-columns: 1fr; } }

/* procedure card — mirrors the visa card: title left, photo right, price in accent */
.pcard { display: flex; flex-direction: column; overflow: hidden; }
.pcard-top { display: flex; gap: 14px; padding: 16px 16px 12px; }
.pcard-txt { min-width: 0; flex: 1; }
.pcard h3 { font: var(--t-card); font-size: 15px; margin-bottom: 5px; }
.pcard-photo {
  flex: none; width: 84px; height: 62px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--hairline); background: var(--surface-chip);
}
.pcard-photo img { width: 100%; height: 100%; object-fit: cover; }
.pcard-foot { margin-top: auto; padding: 12px 16px 16px; border-top: 1px solid var(--hairline); display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.pcard-price { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pcard-price .from { font: var(--t-meta); color: var(--muted); }
.pcard-price .val  { font: 700 17px/1.15 var(--f); color: var(--accent); font-variant-numeric: tabular-nums; }
.pcard-price .cmp  { font: var(--t-meta); color: var(--muted-light); text-decoration: line-through; font-variant-numeric: tabular-nums; }

/* ---------- sections ---------- */
.sec { padding: 56px 0; }
.sec--warm { background: var(--surface-warm); }
.sec-head { text-align: center; max-width: 620px; margin: 0 auto 28px; }
.sec-head p { margin-top: 10px; color: var(--muted); }
@media (max-width: 640px) { .sec { padding: 40px 0; } }

/* ---------- footer ---------- */
.ftr { background: var(--surface-warm); border-top: 1px solid var(--border); padding: 44px 0 28px; margin-top: 8px; }
.ftr-cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 32px; }
.ftr h4 { font: var(--t-item); margin-bottom: 12px; }
.ftr li { margin-bottom: 8px; font-size: 14px; color: var(--muted); }
.ftr li a:hover { color: var(--fg); }
.ftr-legal { margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--border); font: var(--t-meta); color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 18px; }
@media (max-width: 860px) { .ftr-cols { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .ftr-cols { grid-template-columns: 1fr; } }

/* ---------- the standing medical disclaimer ---------- */
.disc {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface-chip); border-radius: var(--r-ctrl);
  padding: 12px 14px; font: var(--t-meta); color: var(--muted);
}
.disc svg { flex: none; margin-top: 1px; color: var(--muted); }
.disc b { color: var(--fg-control); font-weight: 600; }

/* ---------- table (the itemised ledger) ---------- */
/* Fixed layout with explicit column widths: the item column carries the name AND
   its provenance note, so it needs the bulk of the width. Without this the name
   breaks one word per line. */
.ledger { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.ledger col.c-item  { width: 31%; }
.ledger col.c-qty   { width: 10%; }
.ledger col.c-unit  { width: 18%; }
.ledger col.c-prov  { width: 19%; }
.ledger col.c-sub   { width: 22%; }
.ledger th {
  text-align: left; font: 600 12px/1.3 var(--f); letter-spacing: .03em;
  text-transform: uppercase; color: var(--muted); padding: 10px 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.ledger td { padding: 12px; border-bottom: 1px solid var(--hairline); vertical-align: top; overflow-wrap: break-word; }
.ledger tbody tr:last-child td { border-bottom: 0; }
/* No nowrap: fixed columns plus nowrap makes long ranges spill into the next cell. */
.ledger .num { text-align: right; font-variant-numeric: tabular-nums; }
.ledger .it-name { font-weight: 500; color: var(--fg); }
.ledger .it-note { display: block; margin-top: 3px; font: var(--t-meta); color: var(--muted); }
.ledger tr.is-off td { opacity: .45; }

/* ---------- form controls ---------- */
.field { display: block; }
.field > span { display: block; font: var(--t-item); margin-bottom: 7px; }
.inp {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-pill); padding: 11px 16px; min-height: 44px;
}
.inp:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
select.inp { appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) calc(50% + 1px), calc(100% - 14px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 38px; }

.range { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; background: transparent; cursor: pointer; }
.range::-webkit-slider-runnable-track { height: 5px; border-radius: 3px; background: var(--surface-chip); border: 1px solid var(--border); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: var(--surface); border: 1px solid var(--muted); box-shadow: var(--sh-1); }
.range::-moz-range-track { height: 5px; border-radius: 3px; background: var(--surface-chip); border: 1px solid var(--border); }
.range::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--surface); border: 1px solid var(--muted); }

.stepper { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface); padding: 3px; }
.stepper button { width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; font-size: 17px; line-height: 1; color: var(--fg-control); }
.stepper button:hover { background: var(--surface-chip); }
.stepper output { min-width: 30px; text-align: center; font: var(--t-ctrl); font-variant-numeric: tabular-nums; }

.sw { display: flex; align-items: center; gap: 10px; cursor: pointer; font: var(--t-item); }
.sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw i { flex: none; width: 40px; height: 24px; border-radius: var(--r-pill); background: var(--surface-chip); border: 1px solid var(--border); position: relative; transition: background .16s, border-color .16s; }
.sw i::after { content: ""; position: absolute; inset: 2px auto 2px 2px; width: 18px; border-radius: 50%; background: var(--surface); box-shadow: var(--sh-1); transition: transform .16s; }
.sw input:checked + i { background: var(--accent); border-color: color-mix(in oklch, var(--accent) 70%, var(--fg-control)); }
.sw input:checked + i::after { transform: translateX(16px); }
.sw input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- misc layout helpers ---------- */
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.crumb { display: flex; gap: 8px; align-items: center; font: var(--t-meta); color: var(--muted); padding: 18px 0 0; }
.crumb a:hover { color: var(--accent); }
