.pin-overlay { position: absolute; inset: 0; z-index: 80; }
.pin-dim { position: absolute; inset: 0; background: rgba(28,14,4,.62); opacity: 0; transition: opacity .25s ease; }
.pin-overlay.shown .pin-dim { opacity: 1; }
.pin-box {
  position: absolute; left: 50%; top: 34px; bottom: 34px;
  width: min(680px, calc(100% - 32px));
  transform: translateX(-50%);
  background: var(--bg, #f6eedd);
  color: #2b2118;
  box-shadow: 0 2px 3px rgba(0,0,0,.2), 0 40px 60px -16px rgba(20,10,2,.75);
  display: flex; flex-direction: column;
  transition: background-color .25s ease;
  outline: none;
  --pin: #d6343f; --pin-d: #8e1d25;
}
.pin-box.c-none { --bg: #f6eedd; }
.pin-box.step-ok, .pin-box.step-review, .pin-box.step-rejected, .pin-box.step-error, .pin-box.step-paused { background: #f8f0de; }
.pin-pin {
  position: absolute; left: 50%; top: -12px; margin-left: -13px; width: 26px; height: 26px; border-radius: 50%; z-index: 2;
  background: radial-gradient(circle at 34% 30%, rgba(255,255,255,.85) 0 2.5px, var(--pin) 4.5px, var(--pin-d) 100%);
  box-shadow: 2px 6px 5px rgba(0,0,0,.4);
}
.pin-head {
  flex-shrink: 0;
  padding: 18px 16px 14px 28px;
  border-bottom: 1.5px dashed rgba(58,40,24,.25);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.pin-heading { margin: 0; font-family: var(--font-hand); font-size: 28px; font-weight: 700; line-height: 1.1; }
.pin-x {
  width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 22px;
  background: rgba(255,255,255,.4); color: var(--ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.pin-x:hover { background: rgba(255,255,255,.7); }
.pin-body {
  position: relative; flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
  padding: 20px 28px 24px;
  display: flex; flex-direction: column; gap: 18px;
  user-select: text; -webkit-user-select: text;
}
.pin-body::-webkit-scrollbar { width: 8px; }
.pin-body::-webkit-scrollbar-thumb { background: rgba(58,40,24,.25); border-radius: 4px; }
.pin-foot {
  flex-shrink: 0;
  padding: 14px 28px 18px;
  border-top: 1.5px dashed rgba(58,40,24,.25);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.pin-foot:empty { display: none; }

.btn-dark {
  height: 44px; padding: 0 18px; border: 0; border-radius: 6px;
  background: #2b1a0c; color: #fff4e0;
  font-size: 15px; font-weight: 800; cursor: pointer; white-space: nowrap;
}
.btn-dark:hover { background: #45301c; }
.btn-dark.soft { background: rgba(43,26,12,.45); }
.btn-big { height: 50px; padding: 0 22px; font-size: 16px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn-ghost {
  height: 44px; padding: 0 16px; border: 1.5px solid #2b1a0c; border-radius: 6px;
  background: transparent; color: var(--ink); font-size: 14.5px; font-weight: 800; cursor: pointer; white-space: nowrap;
}
.btn-ghost.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn-ghost:hover { background: rgba(255,255,255,.5); }
.btn-link { border: 0; background: none; padding: 0; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }

.pf-field { display: flex; flex-direction: column; gap: 6px; }
.pf-label { font-size: 13.5px; font-weight: 900; }
.pf-big { font-size: 15px; }
.pf-opt { font-weight: 600; color: #6b5a4a; }
.pf-input {
  width: 100%; height: 44px; padding: 0 12px;
  border: 1.5px solid rgba(58,40,24,.35); border-radius: 6px;
  background: #fffdf6; color: var(--ink);
  font-family: var(--font-ui); font-size: 16px;
}
.pf-input:focus { outline: none; border-color: #2b1a0c; box-shadow: 0 0 0 3px rgba(253,224,106,.6); }
.pf-textarea { height: 150px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.invalid .pf-input, .invalid .pf-cats { border-color: #b3261e; }
.invalid .pf-cats { outline: 2px solid #b3261e; outline-offset: 4px; border-radius: 6px; }
.pf-msg { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; line-height: 1.35; }
.pf-msg:empty { display: none; }
.pf-err { color: #b3261e; font-weight: 800; }
.pf-hint { color: #6b4d1a; }
.pf-count { margin-left: auto; color: #6b5a4a; white-space: nowrap; }
.pf-errbanner { padding: 10px 12px; background: #fbe2df; border-left: 4px solid #b3261e; color: #7a1a14; font-weight: 800; font-size: 14px; }
.pf-draft { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; background: rgba(255,255,255,.65); border-radius: 6px; font-weight: 800; }

.pf-cats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pf-cat {
  min-height: 56px; padding: 8px 10px;
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  border: 1.5px solid rgba(58,40,24,.25); border-radius: 6px;
  background: rgba(255,255,255,.55); color: var(--ink); text-align: left; cursor: pointer;
}
.pf-cat .chip-dot { grid-row: span 2; width: 12px; height: 12px; }
.pf-cat-name { font-size: 13px; font-weight: 900; letter-spacing: .05em; }
.pf-cat-hint { font-size: 12px; color: #5a4636; }
.pf-cat.on { border: 2.5px solid #2b1a0c; padding: 7px 9px; background: var(--bg); box-shadow: 0 4px 10px -4px rgba(0,0,0,.35); }

.pf-improve { display: flex; flex-direction: column; gap: 10px; margin-top: -6px; }
.pf-improve-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pf-improve-btn {
  height: 36px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid #2b1a0c; border-radius: 6px; background: rgba(255,255,255,.5);
  font-size: 13.5px; font-weight: 800; cursor: pointer;
}
.pf-improve-note { font-size: 12px; color: #6b5a4a; }
.pf-improve-msg { margin: 0; font-size: 13px; font-weight: 700; color: #5a4636; }
.pf-cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pf-cmp-col { padding: 10px 12px; border-radius: 6px; background: rgba(255,255,255,.6); font-size: 14px; line-height: 1.4; }
.pf-cmp-col.theirs { background: #fffbe0; box-shadow: inset 0 0 0 2px #e2c24a; }
.pf-cmp-col p { margin: 4px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.pf-cmp-h { display: block; margin-bottom: 4px; font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: #6b5a4a; }
.pf-cmp-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.pf-price-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pf-toggle {
  height: 38px; padding: 0 16px; border: 1.5px solid #2b1a0c; border-radius: 19px;
  background: transparent; color: var(--ink); font-size: 14px; font-weight: 800; cursor: pointer;
}
.pf-toggle.on { background: #2b1a0c; color: #fff4e0; }
.pf-amount-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.pf-amount { width: 130px; text-align: right; }
.pf-unit { width: auto; padding: 0 8px; }
.pf-pre, .pf-zl { font-weight: 800; }
.pf-auto { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.pf-auto-val { font-weight: 800; }
.pf-place { max-width: 320px; }

.pf-ill { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1.5px dashed rgba(58,40,24,.25); }
.ip-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ip-title { font-size: 15px; font-weight: 900; }
.ip-opt { font-weight: 600; color: #6b5a4a; }
.ip-sel { font-size: 12.5px; color: #5a4636; }
.ip-sugg { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ip-sugg-lbl { font-size: 13px; font-weight: 900; }
.ip-chip {
  height: 42px; padding: 0 12px 0 4px; display: flex; align-items: center; gap: 6px;
  border: 1.5px dashed #2b1a0c; border-radius: 21px; background: #fffbe0;
  font-size: 13px; font-weight: 800; cursor: pointer;
}
.ip-chip.on { border-style: solid; background: #2b1a0c; color: #fff4e0; }
.ip-chip.on img { filter: invert(1) brightness(1.6); }
.ip-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.ip-tab {
  height: 30px; padding: 0 11px; border: 1.5px solid rgba(58,40,24,.35); border-radius: 15px;
  background: rgba(255,255,255,.45); color: var(--ink); font-size: 12.5px; font-weight: 800; cursor: pointer;
}
.ip-tab.on { background: #2b1a0c; border-color: #2b1a0c; color: #fff4e0; }
.ip-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.ip-tile {
  position: relative; height: 124px; padding: 6px 6px 8px;
  border: 1.5px solid rgba(58,40,24,.2); border-radius: 6px; background: rgba(255,255,255,.55); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px; cursor: pointer;
}
.ip-tile img { width: 100%; max-width: 104px; height: 87px; object-fit: contain; }
.ip-tile:hover { background: rgba(255,255,255,.85); }
.ip-tile.sugg { box-shadow: inset 0 0 0 2px #e2c24a; }
.ip-tile.on { border: 2.5px solid #2b1a0c; background: #fffdf6; padding: 5px 5px 7px; }
.ip-tile.on::after {
  content: "✓"; position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; border-radius: 11px;
  background: #2b1a0c; color: #fff4e0; font-size: 13px; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
.ip-name { font-size: 12px; font-weight: 700; line-height: 1.15; text-align: center; }
.ip-none-ico { flex: 1 1 auto; display: flex; align-items: center; font-size: 34px; color: #8a7a66; }
.ip-note { margin: 0; font-size: 12.5px; color: #6b5a4a; }

.pf-terms { font-size: 12.5px; color: #5a4636; line-height: 1.35; }
.pf-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pf-confirm { padding: 14px 16px; background: #fffbe9; border: 2px solid #2b1a0c; border-radius: 8px; display: flex; flex-direction: column; gap: 8px; }
.pf-confirm p { margin: 0; }
.pf-confirm-t { font-size: 16px; font-weight: 900; }
.pf-confirm-float { position: sticky; bottom: -24px; margin: 0 -8px -8px; box-shadow: 0 -8px 22px rgba(0,0,0,.22); z-index: 3; }

.pv-tabs { display: flex; gap: 8px; }
.pv-tab {
  height: 36px; padding: 0 16px; border: 1.5px solid #2b1a0c; border-radius: 18px;
  background: transparent; color: var(--ink); font-size: 14px; font-weight: 800; cursor: pointer;
}
.pv-tab.on { background: #2b1a0c; color: #fff4e0; }
.pv-stage {
  min-height: 320px; padding: 36px 16px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background-color: var(--cork);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(92,52,20,.4) 0 1.3px, transparent 1.9px),
    radial-gradient(circle at 70% 60%, rgba(255,232,196,.3) 0 1px, transparent 1.6px),
    radial-gradient(circle at 40% 80%, rgba(80,45,15,.32) 0 1.1px, transparent 1.7px);
  background-size: 11px 9px, 15px 17px, 21px 19px;
  box-shadow: inset 0 2px 10px rgba(40,20,5,.45);
}
.pv-stage .card.pv-card { position: relative; left: auto !important; top: auto !important; cursor: default; flex-shrink: 0; }
.pv-stage .card.pv-card .tab { display: none !important; }
.pv-big { padding: 24px 12px; }
.bigcard.bc-preview {
  position: relative; left: auto; top: auto; margin: 0;
  width: 100%; max-width: 540px; max-height: none; overflow: visible;
  transform: rotate(-.6deg); pointer-events: none; animation: none;
}
.pv-notes { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.45; color: #3a2d22; }
.pv-err { margin: 0; }
.pv-turnstile:empty { display: none; }

.ck-wrap { flex: 1 1 auto; min-height: 340px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 12px; }
.ck-card {
  position: relative; width: 250px; padding: 24px 18px 20px;
  background: var(--bg, #f6eedd); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; text-align: left;
  box-shadow: 0 1px 1px rgba(0,0,0,.18), 0 16px 22px -6px rgba(40,20,5,.55);
  transform-origin: 50% 0; animation: swing 1.6s ease-in-out infinite;
}
.ck-card .pin { left: 50%; margin-left: -12px; }
.ck-title { font-family: var(--font-hand); font-size: 22px; line-height: 1.1; overflow-wrap: anywhere; }
.ck-h { margin: 14px 0 0; display: flex; align-items: center; gap: 12px; font-family: var(--font-hand); font-size: 30px; font-weight: 700; }
.spin { display: inline-block; width: 16px; height: 16px; flex-shrink: 0; border: 2.5px solid rgba(43,26,12,.25); border-top-color: #2b1a0c; border-radius: 50%; animation: spin .8s linear infinite; }
.spin.big { width: 26px; height: 26px; border-width: 3.5px; }
@keyframes spin { to { transform: rotate(360deg); } }
.prog { width: min(360px, 100%); display: flex; align-items: center; gap: 10px; }
.prog-bar { flex: 1 1 auto; height: 10px; border-radius: 5px; background: rgba(43,26,12,.14); overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,.15); }
.prog-fill { display: block; height: 100%; width: 0; border-radius: 5px; background: repeating-linear-gradient(135deg, #e0b92c 0 10px, #f2c230 10px 20px); background-size: 28px 28px; animation: prog-move 1s linear infinite; transition: width .25s linear; }
@keyframes prog-move { to { background-position: 28px 0; } }
.prog-time { min-width: 34px; font-size: 13px; font-weight: 800; color: #5a4636; font-variant-numeric: tabular-nums; }
.prog-hint { margin: 0; min-height: 1.4em; font-size: 14px; font-weight: 700; color: #5a4636; max-width: 400px; }
.pf-improve .prog { width: min(320px, 100%); }
.pf-improve-btn.busy { cursor: progress; opacity: .85; }
.ck-sub { margin: 0; max-width: 400px; color: #5a4636; line-height: 1.45; }
@keyframes swing { 0% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } 100% { transform: rotate(-2.5deg); } }

.rs-head { display: flex; gap: 14px; align-items: center; }
.rs-ico { width: 52px; height: 52px; flex-shrink: 0; border-radius: 26px; color: #fff; font-size: 28px; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.rs-ico.ok { background: #3e8e3a; }
.rs-ico.wait { background: #c07a12; }
.rs-title { margin: 0; font-family: var(--font-hand); font-size: 34px; font-weight: 700; line-height: 1.05; }
.rs-sub { margin: 4px 0 0; color: #3a2d22; line-height: 1.4; }
.rs-code { padding: 14px 18px; background: #fffdf6; border: 2px dashed #2b1a0c; border-radius: 8px; display: flex; flex-direction: column; gap: 6px; }
.rs-code-lbl { font-size: 12px; font-weight: 900; letter-spacing: .08em; }
.rs-code-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.rs-code-val { font-size: 32px; font-weight: 900; letter-spacing: .06em; font-variant-numeric: tabular-nums; user-select: all; -webkit-user-select: all; }
.rs-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.4; }
.rs-pdf { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rs-note { font-size: 12.5px; color: #6b5a4a; }
.rs-saved { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 2px solid #2b1a0c; border-radius: 8px; background: #fffdf6; font-weight: 900; cursor: pointer; }
.rs-saved input { width: 22px; height: 22px; margin: 0; accent-color: #2b1a0c; }
.rs-saved.on { background: #e6f2df; }
.rs-foot { margin: 0; font-size: 13px; color: #5a4636; line-height: 1.4; }
.rj-wrap { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.rj-wrap p { margin: 0; line-height: 1.45; }
.rj-reason { font-weight: 800; padding: 10px 12px; background: #fbe2df; border-left: 4px solid #b3261e; }
.copy-helper { position: fixed; left: -9999px; top: 0; opacity: 0; }

.card.pinned-new { animation: pin-in .6s cubic-bezier(.2,.8,.25,1) both, glow 1.4s ease .6s; z-index: 22; }
@keyframes pin-in { 0% { opacity: 0; transform: rotate(var(--r)) translateY(-70px) scale(1.18); } 55% { opacity: 1; } 100% { transform: rotate(var(--r)); } }
@keyframes glow { 0% { box-shadow: 0 0 0 0 rgba(255,244,190,.95), 0 12px 18px -6px rgba(40,20,5,.6); } 70% { box-shadow: 0 0 0 18px rgba(255,244,190,0), 0 12px 18px -6px rgba(40,20,5,.6); } 100% { box-shadow: 0 1px 1px rgba(0,0,0,.18), 0 12px 18px -6px rgba(40,20,5,.6); } }

@media (max-width: 760px), (max-height: 520px) and (orientation: landscape) and (pointer: coarse) {
  .pin-box { left: 0; right: 0; top: 0; bottom: 0; width: auto; transform: none; }
  .pin-pin { display: none; }
  .pin-head { padding: calc(8px + var(--safe-t)) 8px 8px 16px; }
  .pin-heading { font-size: 22px; }
  .pin-body { padding: 16px 16px 20px; gap: 16px; }
  .pin-foot { flex-direction: column-reverse; align-items: stretch; padding: 12px 16px calc(14px + var(--safe-b)); gap: 10px; }
  .pin-foot .pf-actions { flex-direction: column-reverse; align-items: stretch; }
  .pin-foot .btn-dark, .pin-foot .btn-ghost { width: 100%; }
  .pf-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ip-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .ip-tile { height: 112px; }
  .ip-tile img { height: 76px; }
  .pf-cmp { grid-template-columns: 1fr; }
  .rs-title { font-size: 28px; }
  .rs-code-val { font-size: 25px; }
  .pv-stage { padding: 30px 8px; }
  .pv-stage .card.pv-card.wide { transform: rotate(var(--r)) scale(.62); margin: -60px -110px; }
  .pf-confirm-float { bottom: -20px; }
}
@media (max-height: 520px) and (orientation: landscape) and (pointer: coarse) {
  .pin-box { left: 50%; right: auto; width: min(560px, 100%); transform: translateX(-50%); }
}
