/* ==========================================================================
   Challan — Receipt Studio
   Desktop: left controls (344) · live canvas (flex) · right customisation (300)
   Tablet: controls + canvas, customisation in a drawer
   Mobile: one pane at a time with bottom navigation
   ========================================================================== */

html, body.studio { height: 100%; }
body.studio { overflow: hidden; background: var(--bg); }

/* Top bar --------------------------------------------------------------- */
.sb-top { height: var(--topbar-h); display: flex; align-items: center; gap: 8px; padding: 0 12px 0 14px; background: var(--surface); border-bottom: 1px solid var(--border); position: relative; z-index: 20; }
.sb-top .brand { margin-inline-end: 6px; }
.sb-top .vr { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.doc-type-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border-radius: var(--r-sm); font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.doc-type-btn:hover { background: #F2F4F7; }
.doc-type-btn .i { color: var(--muted); }
.doc-no { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.save-state { display: inline-flex; align-items: center; gap: 5px; font-size: var(--t-sm); color: var(--muted); margin-inline-start: 4px; min-width: 70px; }
.save-state .i { width: 13px; height: 13px; color: var(--ok); }
.save-state.pop .i { animation: tick .45s var(--ease); }
@keyframes tick { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(1); } }
.sb-top .spacer { flex: 1; }
.country-chip { white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 8px; border: 1px solid var(--border); border-radius: var(--r-pill); font-size: var(--t-sm); font-weight: 500; color: var(--ink-2); }
.country-chip:hover { border-color: var(--border-strong); background: var(--surface-2); }
.country-chip .flag { font-size: 16px; line-height: 1; }
.country-chip .cur { color: var(--muted); }
.qc-pill { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: var(--r-pill); font-size: var(--t-sm); font-weight: 500; }
.qc-pill.ok { color: var(--ok); background: var(--ok-tint); }
.qc-pill.review { color: var(--warn); background: var(--warn-tint); }
.qc-pill.err { color: var(--err); background: var(--err-tint); }
.qc-pill:hover { filter: brightness(.97); }

/* Layout ---------------------------------------------------------------- */
.sb { display: grid; grid-template-columns: var(--left-w) minmax(0, 1fr) var(--right-w); height: calc(100% - var(--topbar-h)); }
.sb-left, .sb-right { background: var(--surface); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.sb-left { border-inline-end: 1px solid var(--border); position: relative; }
.sb-right { position: relative; }
.sb-right { border-inline-start: 1px solid var(--border); }

/* Left: sections -------------------------------------------------------- */
.sec { border-bottom: 1px solid var(--border); }
.sec-head { width: 100%; display: grid; grid-template-columns: 26px 1fr auto 16px; align-items: center; gap: 6px; padding: 14px 16px 14px 14px; text-align: start; }
.sec-head:hover { background: var(--surface-2); }
.sec-num { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; font-weight: 500; }
.sec-title { font-weight: 600; font-size: 14px; color: var(--ink); letter-spacing: -.005em; display: block; }
.sec-sum { display: block; font-size: var(--t-sm); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; font-weight: 400; }
.sec-state { display: inline-flex; align-items: center; }
.sec-state .done { width: 18px; height: 18px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; }
.sec-state .done .i { width: 11px; height: 11px; stroke-width: 2.6; }
.sec-state .opt { font-size: 11.5px; color: var(--faint); }
.sec-state .warn { color: var(--warn); }
.sec-head .chev { color: var(--faint); transition: transform var(--d-fast) var(--ease); }
.sec.open .sec-head .chev { transform: rotate(180deg); }
.sec-body { display: none; padding: 2px 16px 18px 16px; }
.sec.open .sec-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.sec-body > *, .row2 > *, .row3 > * { min-width: 0; }
.seg button { min-width: 0; }
.input[type="date"], .input[type="month"] { min-width: 0; padding-inline: 10px; }
.sec.flash { animation: flash 1s var(--ease); }
@keyframes flash { 0%, 40% { background: var(--brand-tint); } 100% { background: transparent; } }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; }
.hint { font-size: var(--t-sm); color: var(--muted); line-height: 1.45; }
.hint.box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-field); padding: 10px 12px; display: flex; gap: 8px; }
.hint.box .i { flex: none; margin-top: 2px; color: var(--faint); }
.subhead { font-size: var(--t-sm); font-weight: 600; color: var(--ink); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.divider { height: 1px; background: var(--border); margin: 2px 0; }
.sample-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #F8F9FB; border-bottom: 1px solid var(--border); font-size: var(--t-sm); color: var(--muted); }
.sample-bar .btn { margin-inline-start: auto; }

/* Uploader */
.drop { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: var(--r-field); background: var(--surface-2); cursor: pointer; transition: border-color var(--d-fast), background var(--d-fast); }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-tint); }
.drop .thumb { width: 44px; height: 44px; border-radius: 8px; background: #fff; border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; flex: none; color: var(--faint); }
.drop .thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.drop .txt { font-size: var(--t-sm); color: var(--muted); line-height: 1.35; flex: 1; }
.drop .txt b { color: var(--ink); font-weight: 500; display: block; }
.drop-actions { display: flex; gap: 4px; }
.range { width: 100%; accent-color: var(--brand); }

/* Items editor --------------------------------------------------------- */
.items-head { display: grid; grid-template-columns: 44px minmax(0,1fr) 46px 84px; gap: 4px; padding: 0 36px 0 25px; font-size: 11.5px; color: var(--faint); }
.items-head.no-tax { grid-template-columns: 44px minmax(0,1fr) 84px; }
.items-head span { text-align: end; }
.items { display: grid; gap: 8px; }
.irow { position: relative; display: grid; grid-template-columns: 16px minmax(0,1fr) 26px; gap: 4px; padding: 8px 4px 8px 4px; border: 1px solid var(--border); border-radius: var(--r-field); background: var(--surface); animation: row-in var(--d-med) var(--ease); }
@keyframes row-in { from { opacity: 0; transform: translateY(-4px); } }
.irow:focus-within { border-color: var(--border-strong); box-shadow: var(--e-1); }
.irow.dragging { opacity: .5; }
.irow.drop-before { box-shadow: 0 -2px 0 var(--brand); }
.irow.hl { animation: flash 1s var(--ease); }
.irow .grip { color: var(--faint); cursor: grab; display: grid; place-items: start center; padding-top: 9px; }
.irow .grip .i { width: 14px; height: 14px; }
.irow-main { display: grid; gap: 6px; min-width: 0; }
.irow .desc { height: 34px; border-color: transparent; padding: 0 8px; font-weight: 500; }
.irow .desc:hover { border-color: var(--border); }
.irow .desc:focus { border-color: var(--brand); }
.irow-nums { display: grid; grid-template-columns: 44px minmax(0,1fr) 46px 84px; gap: 4px; align-items: center; }
.irow-nums.no-tax { grid-template-columns: 44px minmax(0,1fr) 84px; }
.irow-nums .input { height: 32px; padding: 0 6px; font-size: 13px; min-width: 0; }
.irow-amt { text-align: end; font-weight: 600; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-inline-start: 4px; }
.irow-nums .lbl { font-size: 11.5px; color: var(--faint); }
.irow .more { align-self: start; width: 26px; height: 32px; border-radius: 6px; color: var(--muted); display: grid; place-items: center; }
.irow .more:hover { background: #F2F4F7; color: var(--ink); }
.irow-x { display: none; grid-column: 2 / 3; gap: 8px; grid-template-columns: 1fr 1fr; padding-top: 4px; }
.irow.expanded .irow-x { display: grid; }
.irow-x .field label { font-size: 11.5px; }
.irow-x .input { height: 32px; font-size: 13px; }
.irow-x .wide { grid-column: 1 / -1; }
.smart { display: flex; align-items: center; gap: 8px; font-size: var(--t-sm); color: var(--ink-2); background: var(--brand-tint); border-radius: 8px; padding: 6px 8px; }
.smart .i { color: var(--brand); width: 14px; height: 14px; }
.smart .btn { margin-inline-start: auto; }
.items-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.items-total { font-size: var(--t-sm); color: var(--muted); text-align: end; }
.items-total b { color: var(--ink); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; display: block; }

/* Custom field rows */
.cf-row { display: grid; grid-template-columns: 1fr 1fr 30px; gap: 6px; align-items: center; }
.cf-row .select { height: 30px; font-size: 12.5px; grid-column: 1 / 3; }
.cf-row .input { height: 34px; }
.cf-wrap { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: var(--r-field); }
.tax-row { display: grid; grid-template-columns: 1fr 90px 30px; gap: 6px; }

/* Signature pad */
.sigpad { position: relative; border: 1px solid var(--border-strong); border-radius: var(--r-field); background: #fff; height: 120px; touch-action: none; }
.sigpad canvas { width: 100%; height: 100%; display: block; border-radius: var(--r-field); cursor: crosshair; }
.sigpad .btn { position: absolute; top: 6px; inset-inline-end: 6px; }
.sigpad .baseline { position: absolute; left: 16px; right: 16px; bottom: 30px; border-top: 1px dashed var(--border-strong); pointer-events: none; }

/* Canvas ---------------------------------------------------------------- */
.sb-canvas { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--workspace); background-image: radial-gradient(rgba(16, 24, 40, .07) 1px, transparent 1px); background-size: 16px 16px; }
.cv-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; }
.cv-bar .seg { width: auto; background: rgba(255, 255, 255, .7); box-shadow: 0 0 0 1px var(--border); }
.cv-bar .seg button { height: 26px; padding: 0 9px; font-size: 12px; }
.cv-bar .grow { flex: 1; }
.cv-bar .btn { background: rgba(255, 255, 255, .8); }
.cv-tpl { font-size: var(--t-sm); color: var(--muted); }
.cv-tpl b { color: var(--ink); font-weight: 500; }
.cv-scroll { flex: 1; overflow: auto; padding: 8px 32px 64px; scrollbar-width: thin; }
.cv-stage { margin: 0 auto; position: relative; transition: width var(--d-med) var(--ease); }
.cv-sheet { transform-origin: top left; position: absolute; top: 0; left: 0; transition: opacity var(--d-med) var(--ease); }
.cv-sheet .rc { box-shadow: var(--e-sheet); border-radius: 2px; }
.cv-sheet .rc-thermal { border-radius: 0; box-shadow: 0 10px 30px -14px rgba(16, 24, 40, .35); }
.cv-sheet.morph { animation: morph .32s var(--ease); }
@keyframes morph { from { opacity: .35; filter: blur(1.5px); } }
.page-guide { position: absolute; left: -14px; right: -14px; height: 0; border-top: 1.5px dashed #98A2B3; pointer-events: none; z-index: 3; }
.page-guide span { position: absolute; inset-inline-end: 0; top: -11px; background: #475467; color: #fff; font-size: 11px; padding: 1px 7px; border-radius: 4px; font-family: var(--font-ui); }
.cv-count { font-size: 12px; color: var(--muted); text-align: center; margin-top: 12px; }

/* Studio-only editing affordances on the document */
.is-editable [data-edit] { cursor: text; border-radius: 3px; outline: 1px solid transparent; outline-offset: 2px; transition: outline-color var(--d-fast), background var(--d-fast); }
.is-editable [data-edit]:hover { outline-color: rgba(67, 56, 202, .35); background: rgba(67, 56, 202, .04); }
.is-editable [data-edit][contenteditable] { outline: 2px solid var(--brand); background: #fff; }
.is-editable [data-item], .is-editable [data-jump] { cursor: pointer; }
.is-editable [data-item]:hover td, .is-editable [data-item]:hover { background: rgba(67, 56, 202, .04); }
.is-editable .smp { text-decoration: underline dotted rgba(102, 112, 133, .6); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.is-editable .rc-logo.smp img { outline: 1px dashed #98A2B3; outline-offset: 3px; border-radius: 6px; }

/* Fullscreen preview */
body.fs .sb { grid-template-columns: 0 minmax(0, 1fr) 0; }
body.fs .sb-left, body.fs .sb-right { visibility: hidden; }
body.fs .sb-top { display: none; }
body.fs .sb { height: 100%; }

/* Right panel ---------------------------------------------------------- */
.rp-body { padding: 16px; display: grid; gap: 22px; }
.rp-group { display: grid; gap: 10px; }
.rp-group > .subhead { margin-bottom: 2px; }
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpl-card { display: grid; gap: 6px; text-align: start; min-width: 0; }
.tpl-slot { min-width: 0; }
.tpl-thumb { position: relative; height: 136px; border: 1px solid var(--border); border-radius: var(--r-sm); background: #fff; overflow: hidden; transition: border-color var(--d-fast), box-shadow var(--d-fast); }
.tpl-thumb > div { position: absolute; top: 0; left: 0; pointer-events: none; }
.tpl-card:hover .tpl-thumb { border-color: var(--border-strong); }
.tpl-card[aria-pressed="true"] .tpl-thumb { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.tpl-card .nm { font-size: var(--t-sm); font-weight: 500; color: var(--ink-2); display: flex; justify-content: space-between; }
.tpl-card[aria-pressed="true"] .nm { color: var(--brand); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 26px; height: 26px; border-radius: 50%; position: relative; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.swatch[aria-pressed="true"]::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--ink); }
.hex { display: flex; align-items: center; gap: 8px; }
.hex .input { width: 110px; height: 32px; font-family: var(--font-mono); font-size: 12.5px; }
.hex .dot { width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }

/* Quality list */
.qlist { display: grid; gap: 6px; }
.qitem { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); font-size: var(--t-sm); text-align: start; width: 100%; }
.qitem .i { flex: none; width: 15px; height: 15px; margin-top: 1px; }
.qitem.err .i { color: var(--err); } .qitem.warn .i { color: var(--warn); } .qitem.tip .i { color: var(--info); }
.qitem .go { margin-inline-start: auto; color: var(--brand); font-weight: 500; white-space: nowrap; }
.qitem:hover { border-color: var(--border-strong); }
.qgood { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--r-sm); background: var(--ok-tint); color: var(--ok); font-size: var(--t-sm); font-weight: 500; }

/* Popovers specific -------------------------------------------------- */
.pop-country { width: 360px; padding: 0; }
.pop-country .search { padding: 10px; border-bottom: 1px solid var(--border); }
.pop-country .list { max-height: 380px; overflow: auto; padding: 6px; }
.crow { width: 100%; display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 7px; text-align: start; }
.crow:hover, .crow[aria-selected="true"] { background: #F2F4F7; }
.crow .fl { font-size: 18px; line-height: 1; }
.crow .nm { font-weight: 500; color: var(--ink); display: block; }
.crow .cn { font-size: 12px; color: var(--muted); display: block; }
.crow .sy { font-size: 13px; color: var(--ink-2); font-weight: 500; min-width: 28px; text-align: end; }
.crow.current .nm::after { content: " ✓"; color: var(--brand); }
.pop-types { width: 720px; padding: 0; display: grid; grid-template-columns: 170px 1fr; max-height: min(560px, calc(100vh - 80px)); overflow: hidden; }
.tp-nav { display: grid; align-content: start; gap: 2px; padding: 10px; background: var(--surface-2); border-inline-end: 1px solid var(--border); }
.tp-nav button { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 8px; font-weight: 500; color: var(--ink-2); text-align: start; }
.tp-nav button:hover { background: #F2F4F7; }
.tp-nav button[aria-selected="true"] { background: var(--brand-tint); color: var(--brand); }
.tp-list { padding: 10px; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; align-content: start; }
.pop-types .grp { grid-column: 1 / -1; font-size: 12px; color: var(--faint); padding: 6px 8px 2px; font-weight: 500; }
.tp-note { grid-column: 1 / -1; display: flex; gap: 6px; padding: 10px 8px 2px; }
.tp-note .i { flex: none; margin-top: 2px; }
.trow { display: flex; gap: 10px; align-items: flex-start; padding: 8px; border-radius: 8px; text-align: start; }
.trow:hover, .trow:focus-visible { background: #F2F4F7; outline: none; }
.trow .i { margin-top: 2px; color: var(--muted); }
.trow b { display: block; font-weight: 500; font-size: 13.5px; }
.trow small { color: var(--muted); font-size: 12px; }
.trow[aria-current="true"] { background: var(--brand-tint); }
.trow[aria-current="true"] b, .trow[aria-current="true"] .i { color: var(--brand); }

/* Gallery modal */
.gal-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding: 0 20px 14px; }
.gal-filters .switch { margin-inline-start: auto; font-size: var(--t-sm); gap: 8px; }
.gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.gal .tpl-thumb { height: 270px; }
.gal .tpl-card .nm { font-size: 14px; }
.gal .tpl-card small { color: var(--muted); font-size: 12px; }

/* Export modal */
.ex-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ex-opt { display: flex; gap: 12px; align-items: flex-start; text-align: start; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md); transition: border-color var(--d-fast), background var(--d-fast); }
.ex-opt:hover { border-color: var(--border-strong); background: var(--surface-2); }
.ex-opt.primary { grid-column: 1 / -1; border-color: var(--brand); background: var(--brand-tint); }
.ex-opt .ico { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: #F2F4F7; color: var(--ink-2); flex: none; }
.ex-opt.primary .ico { background: var(--brand); color: #fff; }
.ex-opt b { display: block; font-weight: 600; font-size: 14px; }
.ex-opt small { color: var(--muted); font-size: 12.5px; }
.ex-opt .badge { margin-inline-start: auto; }
.ex-state { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); margin-top: 12px; font-size: var(--t-sm); }
.ex-state .bar { flex: 1; height: 4px; border-radius: 4px; background: var(--border); overflow: hidden; }
.ex-state .bar i { display: block; height: 100%; width: 30%; background: var(--brand); border-radius: 4px; animation: prog 1.1s var(--ease) infinite; }
@keyframes prog { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
.ex-done { color: var(--ok); }
.ex-done .ring { width: 22px; height: 22px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; animation: tick .45s var(--ease); }
.ex-done .ring .i { width: 13px; height: 13px; stroke-width: 2.6; }

/* Command palette */
.palette { width: min(560px, 100%); align-self: start; margin-top: 12vh; }
.palette .search { padding: 12px; border-bottom: 1px solid var(--border); }
.palette .search .input { border: 0; box-shadow: none; height: 36px; font-size: 15px; padding: 0 4px; }
.palette .list { max-height: 360px; overflow: auto; padding: 6px; }

/* Quick create */
.qc-input { font-size: 15px; height: 46px; }
.qc-draft { display: grid; gap: 8px; margin-top: 14px; }
.qc-draft .row { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: center; }
.qc-draft .row > span { font-size: var(--t-sm); color: var(--muted); }
.qc-draft .input, .qc-draft .select { height: 34px; }
.qc-examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* Print-only root */
#print-root { display: none; }

/* Mobile nav (hidden on desktop) */
.m-nav, .m-cta { display: none; }

/* Tablet ---------------------------------------------------------------- */
@media (max-width: 1180px) {
  .sb { grid-template-columns: var(--left-w) minmax(0, 1fr); }
  .sb-right { position: fixed; top: var(--topbar-h); bottom: 0; inset-inline-end: 0; width: 320px; z-index: 30; box-shadow: var(--e-3); transform: translateX(105%); transition: transform var(--d-med) var(--ease); }
  [dir="rtl"] .sb-right { transform: translateX(-105%); }
  body.rp-open .sb-right { transform: none; }
  .only-wide { display: none !important; }
  #cc-name, .save-state { display: none; }
  .doc-type-btn, .qc-pill { white-space: nowrap; }
}
@media (min-width: 1181px) { .only-tablet { display: none !important; } }

/* Mobile ---------------------------------------------------------------- */
@media (max-width: 760px) {
  :root { --topbar-h: 52px; }
  .sb-top { padding: 0 8px; gap: 4px; }
  .sb-top .hide-m, .save-state, #btn-download, #btn-customize { display: none; }
  .sb-top .brand img { width: 24px; height: 24px; }
  .country-chip { white-space: nowrap; padding: 0 8px; }
  .doc-type-btn { white-space: nowrap; max-width: 52vw; overflow: hidden; }
  #type-name { overflow: hidden; text-overflow: ellipsis; }
  .doc-type-btn { font-size: 14px; padding: 0 6px; }
  .doc-no { display: none; }
  .sb { display: block; height: calc(100% - var(--topbar-h) - 64px - 64px); }
  .sb-left, .sb-right, .sb-canvas { display: none; height: 100%; }
  .sb-right { position: static; transform: none; width: auto; box-shadow: none; border: 0; }
  body[data-mtab="details"] .sb-left, body[data-mtab="items"] .sb-left { display: block; }
  body[data-mtab="details"] .sec[data-sec="items"] { display: none; }
  body[data-mtab="items"] .sec:not([data-sec="items"]), body[data-mtab="items"] .sample-bar { display: none; }
  body[data-mtab="items"] .sec[data-sec="items"] .sec-body { display: grid; }
  body[data-mtab="design"] .sb-right { display: block; }
  body[data-mtab="preview"] .sb-canvas { display: flex; }
  body[data-mtab="preview"] .sb { height: calc(100% - var(--topbar-h) - 64px - 64px); }
  .cv-bar .seg, .cv-bar .only-wide-m { display: none; }
  .cv-scroll { padding: 8px 12px 24px; }
  .sec-head { padding: 16px; }
  .input, .select { height: 44px; font-size: 16px; }
  .irow-nums .input, .irow-x .input { height: 40px; font-size: 16px; }
  .irow .desc { height: 40px; font-size: 16px; }
  .items-head { display: none; }
  .irow-nums { grid-template-columns: 1fr 1fr 1fr; }
  .irow-nums .irow-amt { grid-column: 1 / -1; text-align: end; }
  .irow-nums.no-tax { grid-template-columns: 1fr 1fr; }
  .m-cta { display: flex; position: fixed; left: 0; right: 0; bottom: 64px; padding: 10px 12px; background: var(--surface); border-top: 1px solid var(--border); gap: 10px; align-items: center; z-index: 25; height: 64px; }
  .m-cta .tot { font-size: 12px; color: var(--muted); line-height: 1.2; }
  .m-cta .tot b { display: block; color: var(--ink); font-size: 17px; font-variant-numeric: tabular-nums; }
  .m-cta .btn { margin-inline-start: auto; }
  .m-nav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; height: 64px; background: var(--surface); border-top: 1px solid var(--border); z-index: 25; padding-bottom: env(safe-area-inset-bottom); }
  .m-nav button { display: grid; justify-items: center; align-content: center; gap: 3px; font-size: 11.5px; color: var(--muted); font-weight: 500; }
  .m-nav button .i { width: 20px; height: 20px; }
  .m-nav button[aria-selected="true"] { color: var(--brand); }
  .pop-types { width: calc(100vw - 16px); grid-template-columns: 1fr; max-height: 75vh; overflow: auto; }
  .tp-nav { grid-auto-flow: column; overflow-x: auto; border-inline-end: 0; border-bottom: 1px solid var(--border); }
  .tp-nav button { white-space: nowrap; }
  .tp-list { grid-template-columns: 1fr; overflow: visible; }
  .pop-country { width: calc(100vw - 16px); }
  .ex-grid { grid-template-columns: 1fr; }
  .scrim { padding: 0; align-items: end; }
  .modal { border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92vh; }
  .palette { margin-top: 0; }
}
