/* UI v2 side-panel kit (see panel.js for the API). A right-hand <dialog class="v2p"> with a
   header (kicker / title / close), a scrolling body of <section data-step> steps and a pinned
   footer. Full-screen sheet at <=860px with the footer above the keyboard / home indicator.
   Loaded on native v2 pages (base.html) and on bridged classic pages (_bridge_head.html), so it
   only uses the shell.css tokens and restates the few kit pieces (.btn, .seg, .ico) it needs.
   Owner rules: no coloured accent edges on cards/rows/panels, long text wraps, no emojis. */
.v2p{border:0;padding:0;margin:0 0 0 auto;inset:0 0 0 auto;width:min(var(--v2p-w,560px),100vw);height:100dvh;max-height:100dvh;max-width:100vw;background:var(--surface);color:var(--ink);box-shadow:-12px 0 40px rgba(15,23,42,.18)}
.v2p::backdrop{background:rgba(15,23,42,.45)}
.v2p[open]{display:flex}
.v2p [hidden]{display:none !important}
.v2p-box{display:flex;flex-direction:column;width:100%;height:100%;min-height:0}
.v2p-head{display:flex;align-items:flex-start;gap:12px;padding:18px 20px 14px;border-bottom:1px solid var(--line)}
.v2p-head > div{flex:1 1 auto;min-width:0}
.v2p-kicker{margin:0 0 4px;font-size:12px;font-weight:600;color:var(--muted)}
.v2p-head h2{margin:0;font-size:19px;line-height:1.3;font-weight:600;color:var(--ink);overflow-wrap:anywhere}
.v2p-x{flex:none}
.v2p-body{flex:1 1 auto;overflow-y:auto;padding:18px 20px 24px;display:flex;flex-direction:column;gap:16px}
.v2p-body section{display:flex;flex-direction:column;gap:16px}
.v2p-lead{margin:0;font-size:14px;line-height:1.5;color:var(--text)}

/* Native pages get .btn/.seg/.ico from ui_v2.css (untouched here, so native panels look exactly
   as before). Bridged classic pages (body.v2b) have the classic .btn + skin.css instead, so
   restate the v2 look for those inside a panel only. */
body.v2b .v2p .btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;width:auto;min-height:40px;padding:0 14px;border-radius:10px;border:1px solid var(--field);background:var(--surface);color:var(--ink);font-size:14px;font-weight:600;text-decoration:none;white-space:nowrap;box-shadow:none;cursor:pointer}
body.v2b .v2p .btn:hover{background:#F8F9FB}
body.v2b .v2p .btn-primary{background:var(--brand);border-color:var(--brand);color:#fff}
body.v2b .v2p .btn-primary:hover{background:var(--brand-strong);border-color:var(--brand-strong)}
body.v2b .v2p .btn-icon{width:40px;padding:0}
body.v2b .v2p .btn[disabled]{opacity:.55;cursor:not-allowed}
body.v2b .v2p .btn:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
body.v2b .v2p .seg{display:inline-flex;gap:4px;background:var(--chip);padding:3px;border-radius:10px;flex-wrap:wrap}
body.v2b .v2p .seg button{border:0;border-radius:8px;background:transparent;font-weight:500;color:var(--muted);display:inline-flex;align-items:center;cursor:pointer}
body.v2b .v2p .seg .on{background:var(--surface);color:var(--ink);font-weight:600;box-shadow:0 1px 2px rgba(15,23,42,.08)}
body.v2b .v2p .ico{flex:none;width:36px;height:36px;border-radius:10px;display:flex;align-items:center;justify-content:center}
body.v2b .v2p .ico svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
body.v2b .v2p .ico-info{background:var(--brand-50);color:var(--brand-deep)}
body.v2b .v2p .ico-ok{background:var(--ok-bg);color:var(--ok-fg)}
body.v2b .v2p .ico-crit{background:var(--crit-bg);color:var(--crit-fg)}
body.v2b .v2p .ico-warn{background:var(--warn-bg);color:var(--warn-fg)}
/* Both: the panel's segmented control is a little larger (touch targets). */
.v2p .seg{align-self:flex-start}
.v2p .seg button{min-height:40px;padding:0 16px;font-size:14px}

/* Big tappable choice (step 1 "how do you want to…"). Neutral card, no accent edge. */
.v2p-choice{display:flex;align-items:flex-start;gap:14px;width:100%;text-align:left;padding:16px;border:1px solid var(--field);border-radius:12px;background:var(--surface);color:var(--ink);font:inherit;cursor:pointer}
.v2p-choice:hover{background:#F8F9FB;border-color:#C3CAD4}
.v2p-choice:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
.v2p-choice b{display:block;font-size:15px;font-weight:600}
.v2p-choice span.d{display:block;margin-top:4px;font-size:13px;line-height:1.45;color:var(--muted)}
.v2p-choice .ico{flex:none}
.v2p-choice .chev{margin-left:auto;align-self:center;color:var(--muted);flex:none}

/* Fields */
.v2p-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.v2p-f{display:flex;flex-direction:column;gap:6px;min-width:0}
.v2p-f > label,.v2p-f > .lbl{font-size:13px;font-weight:600;color:var(--ink);display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.v2p-f .req{color:var(--muted);font-weight:400}
.v2p-f input[type=text],.v2p-f input[type=tel],.v2p-f input[type=email],.v2p-f input[type=date],.v2p-f input[type=number],.v2p-f input[type=url],.v2p-f input[type=time],.v2p-f input[type=search],.v2p-f select{min-height:42px;border:1px solid var(--field);border-radius:10px;padding:0 12px;font:inherit;font-size:15px;color:var(--ink);background:#fff;width:100%;box-sizing:border-box}
.v2p-f textarea{min-height:88px;border:1px solid var(--field);border-radius:10px;padding:10px 12px;font:inherit;font-size:15px;line-height:1.45;color:var(--ink);background:#fff;width:100%;box-sizing:border-box;resize:vertical}
.v2p-f input:focus,.v2p-f select:focus,.v2p-f textarea:focus{outline:2px solid var(--brand);outline-offset:0;border-color:var(--brand)}
.v2p-f input[aria-invalid=true],.v2p-f select[aria-invalid=true],.v2p-f textarea[aria-invalid=true]{border-color:var(--crit-fg);background:var(--crit-bg)}
.v2p-hint{font-size:12px;line-height:1.45;color:var(--muted);margin:0}
.v2p-ferr{font-size:12px;font-weight:600;color:var(--crit-fg);margin:0}
.v2p-check{display:flex;align-items:flex-start;gap:10px;font-size:14px;color:var(--ink);cursor:pointer;line-height:1.4}
.v2p-check input{margin:2px 0 0;width:18px;height:18px;flex:none;accent-color:var(--brand)}
.v2p-check small{display:block;font-size:12px;color:var(--muted);margin-top:2px}

/* Messages */
.v2p-err{font-size:13px;line-height:1.45;color:#7A1A12;background:var(--crit-bg);border:1px solid var(--crit-line);border-radius:10px;padding:10px 12px}
.v2p-err a{color:inherit;font-weight:600}
.v2p-note{font-size:13px;line-height:1.45;color:var(--brand-ink);background:var(--brand-50);border-radius:10px;padding:10px 12px;margin:0}
.v2p-status{display:flex;align-items:center;gap:10px;font-size:14px;color:var(--text)}
.v2p-spin{width:18px;height:18px;border-radius:999px;border:2px solid var(--line);border-top-color:var(--brand);animation:v2p-spin .8s linear infinite;flex:none}
@keyframes v2p-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.v2p-spin{animation:none}}

/* File drop zone (label wrapping an sr-only file input) */
.v2p-drop{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;text-align:center;min-height:170px;padding:20px;border:1.5px dashed var(--field);border-radius:14px;background:#FAFBFC;cursor:pointer;color:var(--ink)}
.v2p-drop:hover,.v2p-drop.over{background:var(--brand-50);border-color:var(--brand-300)}
.v2p-drop:focus-within{outline:2px solid var(--brand);outline-offset:2px}
.v2p-drop b{font-size:15px}
.v2p-drop span{font-size:13px;color:var(--muted)}
.v2p-drop img{max-width:100%;max-height:180px;border-radius:8px;object-fit:contain}
.v2p .sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

.v2p-linkbtn{align-self:flex-start;background:none;border:0;padding:0;min-height:40px;font:inherit;font-size:14px;font-weight:600;color:var(--brand-deep);text-decoration:underline;cursor:pointer}
.v2p-done{display:flex;flex-direction:column;gap:14px}
.v2p-done .ico{width:44px;height:44px}
.v2p-done p{margin:0;font-size:14px;line-height:1.5;color:var(--text)}
.v2p-actions{display:flex;flex-wrap:wrap;gap:10px}

/* Pinned footer */
.v2p-foot{display:flex;align-items:center;gap:10px;padding:12px 20px;border-top:1px solid var(--line);background:var(--surface)}
.v2p-foot .sp{flex:1 1 auto}

@media (max-width:860px){
  .v2p{width:100vw;inset:0;box-shadow:none}
  .v2p-head{padding:14px 16px 12px}
  .v2p-body{padding:16px 16px 24px}
  .v2p-foot{padding:10px 16px calc(10px + env(safe-area-inset-bottom))}
  .v2p-foot .btn{flex:1 1 0}
  .v2p-foot .sp{display:none}
}
@media (max-width:420px){ .v2p-grid{grid-template-columns:1fr} }
