/* Twój Kardiolog — formularz przesyłania wyników */

.up-page [hidden] { display: none !important; }
.up-page svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.up-page .brand-mark { stroke: none; }
.flip-x { transform: scaleX(-1); }

/* header */
.up-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.up-header-row { display: flex; align-items: center; gap: 24px; height: 68px; }
.up-secure { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: .86rem; color: var(--ink-3); }
.up-secure svg { width: 15px; height: 15px; color: var(--teal); }
.up-back { display: inline-flex; align-items: center; gap: 8px; font-size: .92rem; color: var(--ink-2); text-decoration: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); transition: border-color .2s; }
.up-back:hover { border-color: var(--teal); color: var(--pine); }
.up-back svg { width: 16px; height: 16px; transform: scaleX(-1); }

/* intro + stepper */
.up-main { padding-top: clamp(32px, 5vw, 56px); padding-bottom: 96px; }
.up-title { font-weight: 360; font-size: clamp(1.9rem, 3.4vw, 2.8rem); line-height: 1.1; letter-spacing: -0.03em; color: var(--pine); text-wrap: balance; }
.up-intro .sub { margin-top: 12px; }

.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 36px 0 28px; counter-reset: s; }
.stepper li { display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 3px solid var(--line); color: var(--ink-3); font-size: .92rem; transition: border-color .4s var(--ease), color .3s; }
.st-n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 600; background: var(--surface); border: 1px solid var(--line); font-variant-numeric: tabular-nums; transition: background-color .3s, color .3s, border-color .3s; }
.stepper li.is-done { border-color: var(--teal); color: var(--ink-2); }
.stepper li.is-done .st-n { background: var(--mint); border-color: var(--mint); color: var(--teal); }
.stepper li.is-current { border-color: var(--teal); color: var(--pine); font-weight: 560; }
.stepper li.is-current .st-n { background: var(--teal); border-color: var(--teal); color: #fff; }

/* layout */
.up-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 28px; align-items: start; }
.up-form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: clamp(22px, 4vw, 44px); }
.step-panel:focus { outline: none; }
.step-h { font-weight: 420; font-size: clamp(1.35rem, 2.2vw, 1.7rem); letter-spacing: -0.02em; color: var(--pine); line-height: 1.2; }
.step-sub { margin-top: 6px; color: var(--ink-2); font-size: .98rem; }
.sub-h { margin: 28px 0 4px; font-size: 1.02rem; font-weight: 560; color: var(--pine); }

/* fields */
.field { margin-top: 22px; border: 0; padding: 0; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.lbl { display: block; font-weight: 500; font-size: .95rem; color: var(--ink); margin-bottom: 8px; padding: 0; }
.opt { font-weight: 400; color: var(--ink-3); font-size: .86rem; }
.inp {
  width: 100%; min-height: 50px; padding: 12px 16px;
  border: 1px solid #C3CEC7; border-radius: 14px; background: #fff;
  font-size: 1rem; color: var(--ink); outline: none;
  transition: border-color .2s, box-shadow .2s;
}
textarea.inp { resize: vertical; line-height: 1.5; min-height: 96px; }
.inp::placeholder { color: #66776F; }
.inp:hover { border-color: #9DAFA8; }
.inp:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(20, 90, 80, .12); }
.inp[aria-invalid="true"] { border-color: var(--pulse); box-shadow: 0 0 0 4px rgba(217, 68, 58, .1); }
.hint { margin-top: 6px; font-size: .84rem; color: var(--ink-3); line-height: 1.4; }
.field-error { margin-top: 14px; padding: 12px 16px; border-radius: 12px; background: var(--alarm-tint, #FBEDEB); color: #8E2119; font-size: .92rem; }
.field-error[hidden] { display: none; }
.inp-error { margin-top: 6px; font-size: .84rem; color: #B0281F; }

/* step 1: test choices */
.choice-grid { margin: 24px 0 0; padding: 0; border: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice {
  position: relative; display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: #fff;
  cursor: pointer; transition: border-color .2s, background-color .2s, box-shadow .2s;
}
.choice:hover { border-color: #9DAFA8; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-ico { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--bg); color: var(--teal); transition: background-color .2s, color .2s; }
.choice-ico svg { width: 20px; height: 20px; }
.choice-txt { flex: 1; min-width: 0; line-height: 1.3; }
.choice-txt b { display: block; font-weight: 560; color: var(--pine); font-size: .98rem; }
.choice-txt small { display: block; margin-top: 2px; color: var(--ink-3); font-size: .84rem; }
.choice-tick { flex: none; width: 24px; height: 24px; border-radius: 8px; border: 1.5px solid #9DAFA8; display: grid; place-items: center; color: #fff; background: #fff; transition: background-color .2s, border-color .2s; }
.choice-tick svg { width: 15px; height: 15px; stroke-width: 2.4; opacity: 0; transform: scale(.6); transition: opacity .2s, transform .3s var(--ease); }
.choice:has(input:checked) { border-color: var(--teal); background: #F4F9F6; box-shadow: inset 0 0 0 1px var(--teal); }
.choice:has(input:checked) .choice-ico { background: var(--teal); color: #fff; }
.choice input:checked ~ .choice-tick { background: var(--teal); border-color: var(--teal); }
.choice input:checked ~ .choice-tick svg { opacity: 1; transform: none; }
.choice:has(input:focus-visible) { outline: 2px solid var(--teal); outline-offset: 2px; }

/* step 2: dropzone + files */
.drop {
  position: relative; margin-top: 24px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 36px 20px 28px; border: 1.5px dashed #A8B9B2; border-radius: 20px; background: #F7F9F7;
  transition: border-color .2s, background-color .2s;
}
.drop.is-over { border-color: var(--teal); background: #EDF5F1; }
.drop-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.drop-ico { width: 40px; height: 40px; padding: 9px; box-sizing: content-box; border-radius: 50%; background: var(--mint); color: var(--teal); margin-bottom: 8px; }
.drop-title { font-size: 1.02rem; color: var(--ink); }
.drop-link { color: var(--teal); font-weight: 560; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
.drop-input:focus-visible + svg + .drop-title .drop-link, .drop-link:hover { text-decoration-thickness: 2px; }
.drop:has(#files:focus-visible) { outline: 2px solid var(--teal); outline-offset: 3px; }
.drop-meta { font-size: .84rem; color: var(--ink-3); max-width: 46ch; }
.drop-camera { margin-top: 14px; display: none; }
.drop-camera svg { width: 18px; height: 18px; }
@media (hover: none) and (pointer: coarse) { .drop-camera { display: inline-flex; } }

.files { margin-top: 18px; display: grid; gap: 10px; }
.file {
  display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 6px 14px; align-items: center;
  padding: 12px 12px 12px 12px; border: 1px solid var(--line); border-radius: 16px; background: #fff;
  animation: file-in .4s var(--ease);
}
@keyframes file-in { from { opacity: 0; transform: translateY(6px); } }
.file-thumb { grid-row: span 2; width: 52px; height: 52px; border-radius: 10px; overflow: hidden; background: var(--bg); display: grid; place-items: center; color: var(--teal); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb svg { width: 22px; height: 22px; }
.file-name { font-size: .94rem; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .82rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.file-bar { width: 90px; height: 4px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.file-bar span { display: block; height: 100%; width: 0; background: var(--teal); border-radius: inherit; transition: width .25s linear; }
.file-ok { display: inline-flex; align-items: center; gap: 4px; color: var(--teal); font-weight: 500; }
.file-ok svg { width: 14px; height: 14px; stroke-width: 2.2; }
.file-side { grid-row: span 2; display: flex; align-items: center; gap: 8px; }
.file-select { min-height: 38px; max-width: 190px; padding: 0 30px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234F635D' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; appearance: none; font: inherit; font-size: .86rem; color: var(--ink); cursor: pointer; }
.file-select:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
.file-del { width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--ink-3); display: grid; place-items: center; cursor: pointer; transition: background-color .2s, color .2s; }
.file-del:hover { background: #FBEDEB; color: #B0281F; }
.file-del svg { width: 18px; height: 18px; }
.file.is-error { border-color: #EBC2BD; background: #FFF8F7; }
.file.is-error .file-meta { color: #B0281F; }

.tips { margin-top: 22px; border-radius: 16px; background: var(--bg); }
.tips summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 14px 16px; font-size: .94rem; font-weight: 500; color: var(--pine); }
.tips summary::-webkit-details-marker { display: none; }
.tips summary svg { width: 18px; height: 18px; color: var(--teal); }
.tips .tips-chev { margin-left: auto; color: var(--ink-3); transition: transform .3s var(--ease); }
.tips[open] .tips-chev { transform: rotate(180deg); }
.tips ul { padding: 0 18px 16px 44px; list-style: disc; color: var(--ink-2); font-size: .92rem; display: grid; gap: 6px; }

/* step 3: chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid #C3CEC7; background: #fff; font-size: .92rem; color: var(--ink-2); transition: background-color .2s, border-color .2s, color .2s; }
.chip:hover span { border-color: #9DAFA8; }
.chip input:checked + span { background: var(--teal); border-color: var(--teal); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }
.hint [data-count] { font-variant-numeric: tabular-nums; }
.hint:has([data-count]) { text-align: right; }

.alert { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; padding: 14px 16px; border-radius: 14px; background: #FBEDEB; color: #6E1E18; font-size: .94rem; }
.alert[hidden] { display: none; }
.alert svg { flex: none; width: 22px; height: 22px; color: var(--pulse); }
.alert a { color: #B0281F; font-weight: 600; }

/* step 4: services, segmented, consents */
.services { margin: 22px 0 0; padding: 0; border: 0; display: grid; gap: 10px; }
.svc { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: #fff; cursor: pointer; transition: border-color .2s, background-color .2s, box-shadow .2s; }
.svc:hover { border-color: #9DAFA8; }
.svc input { position: absolute; opacity: 0; pointer-events: none; }
.svc-radio { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid #9DAFA8; background: #fff; transition: border-color .2s, box-shadow .2s; }
.svc-txt { flex: 1; min-width: 0; line-height: 1.35; }
.svc-txt b { display: block; font-weight: 560; color: var(--pine); }
.svc-txt small { display: block; margin-top: 3px; font-size: .86rem; color: var(--ink-3); }
.svc-price { flex: none; font-size: 1.25rem; font-weight: 380; letter-spacing: -0.02em; color: var(--pine); font-variant-numeric: tabular-nums; }
.svc:has(input:checked) { border-color: var(--teal); background: #F4F9F6; box-shadow: inset 0 0 0 1px var(--teal); }
.svc input:checked + .svc-radio { border-color: var(--teal); box-shadow: inset 0 0 0 5px var(--teal); }
.svc:has(input:focus-visible) { outline: 2px solid var(--teal); outline-offset: 2px; }

.seg { display: inline-grid; grid-auto-flow: column; padding: 4px; border-radius: 999px; background: var(--bg); gap: 4px; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 10px 20px; border-radius: 999px; font-size: .94rem; color: var(--ink-2); transition: background-color .25s var(--ease), color .2s, box-shadow .25s; }
.seg input:checked + span { background: #fff; color: var(--pine); font-weight: 560; box-shadow: 0 1px 2px rgba(14, 42, 37, .08), 0 4px 10px -4px rgba(14, 42, 37, .2); }
.seg input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }
.relative[hidden] { display: none; }

.consents { margin: 28px 0 0; padding: 20px 0 0; border: 0; border-top: 1px solid var(--line); display: grid; gap: 14px; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; font-size: .92rem; color: var(--ink-2); line-height: 1.45; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check-box { flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 7px; border: 1.5px solid #9DAFA8; background: #fff; display: grid; place-items: center; color: #fff; transition: background-color .2s, border-color .2s; }
.check-box svg { width: 14px; height: 14px; stroke-width: 2.4; opacity: 0; }
.check input:checked + .check-box { background: var(--teal); border-color: var(--teal); }
.check input:checked + .check-box svg { opacity: 1; }
.check input:focus-visible + .check-box { outline: 2px solid var(--teal); outline-offset: 2px; }
.check input[aria-invalid="true"] + .check-box { border-color: var(--pulse); }
.check a { color: var(--teal); }
.check em { font-style: normal; color: var(--ink-3); font-size: .84rem; }

/* nav */
.step-nav { display: flex; align-items: center; gap: 12px; margin-top: 36px; padding-top: 22px; border-top: 1px solid var(--line); }
.step-nav [data-next], .step-nav [data-submit] { margin-left: auto; }
.step-nav .btn svg { width: 18px; height: 18px; }
.step-count { font-size: .88rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.step-nav [data-prev]:not([hidden]) ~ .step-count { margin-left: 4px; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* success */
.done { text-align: center; padding: 20px 0 8px; }
.done-ico { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: var(--teal); color: #fff; animation: pop .6s var(--ease); }
.done-ico svg { width: 30px; height: 30px; stroke-width: 2.4; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.done-lead { margin-top: 8px; color: var(--ink-2); }
.done-lead b { color: var(--pine); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.done-next { text-align: left; margin: 28px auto; max-width: 480px; display: grid; gap: 14px; counter-reset: d; }
.done-next li { counter-increment: d; position: relative; padding-left: 40px; color: var(--ink-2); font-size: .96rem; }
.done-next li::before { content: counter(d); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--mint); color: var(--teal); font-size: .8rem; font-weight: 600; display: grid; place-items: center; }
.done-next b { color: var(--pine); font-weight: 560; }
.up-form.is-done .step-nav { display: none; }

/* summary */
.summary { position: sticky; top: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 26px; }
.sum-h { font-size: 1.05rem; font-weight: 560; color: var(--pine); }
.sum-list { margin: 16px 0 0; display: grid; gap: 0; }
.sum-list div { display: grid; grid-template-columns: 76px 1fr; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.sum-list dt { color: var(--ink-3); }
.sum-list dd { margin: 0; color: var(--ink); }
.sum-total { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sum-total span { color: var(--ink-2); font-size: .94rem; }
.sum-total b { font-size: 1.8rem; font-weight: 360; letter-spacing: -0.03em; color: var(--pine); font-variant-numeric: tabular-nums; }
.sum-trust { margin-top: 18px; display: grid; gap: 10px; }
.sum-trust li { display: flex; gap: 10px; align-items: center; font-size: .88rem; color: var(--ink-2); }
.sum-trust svg { flex: none; width: 18px; height: 18px; color: var(--teal); }
.sum-help { margin-top: 18px; font-size: .84rem; color: var(--ink-3); }
.sum-help a { color: var(--teal); }

.up-footer { padding: 28px 0 40px; border-top: 1px solid var(--line); font-size: .86rem; color: var(--ink-3); }
.up-footer a { color: #B0281F; font-weight: 600; }

/* responsive */
@media (max-width: 980px) {
  .up-grid { grid-template-columns: minmax(0, 1fr); }
  .summary { position: static; order: -1; padding: 18px 20px; }
  .sum-trust, .sum-help { display: none; }
  .sum-list div { padding: 9px 0; }
  .sum-total { border-bottom: 0; padding-bottom: 2px; }
  .sum-total b { font-size: 1.4rem; }
}
@media (max-width: 640px) {
  .up-secure span, .up-back span { display: none; }
  .up-back { padding: 10px; }
  .stepper { margin: 24px 0 18px; gap: 6px; }
  .stepper li { flex-direction: column; align-items: flex-start; gap: 6px; font-size: .78rem; }
  .stepper li:not(.is-current) .st-l { color: transparent; height: 0; overflow: hidden; }
  .up-form { padding: 20px 16px; border-radius: 22px; }
  .choice-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .file { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .file-thumb { width: 44px; height: 44px; }
  .file-side { grid-row: auto; grid-column: 2 / -1; min-width: 0; }
  .file-del { margin-left: auto; }
  .file-select { max-width: none; flex: 1 1 0; min-width: 0; width: 0; }
  .file-del { flex: none; }
  .file-thumb { grid-row: span 3; align-self: start; }
  .file-name { grid-column: 2 / -1; }
  .svc { align-items: flex-start; }
  .seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
  .seg span { text-align: center; }
  .step-nav { position: sticky; bottom: 0; z-index: 5; margin: 28px -16px -20px; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 0 0 22px 22px; }
  .step-count { display: none; }
  .step-nav .btn { flex: 1; }
  .step-nav [data-prev] { flex: 0 0 auto; }
}
.step-h:focus { outline: none; }
