/*
 * Form window stylesheet — copied from the prototype
 * `docs/openlab/zrodla/prototypy/01-formularz-zlecenia.html` (v4, 30.07.2026),
 * lines 10-326, rules unchanged.
 *
 * Left out on purpose:
 *  - the host page block (`.host*`, `.demo-note`) — a simulation of openlab.3z.pl;
 *  - `.overlay` — it belongs to the loader (D3-94); nothing here uses it.
 *
 * Added on purpose (the "not in the prototype" block at the end): body layout
 * that replaces the overlay inside the iframe, the notice screen, and the
 * full-screen rule at <=900 px.
 *
 * Brand tokens, radii and dialog width are the prototype's values.
 */
  :root {
    /* 3Z brand tokens (branding JSON, 24.07.2026) */
    --primary: #AC2255;
    --primary-dark: #921D48;
    --primary-soft: #FBEEF3;
    --primary-softer: #FDF6F9;
    --ink: #4E4C4C;
    --ink-strong: #2E2C2C;
    --muted: #6C757D;
    --line: #E7E2E4;
    --bg: #FFFFFF;
    --panel: #FAF8F9;
    --ok: #1E8E5A;
    --ok-soft: #EAF6F0;
    --warn: #B8860B;
    --err: #C62828;
    --r-card: 4px;
    --r-btn: 2px;
    --shadow: 0 10px 34px rgba(78, 76, 76, .10);
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { height: 100%; }
  body { font-family: 'Montserrat', system-ui, sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; }
  button { font-family: inherit; }

  /* Buttons: declared in the prototype's host page block, but also used
     inside the dialog (login gate, tooth picker). */
  .btn-primary { background: var(--primary); color: #fff; border: 1px solid var(--primary); border-radius: var(--r-btn); font-weight: 600; font-size: 15px; padding: 15px 34px; cursor: pointer; transition: background .15s, transform .15s, box-shadow .15s; }
  .btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 8px 22px rgba(172, 34, 85, .28); }
  .btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--primary); border-radius: var(--r-btn); font-weight: 600; font-size: 15px; padding: 15px 30px; cursor: pointer; }
  .btn-secondary:hover { background: var(--primary-softer); }

  /* ============ DIALOG ============ */
  /* No overlay here: it belongs to the loader (D3-94), this sheet lives
     inside the iframe. */
  .dialog { width: min(1080px, 96vw); background: var(--panel); border-radius: 6px; overflow: clip; box-shadow: 0 30px 90px rgba(30, 20, 25, .45); animation: pop .28s cubic-bezier(.21,.8,.35,1); }
  @keyframes pop { from { opacity: 0; transform: translateY(22px) scale(.985); } to { opacity: 1; transform: none; } }

  /* 30.07.2026: the header scrolls with the content (not sticky).
     To make it sticky again: position: sticky; top: 0; */
  .dlg-head { position: relative; z-index: 10; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .dlg-head .row { display: flex; align-items: center; gap: 18px; padding: 14px 26px 12px; }
  .dlg-head img.logo { height: 26px; }
  .dlg-head .fallback-logo { font-weight: 800; font-size: 20px; color: var(--ink-strong); }
  .dlg-head .fallback-logo b { color: var(--primary); }
  .dlg-head .ttl { font-size: 16px; font-weight: 700; color: var(--ink-strong); white-space: nowrap; }
  .dlg-head .close { margin-left: auto; border: 1px solid var(--line); background: #fff; width: 34px; height: 34px; border-radius: var(--r-btn); font-size: 15px; cursor: pointer; color: var(--muted); transition: all .15s; flex: none; }
  .dlg-head .close:hover { border-color: var(--primary); color: var(--primary); }
  .who { display: none; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ok); background: var(--ok-soft); border-radius: var(--r-btn); padding: 6px 10px; white-space: nowrap; }
  .who.show { display: flex; }
  .who .logout { border: none; background: none; color: var(--muted); font-size: 11px; font-weight: 700; text-decoration: underline; cursor: pointer; }
  /* D3-102: off while an order is being sent or its outcome is unknown. */
  .who .logout:disabled { cursor: not-allowed; opacity: .5; }

  /* stepper (2 stages) */
  .stepper { display: flex; align-items: center; gap: 10px; margin-left: 14px; }
  .stepper.hide { display: none; }
  .step-tab { display: flex; align-items: center; gap: 8px; border: none; background: none; cursor: default; padding: 4px 2px; }
  .step-tab .sn { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; transition: all .2s; }
  .step-tab .sl { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
  .step-tab.active .sn { border-color: var(--primary); background: var(--primary); color: #fff; }
  .step-tab.active .sl { color: var(--ink-strong); }
  .step-tab.done { cursor: pointer; }
  .step-tab.done .sn { border-color: var(--ok); background: var(--ok); color: #fff; }
  .step-sep { width: 34px; height: 2px; background: var(--line); }
  .step-sep.done { background: var(--ok); }
  .progress { height: 3px; background: var(--line); }
  .progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--primary-dark)); transition: width .35s ease; }

  /* ============ GATE: login | register ============ */
  .gate { display: none; }
  .gate.show { display: block; }
  .gate-grid { display: grid; grid-template-columns: 1fr 1fr; }
  .gate-col { padding: 34px 34px 38px; }
  .gate-col.login { background: #fff; }
  .gate-col.reg { background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 92%); color: #fff; position: relative; overflow: hidden; }
  .gate-col.reg::before { content: ""; position: absolute; width: 320px; height: 320px; border-radius: 50%; background: rgba(255,255,255,.07); top: -140px; right: -110px; }
  .gate-eyebrow { font-size: 10.5px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--primary); }
  .gate-col.reg .gate-eyebrow { color: rgba(255,255,255,.75); }
  .gate-col h2 { margin-top: 10px; font-size: 22px; font-weight: 800; line-height: 1.25; color: var(--ink-strong); letter-spacing: -.2px; }
  .gate-col.reg h2 { color: #fff; }
  .gate-col .lede { margin-top: 10px; font-size: 13px; line-height: 1.65; color: var(--muted); }
  .gate-col.reg .lede { color: rgba(255,255,255,.85); }
  .gate-form { margin-top: 22px; display: flex; flex-direction: column; gap: 12px; }
  .gate-form .btn-primary { width: 100%; padding: 14px; font-size: 14.5px; }
  .gate-links { margin-top: 14px; display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }
  .gate-links button { border: none; background: none; color: var(--primary); font-weight: 600; cursor: pointer; padding: 0; }
  .gate-links button:hover { text-decoration: underline; }
  .gate-benefits { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; position: relative; }
  .gate-benefits .b { display: flex; gap: 11px; align-items: flex-start; font-size: 13px; line-height: 1.55; color: rgba(255,255,255,.92); }
  .gate-benefits .b i { flex: none; width: 20px; height: 20px; border-radius: 50%; background: rgba(255,255,255,.18); display: flex; align-items: center; justify-content: center; font-size: 11px; font-style: normal; font-weight: 700; margin-top: 1px; }
  .gate-cta { position: relative; margin-top: 26px; width: 100%; background: #fff; color: var(--primary-dark); border: none; border-radius: var(--r-btn); font-weight: 700; font-size: 14.5px; padding: 15px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
  .gate-cta:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0,0,0,.25); }
  .gate-fine { position: relative; margin-top: 12px; font-size: 11px; text-align: center; color: rgba(255,255,255,.7); line-height: 1.5; }
  .gate-col.login .demo-hint { margin-top: 18px; font-size: 11px; color: var(--muted); background: var(--panel); border: 1px dashed var(--line); border-radius: var(--r-card); padding: 9px 11px; line-height: 1.5; }
  .gate-session-note { padding: 10px 0 0; font-size: 11px; text-align: center; color: var(--muted); }

  /* two-column layout inside each step */
  .dlg-body { display: grid; grid-template-columns: 1.12fr .88fr; gap: 20px; padding: 24px 26px 30px; align-items: start; }
  /* both columns scroll together with the dialog - no sticky right rail */
  .col-right { display: flex; flex-direction: column; gap: 14px; }
  .col-left { display: flex; flex-direction: column; gap: 14px; }
  .step { display: none; }
  .step.active { display: grid; animation: stepin .3s ease; }
  @keyframes stepin { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }

  .card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); padding: 20px; box-shadow: 0 1px 3px rgba(78,76,76,.05); }
  .sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
  .sec-no { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--primary); color: var(--primary); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; transition: all .25s; }
  .sec-no.done { background: var(--primary); color: #fff; }
  .sec-title { font-weight: 700; font-size: 14px; color: var(--ink-strong); letter-spacing: .2px; }
  .sec-opt { margin-left: auto; font-size: 11px; color: var(--muted); }

  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
  .grid-2 .full { grid-column: 1 / -1; }

  label.fld { display: block; }
  label.fld .lab { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
  label.fld .lab .req { color: var(--primary); }
  input[type=text], input[type=tel], input[type=email], input[type=password], input[type=date], input[type=search], textarea, select {
    width: 100%; font: inherit; font-size: 14px; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: var(--r-card); background: #fff; color: var(--ink-strong); outline: none; transition: border .15s, box-shadow .15s;
  }
  input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(172,34,85,.10); }
  .fld.invalid input, .fld.invalid textarea { border-color: var(--err); }
  .fld .msg { display: none; font-size: 11.5px; color: var(--err); margin-top: 4px; }
  .fld.invalid .msg { display: block; }
  .fld .note { font-size: 11px; color: var(--muted); margin-top: 4px; }
  textarea { min-height: 74px; resize: vertical; }

  /* password strength */
  .pw-wrap { position: relative; }
  .pw-wrap input { padding-right: 54px !important; }
  .pw-eye { position: absolute; right: 8px; top: 8px; border: none; background: none; color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer; padding: 4px 6px; }
  .pw-eye:hover { color: var(--primary); }
  .pw-meter { display: flex; gap: 4px; margin-top: 7px; }
  .pw-meter i { flex: 1; height: 3px; border-radius: 999px; background: var(--line); transition: background .2s; }
  .pw-meter.s1 i:nth-child(1) { background: var(--err); }
  .pw-meter.s2 i:nth-child(-n+2) { background: var(--warn); }
  .pw-meter.s3 i:nth-child(-n+3) { background: #2E9E6B; }
  .pw-meter.s4 i { background: var(--ok); }
  .pw-hint { font-size: 11px; color: var(--muted); margin-top: 5px; line-height: 1.5; }
  .pw-hint b { color: var(--ink-strong); font-weight: 700; }
  .match-ok { font-size: 11.5px; font-weight: 600; color: var(--ok); margin-top: 4px; display: none; }
  .match-ok.show { display: block; }

  /* patient: initials only, no way to type a surname */
  .initials { display: flex; align-items: center; gap: 6px; }
  .initials input { width: 52px !important; text-align: center; font-size: 20px !important; font-weight: 800; letter-spacing: 0; padding: 8px 4px !important; text-transform: uppercase; }
  .initials .dot { font-size: 20px; font-weight: 800; color: var(--ink-strong); line-height: 1; margin-top: 4px; }
  .initials .init-hint { font-size: 11.5px; color: var(--muted); margin-left: 8px; }
  .initials .init-hint.ok { color: var(--ok); font-weight: 700; }

  .worktype { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .worktype button { text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: var(--r-card); padding: 13px 14px; cursor: pointer; transition: all .15s; }
  .worktype button .wt-name { font-weight: 700; font-size: 13.5px; color: var(--ink-strong); display: block; }
  .worktype button .wt-sub { font-size: 11.5px; color: var(--muted); display: block; margin-top: 3px; }
  .worktype button.active { border-color: var(--primary); background: var(--primary-softer); box-shadow: 0 0 0 3px rgba(172,34,85,.08); }
  .worktype button.active .wt-sub { color: var(--primary); font-weight: 600; }

  .items { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
  .items:empty { display: none; }
  .items-notice { display: none; background: var(--primary-softer); color: var(--ink-strong); font-size: 12px; border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: var(--r-card); padding: 8px 12px; margin-bottom: 10px; }
  .items-notice.show { display: block; }
  .items-empty { border: 1.5px dashed var(--line); border-radius: var(--r-card); background: var(--panel); padding: 22px 18px; text-align: center; margin-bottom: 12px; }
  .items-empty .ie1 { font-size: 13px; font-weight: 700; color: var(--ink-strong); }
  .items-empty .ie2 { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.55; }
  .items-empty .ie-btn { margin-top: 12px; border: 1px solid var(--primary); background: #fff; color: var(--primary); border-radius: var(--r-btn); font-size: 12.5px; font-weight: 700; padding: 9px 18px; cursor: pointer; }
  .items-empty .ie-btn:hover { background: var(--primary-softer); }
  .item { border: 1.5px solid var(--line); border-radius: var(--r-card); background: #fff; padding: 12px 14px; transition: border .15s; }
  .item:hover { border-color: #D8CCD1; }
  .item .top { display: flex; align-items: center; gap: 12px; }
  .item .nm { flex: 1; font-size: 13.5px; font-weight: 600; color: var(--ink-strong); }
  .item .pr { font-size: 13.5px; font-weight: 700; color: var(--ink-strong); white-space: nowrap; }
  .item .qty { display: flex; align-items: center; gap: 7px; }
  .item .qty button { width: 26px; height: 26px; border-radius: var(--r-btn); border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 14px; line-height: 1; color: var(--ink); }
  .item .qty button:hover { border-color: var(--primary); color: var(--primary); }
  .item .qty span { min-width: 20px; text-align: center; font-size: 13px; font-weight: 700; }
  .item .rm { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 15px; padding: 2px 4px; }
  .item .rm:hover { color: var(--err); }
  .item .teeth-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
  .teeth-btn { border: 1px dashed var(--primary); color: var(--primary); background: #fff; border-radius: var(--r-btn); font-size: 11px; font-weight: 600; padding: 4px 10px; cursor: pointer; }
  .teeth-btn:hover { background: var(--primary-softer); }
  .tooth-chip { background: var(--primary-soft); color: var(--primary-dark); font-size: 11px; font-weight: 700; border-radius: var(--r-btn); padding: 3px 8px; }

  .prod-add { position: relative; }
  .prod-search { padding-left: 38px !important; }
  .prod-add .icon { position: absolute; left: 13px; top: 12px; color: var(--muted); font-size: 15px; pointer-events: none; }
  .prod-pop { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow); max-height: 300px; overflow-y: auto; z-index: 20; display: none; }
  .prod-pop.open { display: block; }
  .prod-pop .cat { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); padding: 10px 14px 4px; }
  .prod-pop .prod { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; font-size: 13.5px; cursor: pointer; }
  .prod-pop .prod:hover { background: var(--primary-softer); }
  .prod-pop .prod b { font-weight: 700; white-space: nowrap; color: var(--ink-strong); }
  .prod-pop .empty { padding: 16px 14px; font-size: 12.5px; color: var(--muted); }
  .prod-pop .prod mark { background: var(--primary-soft); color: var(--primary-dark); border-radius: 2px; padding: 0 1px; }

  .addons-lab { font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }
  .addons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .addon { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1.5px solid var(--line); border-radius: var(--r-card); padding: 10px 12px; background: #fff; cursor: pointer; transition: all .15s; }
  .addon .left { display: flex; align-items: center; gap: 9px; min-width: 0; }
  .addon .plus { width: 20px; height: 20px; border-radius: var(--r-btn); border: 1.5px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); flex: none; transition: all .15s; }
  .addon .anm { font-size: 12.5px; font-weight: 600; color: var(--ink-strong); }
  .addon .apr { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
  .addon.on { border-color: var(--primary); background: var(--primary-softer); }
  .addon.on .plus { background: var(--primary); border-color: var(--primary); color: #fff; }
  .addon.on .apr { color: var(--primary); }

  .shade-note { display: flex; gap: 12px; margin-top: 14px; }
  .shade-note .fld { flex: 1; }

  .modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .mode { border: 1.5px solid var(--line); background: #fff; border-radius: var(--r-card); padding: 12px 6px; text-align: center; cursor: pointer; transition: all .15s; }
  .mode:hover { border-color: #D8CCD1; }
  .mode .mn { font-size: 12.5px; font-weight: 700; color: var(--ink-strong); display: block; line-height: 1.2; }
  .mode .ms { font-size: 10px; font-weight: 600; color: var(--muted); display: block; margin-top: 2px; letter-spacing: .3px; }
  .mode.active .ms { color: var(--primary); }
  .mode .mp { font-size: 14.5px; font-weight: 800; color: var(--ink-strong); display: block; margin-top: 5px; }
  .mode .mt { display: inline-block; margin-top: 6px; font-size: 9.5px; font-weight: 700; padding: 2px 8px; border-radius: var(--r-btn); background: #F1F3F4; color: var(--muted); letter-spacing: .5px; }
  .mode.active { border-color: var(--primary); background: var(--primary-softer); box-shadow: 0 0 0 3px rgba(172,34,85,.08); }
  .mode.active .mt { background: var(--primary); color: #fff; }

  .drop { border: 1.5px dashed #CBB7C0; border-radius: var(--r-card); background: #fff; padding: 20px 14px; text-align: center; cursor: pointer; transition: all .15s; }
  .drop.locked { opacity: .45; pointer-events: none; }
  .drop.drag, .drop:hover { border-color: var(--primary); background: var(--primary-softer); }
  .drop .d1 { font-size: 13px; font-weight: 700; color: var(--ink-strong); }
  .drop .d2 { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
  .files { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
  .file { border: 1px solid var(--line); border-radius: var(--r-card); background: #fff; padding: 9px 12px; }
  .file .row { display: flex; align-items: center; gap: 10px; }
  .file .fnm { flex: 1; font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-strong); }
  .file .fsz { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
  .file .frm { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 13px; }
  .file .bar { height: 3px; background: #F1F3F4; border-radius: 999px; margin-top: 7px; overflow: hidden; }
  .file .bar i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }
  .file.done .bar i { background: var(--ok); }
  .file.failed, .file.rejected { border-color: var(--err); }
  .file.failed .bar i, .file.rejected .bar i { background: var(--err); }
  .file .fretry { border: 1px solid var(--primary); background: #fff; color: var(--primary); border-radius: var(--r-btn); font-size: 11px; font-weight: 700; padding: 3px 10px; cursor: pointer; }
  .file .fretry:hover { background: var(--primary-softer); }
  .file .fmsg { font-size: 11px; color: var(--err); margin-top: 6px; line-height: 1.4; }
  .files-note { margin-top: 8px; font-size: 11.5px; color: var(--err); white-space: pre-line; }
  .fld.invalid .drop { border-color: var(--err); }

  .consent { display: flex; gap: 10px; align-items: flex-start; font-size: 11px; color: var(--muted); line-height: 1.55; }
  .consent input { margin-top: 2px; width: 15px; height: 15px; accent-color: var(--primary); flex: none; }
  .consent.invalid { color: var(--err); }
  .consent + .consent { margin-top: 12px; }

  /* account recap card (D3-98, prototype lines 636-641) */
  .recap-info { font-size: 13px; line-height: 1.7; }
  .recap-info b { color: var(--ink-strong); }
  .recap-info .muted { color: var(--muted); }
  .edit-account { margin-top: 12px; background: none; border: none; color: var(--primary); font-size: 12px; font-weight: 700; cursor: pointer; padding: 0; }
  .edit-account:hover { text-decoration: underline; }

  .summary { border: none; background: linear-gradient(150deg, var(--primary) 0%, var(--primary-dark) 90%); color: #fff; }
  .summary .s-title { font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; opacity: .8; }
  .summary .lines { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
  .summary .lines .l { display: flex; justify-content: space-between; gap: 12px; opacity: .92; }
  .summary .lines .l b { font-weight: 600; white-space: nowrap; }
  .summary .tot { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid rgba(255,255,255,.25); margin-top: 12px; padding-top: 12px; }
  .summary .tot .t1 { font-size: 12px; font-weight: 600; opacity: .85; }
  .summary .tot .t2 { font-size: 24px; font-weight: 800; transition: transform .2s; }
  .summary .tot .t2.pulse { transform: scale(1.06); }
  .summary .tot .t2 small { font-size: 11px; font-weight: 500; opacity: .8; }
  /* `.hide` alone loses to the `display: flex` of `.lines` and `.tot` above. */
  .summary .hide { display: none; }
  .summary .submit { width: 100%; margin-top: 16px; background: #fff; color: var(--primary-dark); border: none; border-radius: var(--r-btn); font-weight: 700; font-size: 14.5px; padding: 14px; cursor: pointer; transition: transform .15s, box-shadow .15s; }
  .summary .submit:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0,0,0,.25); }
  .summary .submit:disabled { opacity: .7; cursor: wait; transform: none; }
  .summary .sla { margin-top: 10px; font-size: 10.5px; text-align: center; opacity: .75; }
  .summary .checks { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
  .summary .checks .c { display: flex; gap: 9px; align-items: center; opacity: .55; transition: opacity .2s; }
  .summary .checks .c.on { opacity: 1; }
  .summary .checks .c i { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.5); display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 10px; font-weight: 700; }
  .summary .checks .c.on i { background: #fff; border-color: #fff; color: var(--primary-dark); }
  .back-link { margin-top: 12px; width: 100%; background: none; border: none; color: #fff; font-size: 12px; font-weight: 600; opacity: .85; cursor: pointer; text-align: center; }
  .back-link:hover { opacity: 1; text-decoration: underline; }

  .banner-err { display: none; background: #FDECEA; color: var(--err); font-size: 12.5px; border: 1px solid #F5C6C0; border-radius: var(--r-card); padding: 10px 14px; }
  .banner-err.show { display: block; }
  .banner-ok { background: var(--ok-soft); color: var(--ok); font-size: 12.5px; font-weight: 600; border: 1px solid #C6E6D5; border-radius: var(--r-card); padding: 10px 14px; }
  /* DEC-40, not in the prototype: account waiting for 3Z's approval. */
  .account-pending { display: none; margin: 20px 26px 0; background: var(--primary-softer); color: var(--ink-strong); font-size: 12.5px; border: 1px solid var(--line); border-radius: var(--r-card); padding: 10px 14px; }
  .account-pending.show { display: block; }

  /* tooth picker modal */
  .tooth-mask { position: fixed; inset: 0; background: rgba(46,44,44,.5); display: none; z-index: 300; align-items: center; justify-content: center; padding: 20px; }
  .tooth-mask.open { display: flex; }
  .tooth-modal { background: #fff; border-radius: 6px; box-shadow: var(--shadow); width: min(560px, 94vw); padding: 24px; animation: pop .2s ease-out; }
  .tooth-modal h3 { font-size: 15px; font-weight: 700; color: var(--ink-strong); }
  .tooth-modal .tm-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
  .arch { margin-top: 18px; }
  .arch .arch-lab { font-size: 10px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
  .arch .teeth { display: grid; grid-template-columns: repeat(16, 1fr); gap: 4px; }
  .tooth { border: 1.5px solid var(--line); border-radius: var(--r-btn); background: #fff; font-size: 11px; font-weight: 700; color: var(--ink); padding: 8px 0; text-align: center; cursor: pointer; transition: all .12s; }
  .tooth:hover { border-color: var(--primary); color: var(--primary); }
  .tooth.on { background: var(--primary); border-color: var(--primary); color: #fff; }
  /* D3-143: the role letter comes from data-role, beside the number so a row keeps its height. */
  .tooth-roles { display: flex; gap: 6px; margin-top: 14px; }
  .tooth-roles button { border: 1.5px solid var(--line); background: #fff; border-radius: var(--r-btn); font-size: 12px; font-weight: 700; color: var(--ink); padding: 6px 14px; cursor: pointer; }
  .tooth-roles button.active { border-color: var(--primary); background: var(--primary-softer); color: var(--primary); }
  .tooth[data-role]::after { font-size: 9px; margin-left: 1px; }
  .tooth[data-role="CROWN"]::after { content: 'K'; }
  .tooth[data-role="PONTIC"]::after { content: 'P'; }
  .tooth[data-role="ABUTMENT"]::after { content: 'Ł'; }
  .tooth-modal .tm-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

  /* success */
  .success { display: none; padding: 60px 40px 50px; text-align: center; }
  .success.show { display: block; }
  .success .chk { width: 70px; height: 70px; margin: 0 auto 20px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); font-size: 30px; display: flex; align-items: center; justify-content: center; animation: pop .3s ease-out; }
  .success h2 { font-size: 24px; font-weight: 800; color: var(--ink-strong); }
  .success .ordno { display: inline-block; margin-top: 14px; font-size: 16px; font-weight: 800; background: var(--primary-soft); color: var(--primary-dark); padding: 9px 24px; border-radius: var(--r-btn); letter-spacing: 1px; }
  .success p { margin-top: 16px; font-size: 13.5px; color: var(--muted); line-height: 1.7; }
  .success .recap { margin: 26px auto 0; max-width: 480px; text-align: left; background: #fff; border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px 20px; font-size: 13px; }
  .success .recap .r { display: flex; justify-content: space-between; gap: 14px; padding: 5px 0; }
  .success .recap .r b { text-align: right; color: var(--ink-strong); }

  /* ============ Not in the prototype ============ */

  /* In the prototype the overlay centres and scrolls the dialog. Inside the
     iframe the body takes that role; the background is transparent because
     the host page (loader, D3-94) draws the dimming. */
  body {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 24px;
    background: transparent;
  }

  /* Notice screen: service mode and error page. Layout copied from `.success`. */
  .notice { padding: 60px 40px 50px; text-align: center; }
  .notice h2 { font-size: 24px; font-weight: 800; color: var(--ink-strong); }
  .notice p { margin-top: 16px; font-size: 13.5px; color: var(--muted); line-height: 1.7; }

  /* Phone verification (D3-96): the prototype's `style=""` attributes on
     this card, same values as classes — the CSP blocks inline styles. */
  .fld-row { display: flex; gap: 8px; }
  .fld-row input { flex: 1; }
  .fld-row .btn-primary, .fld-row .btn-secondary { padding: 11px 16px; font-size: 12.5px; white-space: nowrap; }
  .fld-code { margin-top: 10px; }
  .fld-code input { letter-spacing: 4px; }
  /* Not in the prototype (which only prints "✓ Numer zweryfikowany: X" as
     text): a small success banner reads clearer than a bare line. */
  .v-ok {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--ok-soft);
    border: 1px solid var(--ok);
    border-radius: var(--r-card);
  }
  /* `display: flex` above beats the browser's own `[hidden]{display:none}`
     rule (same specificity, author sheet loads later) — restore it. */
  .v-ok[hidden] { display: none; }
  .v-ok-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--ok);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
  }
  .v-ok-body { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
  .v-ok-body strong { display: block; margin-top: 2px; font-size: 14.5px; font-weight: 700; letter-spacing: normal; text-transform: none; color: var(--ink-strong); }
  /* Disabled while a request is in flight (D3-96): the prototype has no such
     state, so its buttons/inputs never needed one. */
  .fld-row input:disabled { background: var(--panel); color: var(--muted); cursor: not-allowed; }
  .btn-primary:disabled, .btn-secondary:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; transform: none; }
  .btn-primary:disabled:hover { background: var(--primary); }
  .btn-secondary:disabled:hover { background: #fff; }
  /* The SMS fields are divs (a label may not hold a button), so the
     prototype's `label.fld .lab` misses their captions and renders them as
     plain 15 px text, unlike every other field. Same look as the others. */
  div.fld .lab { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
  div.fld .lab .req { color: var(--primary); }

  /* Generic show/hide toggle (D3-99: the work-type card and its scope field
     start hidden server-side, without a `style=""` attribute — the CSP
     blocks those). */
  .hide { display: none; }
  /* `.hide` alone loses to `label.fld { display: block; }` above (the scope and shade fields). */
  label.fld.hide { display: none; }

  /* Not in the prototype (DEC-36): a logged-in clinic whose number is not
     verified yet sees its account data blurred and out of reach (`inert`,
     set by auth.js); only the SMS card stays live. */
  .grid-2 { transition: filter .2s, opacity .2s; }
  .grid-2.account-locked { filter: blur(3px); opacity: .55; pointer-events: none; user-select: none; }

  /* The prototype's `.summary .submit:disabled` shows a `wait` cursor — right
     for its submit button while an order is being sent, wrong for step 1's
     "Dalej", which is disabled because a condition is not met yet. Same
     "not allowed" look as the other disabled buttons, and no hover lift. */
  #nextBtn:disabled { cursor: not-allowed; }
  #nextBtn:disabled:hover { box-shadow: none; transform: none; }

  /* D3-102: why a send failed, under the submit button of the dark summary
     card (the prototype's send never fails); the confirmation screen's
     button row (the prototype's inline `style=""`, blocked by the CSP) and
     its portal link (corrections 05 §3: the portal sentence is a link). */
  .summary .submit-msg { margin-top: 10px; background: #fff; color: var(--err); font-size: 12px; line-height: 1.5; border-radius: var(--r-btn); padding: 8px 10px; }
  .success-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 30px; }
  .success .portal-link { color: var(--primary); font-weight: 700; }

  /* Not in the prototype: the tooth picker's cross (DEC-26-krzyż, feedback
     szefa 27.08 — `zrodla/feedback-szef-2026-08-27-fdi-krzyz.png`). The
     prototype's own `.arch .teeth` grid (form.css above, copied unchanged)
     already lines the 16 teeth up in anatomical order; `.arch-cross` (a
     wrapper `templates/form.php` adds around the two `.arch` blocks, not in
     the prototype) draws ONE continuous vertical line and ONE continuous
     horizontal line over it, so they read as a single crossing "+", not as
     four separate short borders that stop at each row's edge.
     The vertical line sits at `left: 50%` rather than being pinned to any
     particular button: `.teeth` is a 16-column grid of equal-width tracks,
     so the midpoint between column 8 and column 9 (11|21 upper, 41|31
     lower) is mathematically the exact horizontal center of the grid,
     whatever the actual column width renders as. The horizontal line is
     `.arch + .arch`'s existing top border/padding — its width already
     matches the grid's (arches carry no side padding of their own), it
     only needed the vertical line to actually meet it. */
  #f-scope { margin-top: 12px; }
  /* Imperial: the scope is the whole description of the work. */
  #f-scope.large textarea { min-height: 160px; }
  .arch-cross { position: relative; }
  .arch-cross::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    margin-left: -1px;
    background: var(--ink-strong);
    pointer-events: none;
  }
  .arch + .arch { border-top: 2px solid var(--ink-strong); padding-top: 14px; }

  @media (max-width: 900px) {
    .dlg-body { grid-template-columns: 1fr; }
    .col-right { position: static; }
    .grid-2 { grid-template-columns: 1fr; }
    .addons { grid-template-columns: 1fr; }
    .stepper .sl { display: none; }
    .gate-grid { grid-template-columns: 1fr; }
    /* Not in the prototype (spec §11): the dialog fills the whole iframe.
       Only this sheet can do it — the host page cannot style the iframe's content. */
    body { padding: 0; }
    .dialog { width: 100%; min-height: 100vh; border-radius: 0; }
    /* Not in the prototype (D3-94): on a phone the header row is wider than
       the screen and pushed the close button out of view. The title gives way. */
    .dlg-head .row { gap: 10px; padding: 12px 14px 10px; }
    .dlg-head .ttl { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
    .stepper { margin-left: 0; }
    /* Not in the prototype: a long e-mail pushed "wyloguj" out of view the
       same way. The e-mail gives way, the button stays. */
    .who { min-width: 0; }
    .who > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
    .who .logout { flex: none; }
  }
