:root{
  --bg:#07080b;
  --bg2:#0b0d12;

  --panel:#121521;
  --panel2:#171b2b;

  --text:rgba(255,255,255,.93);
  --muted:rgba(255,255,255,.68);

  --stroke:rgba(255,255,255,.12);
  --stroke2:rgba(255,255,255,.18);

  --accent:#58d7ff;

  --best:#ff63c8;
  --bestBg:rgba(255,99,200,.12);
  --bestStroke:rgba(255,99,200,.30);

  --danger:#ff5a6b;
  --dangerBg:rgba(255,90,107,.14);

  --radius:16px;
  --safeTop: env(safe-area-inset-top, 0px);
  --safeBottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="light"]{
  --bg:#f6f7fb;
  --bg2:#eef1f8;

  --panel:#fff;
  --panel2:#f2f5fb;

  --text:rgba(0,0,0,.90);
  --muted:rgba(0,0,0,.56);

  --stroke:rgba(0,0,0,.10);
  --stroke2:rgba(0,0,0,.16);

  --accent:#0b5cff;

  --best:#d633a6;
  --bestBg:rgba(214,51,166,.10);
  --bestStroke:rgba(214,51,166,.24);

  --danger:#d64545;
  --dangerBg:rgba(214,69,69,.10);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:
    radial-gradient(900px 420px at 50% -160px, rgba(88,215,255,.18), transparent 60%),
    radial-gradient(800px 420px at 10% 10%, rgba(139,92,255,.14), transparent 55%),
    linear-gradient(180deg, var(--bg2), var(--bg));
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Display","SF Pro Text",Segoe UI,Roboto,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  padding-top:var(--safeTop);
  padding-bottom:calc(16px + var(--safeBottom));
}

.wrap{max-width:560px;margin:0 auto;padding:16px 14px}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}
.brand h1{margin:0;font-size:16px;letter-spacing:.2px;font-weight:900}

.card{
  background:var(--panel);
  border:1px solid var(--stroke2);
  border-radius:var(--radius);
  padding:14px;
  box-shadow:0 10px 24px rgba(0,0,0,.22);
}

.stepper{display:flex;align-items:center;gap:8px;margin:10px 0 12px}
.dot{width:10px;height:10px;border-radius:999px;border:1px solid var(--stroke2);background:transparent}
.dot.active{background:var(--accent);border-color:rgba(88,215,255,.75)}
.dot.done{background:rgba(34,197,94,.95);border-color:rgba(34,197,94,.65)}

h2{margin:0 0 10px;font-size:18px;font-weight:950;letter-spacing:.1px}
.muted{color:var(--muted);font-size:13px;line-height:1.35;margin:0 0 12px}
.grid{display:grid;gap:10px}

.choice{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:12px;border-radius:14px;background:var(--panel2);
  border:1px solid var(--stroke);cursor:pointer;user-select:none;
  transition:border-color .12s ease, transform .05s ease, background .12s ease;
}
.choice:active{transform:scale(.995)}
.choice.selected{
  border-color:rgba(88,215,255,.60);
  background:linear-gradient(180deg, rgba(88,215,255,.12), rgba(255,255,255,.02));
}
.choice.disabled{opacity:.55;cursor:not-allowed}

.left{display:grid;gap:6px;min-width:0;flex:1 1 auto}
.title{font-size:14px;font-weight:950;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.desc{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

.radio{
  width:22px;height:22px;border-radius:999px;
  border:1.5px solid rgba(255,255,255,.28);
  display:grid;place-items:center;flex:0 0 auto;background:transparent;
}
[data-theme="light"] .radio{border-color:rgba(0,0,0,.22)}
.radio .inner{width:12px;height:12px;border-radius:999px;background:transparent}
.choice.selected .radio{border-color:rgba(88,215,255,.85)}
.choice.selected .radio .inner{background:var(--accent)}

/* Theme toggle */
.themeToggle{
  display:inline-flex;align-items:center;gap:10px;
  border:1px solid var(--stroke2);background:rgba(255,255,255,.02);
  border-radius:999px;padding:8px 10px;cursor:pointer;user-select:none;
}
.themeToggle span{font-size:12px;color:var(--muted);font-weight:950}
.switch{
  width:44px;height:24px;border-radius:999px;border:1px solid var(--stroke2);
  background:rgba(255,255,255,.03);position:relative;flex:0 0 auto;
}
.knob{
  width:18px;height:18px;border-radius:999px;background:var(--accent);
  position:absolute;top:50%;transform:translateY(-50%);left:3px;transition:left .18s ease;
  box-shadow:0 6px 16px rgba(0,0,0,.25);
}
[data-theme="light"] .knob{left:22px}

/* Qty */
.qty{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;border:1px solid var(--stroke2);
  background:rgba(255,255,255,.03);border-radius:999px;padding:6px 8px;
}
.qty .lbl{
  font-size:12px;font-weight:1000;padding:5px 10px;border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  letter-spacing:.2px;user-select:none;
}
.qty.main .lbl{
  color:var(--accent);
  background:rgba(88,215,255,.12);
  border-color:rgba(88,215,255,.22);
}
.qty.swap .lbl{
  color:var(--best);
  background:var(--bestBg);
  border-color:var(--bestStroke);
}
.qty button{
  border:0;background:rgba(255,255,255,.10);color:var(--text);
  width:32px;height:32px;border-radius:999px;cursor:pointer;
  font-weight:950;font-size:16px;line-height:1;
  display:flex;align-items:center;justify-content:center;
}
.qty button:active{transform:scale(.98)}
.qty span{min-width:22px;text-align:center;font-size:14px;color:var(--text);font-weight:1000}

/* Checkbox */
.check{
  display:inline-flex;align-items:center;gap:10px;cursor:pointer;user-select:none;
  color:var(--muted);font-size:13px;font-weight:950;
}
.anonCheck{margin-top:6px}
.addrManagerCheck{margin-top:8px}
.box{
  width:20px;height:20px;border-radius:6px;border:1.5px solid rgba(255,255,255,.28);
  display:grid;place-items:center;background:transparent;flex:0 0 auto;
}
[data-theme="light"] .box{border-color:rgba(0,0,0,.22)}
.box svg{opacity:0}
.check.checked .box{border-color:rgba(88,215,255,.85);background:rgba(88,215,255,.12)}
.check.checked .box svg{opacity:1}

.pillDanger{
  color:var(--danger);
  background:var(--dangerBg);
  border:1px solid rgba(255,255,255,.10);
  padding:4px 8px;border-radius:999px;font-size:12px;font-weight:1000;
  white-space:nowrap;
}

/* Summary */
.summary{
  margin-top:12px;padding:12px;border-radius:14px;border:1px solid var(--stroke2);
  background:rgba(255,255,255,.02);
  display:grid;gap:12px;
  font-size:13px;
  color:var(--text);
}
.sumSection{display:grid;gap:8px}
.sumTitle{font-weight:1000;letter-spacing:.2px}
.sumGrid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.sumItem{display:flex;justify-content:space-between;gap:8px}
.sumLabel{color:var(--muted);font-size:12px}
.sumValue{font-weight:900}
.sumRow{display:flex;align-items:baseline;justify-content:space-between;gap:12px}
.sumPrice{font-weight:1000;white-space:nowrap}
.sumPrice.accent{color:var(--accent)}
.sumPrice.delivery{color:var(--danger)}
.sumEmpty{color:var(--muted)}
.sumTotal{display:flex;align-items:baseline;justify-content:space-between;font-size:14px;font-weight:1000;border-top:1px solid var(--stroke);padding-top:10px}

/* Inputs */
.field{display:grid;gap:6px;margin-top:10px}
label{font-size:12px;color:var(--muted);font-weight:950}
input,select{
  width:100%;border-radius:12px;border:1px solid var(--stroke2);
  background:rgba(255,255,255,.02);padding:12px 12px;font-size:15px;
  color:var(--text);outline:none;
}
input::placeholder{color:rgba(140,140,140,.9)}
input:focus,select:focus{border-color:rgba(88,215,255,.55)}
.timeGrid{display:grid;grid-template-columns:1.2fr 1fr 1fr;gap:10px;margin-top:10px}
.timeGrid select{
  min-height:44px;
  line-height:1.2;
  font-size:16px;
}
.addrGrid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:8px}
.addrGrid .field{margin-top:0}
.addrGrid .full{grid-column:1 / -1}

/* Buttons */
.footerActions{margin-top:14px;display:grid;gap:10px}
.btn{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--stroke2);
  border-radius:14px;
  padding:14px 14px;
  font-size:15px;
  font-weight:1000;
  cursor:pointer;
  user-select:none;
  background:rgba(255,255,255,.02);
  color:var(--text);
  text-decoration:none;
  transition:opacity .15s ease, transform .06s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:active{transform:scale(.995)}
.btn.primary{
  background: var(--accent);
  border-color: transparent;
  color:#071018;
  box-shadow: 0 10px 22px rgba(88,215,255,.14);
}
[data-theme="light"] .btn.primary{
  color:#fff;
  box-shadow: 0 10px 22px rgba(11,92,255,.12);
}
.btn.secondary{
  background:rgba(255,255,255,.06);
  border-color:rgba(88,215,255,.35);
  color:var(--text);
}
[data-theme="light"] .btn.secondary{
  background:#eef3ff;
  border-color:rgba(11,92,255,.28);
  color:#1b2b4a;
}
.btn[disabled]{opacity:.55;cursor:not-allowed}
.btn.danger{
  background:#fbe9e9;
  border-color:#f3b1b1;
  color:#7a2222;
}
[data-theme="dark"] .btn.danger{
  background:rgba(255,90,107,.18);
  border-color:rgba(255,90,107,.45);
  color:#ffdede;
}

.error{
  margin-top:10px;padding:12px;border-radius:12px;
  border:1px solid rgba(255,90,107,.42);
  background:var(--dangerBg);
  color:var(--text);font-size:13px;font-weight:950;
}

.tiny{margin-top:10px;color:var(--muted);font-size:12px;line-height:1.4}

/* Payment */
.bestTag{
  display:inline-flex;align-items:center;gap:8px;
  padding:4px 8px;border-radius:999px;
  background:var(--bestBg);
  border:1px solid var(--bestStroke);
  color:var(--best);
  font-size:12px;font-weight:1000;
  margin-left:8px;
  white-space:nowrap;
}
.choice.best{
  border-color:rgba(255,99,200,.26);
  background:linear-gradient(180deg, rgba(255,99,200,.08), rgba(255,255,255,.02));
}
.choice.best.selected{
  border-color:rgba(88,215,255,.60);
  background:linear-gradient(180deg, rgba(88,215,255,.12), rgba(255,255,255,.02));
}
.inlineWarn{
  margin-top:8px;
  color:var(--danger);
  font-size:12px;
  font-weight:950;
}

/* Step 2 rows */
.pRow{
  padding:12px;
  border:1px solid var(--stroke);
  background:var(--panel2);
  border-radius:14px;
  text-align:center;
}
.pTop{
  display:flex;align-items:center;justify-content:center;gap:10px;flex-wrap:wrap;
}
.pName{font-weight:1000;font-size:14px}
.pDot{opacity:.6}
.pWeight{color:var(--muted);font-weight:900}
.pDesc{font-size:12px;color:var(--muted);margin-top:3px}
.pNow{color:var(--accent);font-weight:1000}

.pBottom{
  margin-top:10px;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;
}

/* stack controls so "Zamena" is under "Kol-vo" (when we show it here) */
.pBottomLeft{
  display:flex;
  justify-content:center;
  width:100%;
}

.pLineSum{
  display:flex;align-items:baseline;gap:8px;
  color:var(--muted);font-size:12px;
  white-space:nowrap;
  justify-content:center;
  width:100%;
}
.pLineSum b{color:var(--text)}

/* Divider + swap row (THIS is what you asked) */
.swapRow{
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid var(--stroke);
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  flex-wrap:wrap;
}
.swapLeft{
  display:flex;
  align-items:center;
  gap:10px;
}
.swapLeft.empty{display:none}
.swapRow.swapRow--compact{justify-content:center}
.swapRight{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  flex-wrap:wrap;
  text-align:center;
}

.noteRule{
  margin-top:8px;
  font-size:12px;
  color:var(--muted);
  line-height:1.35;
}

@media (max-width: 420px){
  .sumGrid{grid-template-columns:1fr}
  .addrGrid{grid-template-columns:1fr}
  .pTop{flex-direction:column;align-items:center}
  .pBottom{align-items:center}
  .swapRow{flex-direction:column;align-items:center}
  .swapRight{justify-content:center;text-align:center}
}

.locked{
  padding:16px;
  border-radius:14px;
  border:1px solid var(--stroke2);
  background:rgba(255,255,255,.02);
  display:grid;
  gap:6px;
}
.lockedTitle{font-size:16px;font-weight:1000}
.lockedText{font-size:13px;color:var(--muted)}

/* Payment credentials */
.credBlock{
  margin-top:12px;
  padding:12px;
  border-radius:14px;
  border:1px solid rgba(88,215,255,.45);
  background:linear-gradient(180deg, rgba(88,215,255,.18), rgba(255,255,255,.02));
  display:grid;
  gap:8px;
}
[data-theme="light"] .credBlock{
  border-color:rgba(11,92,255,.38);
  background:rgba(11,92,255,.10);
}
.credTitle{font-size:13px;font-weight:1000;color:var(--text)}
.credRow{
  display:grid;
  grid-template-columns:1fr auto;
  gap:8px;
  align-items:center;
  padding:8px 10px;
  border-radius:12px;
  background:rgba(255,255,255,.03);
  border:1px solid var(--stroke);
}
.credInfo{display:grid;gap:4px}
.credLabel{font-size:11px;color:var(--muted);font-weight:950}
.credValue{font-size:14px;color:var(--text);font-weight:1000;word-break:break-word}
.copyBtn{
  border:1px solid var(--stroke2);
  background:rgba(255,255,255,.04);
  color:var(--text);
  border-radius:10px;
  padding:6px 8px;
  cursor:pointer;
  font-weight:900;
}
.copyBtn:active{transform:scale(.98)}
.copyIcon{font-size:12px;line-height:1}

.payNotice{
  margin-top:12px;
  padding:12px;
  border-radius:12px;
  border:1px solid var(--stroke2);
  background:rgba(255,255,255,.03);
  color:var(--muted);
  font-size:13px;
}

.uploadBox{
  margin-top:12px;
  padding:12px;
  border-radius:12px;
  border:1px solid var(--stroke2);
  background:rgba(255,255,255,.02);
  display:grid;
  gap:8px;
}
.uploadTitle{font-size:13px;font-weight:1000;color:var(--text)}
.uploadDesc{font-size:12px;color:var(--muted)}
.uploadChosen{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  font-size:12px;
  color:var(--muted);
  padding:6px 4px;
  border:1px dashed var(--stroke2);
  border-radius:10px;
}
.fileRemove{
  border:0;
  background:transparent;
  color:var(--danger);
  font-size:16px;
  cursor:pointer;
  line-height:1;
}
.fileRemove:disabled{
  opacity:.45;
  cursor:not-allowed;
}

.btn.disabled{
  opacity:.55;
  cursor:not-allowed;
  pointer-events:none;
}
.uploadInput{
  position:absolute;
  left:-9999px;
  width:1px;
  height:1px;
  opacity:0;
}

.payConfirm{
  margin-top:12px;
  padding:12px;
  border-radius:12px;
  border:1px solid var(--stroke2);
  background:rgba(255,255,255,.03);
  display:grid;
  gap:8px;
}
.payTitle{font-size:13px;font-weight:1000;color:var(--text)}
.paySub{font-size:12px;color:var(--muted)}
.managerBtn{
  background:#16a34a;
  border-color:transparent;
  color:#fff;
  text-decoration:none;
}

.toast{
  position:fixed;
  left:50%;
  bottom:calc(20px + var(--safeBottom));
  transform:translateX(-50%);
  background:rgba(0,0,0,.8);
  color:#fff;
  padding:8px 12px;
  border-radius:999px;
  font-size:12px;
  opacity:0;
  pointer-events:none;
  transition:opacity .18s ease, transform .18s ease;
  z-index:999;
}
.toast.show{
  opacity:1;
  transform:translateX(-50%) translateY(-6px);
}

.debugBar{
  position:sticky;
  top:0;
  z-index:1000;
  width:100%;
  background:rgba(255,255,255,.9);
  color:#111;
  font-size:11px;
  line-height:1.3;
  padding:6px 10px;
  border-bottom:1px solid rgba(0,0,0,.12);
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;
}
[data-theme="dark"] .debugBar{color:#111}
