/* P21 Label · MeshHand. Shares the MeshHand / Mesh Connector palette. */
:root {
  --primary: #0a1a33;
  --primary-2: #14305e;
  --blue: #1f5eff;
  --blue-bright: #4d8bff;
  --blue-wash: #e8efff;
  --red: #e0332b;
  --red-deep: #c4241d;
  --ok: #158a5a;
  --ok-bg: #e6f4ec;
  --warn: #8a5a12;
  --warn-bg: #fdf3df;
  --err: #b42318;
  --err-bg: #fbe9e7;
  --surface: #f5f7fa;
  --floor: #eaeef4;
  --white: #ffffff;
  --ink: #141a24;
  --ink-mid: #4f5c73;
  --ink-soft: #6b778c;
  --line: #dde3ec;
  --line-strong: #c6cfdc;
  --tape: #c9a227;
  --font-display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --radius: 10px;
  --shadow-1: 0 1px 2px rgba(10, 26, 51, .06), 0 2px 6px rgba(10, 26, 51, .05);
  --shadow-2: 0 4px 10px rgba(10, 26, 51, .08), 0 14px 32px rgba(10, 26, 51, .10);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font-body); color: var(--ink); background: var(--surface); min-height: 100vh; }
a { color: var(--blue); }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.012em; line-height: 1.12; margin: 0; text-wrap: balance; }
button, input, select { font: inherit; color: inherit; }
.mono { font-family: var(--font-mono); font-feature-settings: 'zero' 1; }
.muted { color: var(--ink-mid); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2.5px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
#app:focus { outline: none; }

/* ---------- header ---------- */
.bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 20px; height: 60px; padding: 0 24px; background: var(--primary); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand img { border-radius: 8px; }
.brand-name { font-family: var(--font-display); font-weight: 800; font-size: 1.2rem; letter-spacing: -.01em; }
.brand-by { margin-left: -10px; font-size: .8rem; color: #a9b8d4; padding-left: 10px; border-left: 1px solid #2c4470; text-decoration: none; }
.brand-by:hover { color: #fff; text-decoration: underline; }
.bar-status { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; color: #c8d4ea; }
.bar-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #8392ad; }
.bar-status.ok .dot { background: #3fd08a; box-shadow: 0 0 0 3px rgba(63, 208, 138, .18); }
.bar-status.off .dot { background: #f5a524; }
.bar-link { color: #fff; font-size: .88rem; font-weight: 600; text-decoration: none; padding: 7px 12px; border-radius: 8px; border: 1px solid #2c4470; }
.bar-link:hover { background: var(--primary-2); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 18px; border-radius: 9px; border: 1px solid transparent; font-weight: 600; font-size: .92rem; text-decoration: none; cursor: pointer; white-space: nowrap; transition: transform .12s var(--ease-out), background-color .15s, box-shadow .15s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--red); color: #fff; box-shadow: 0 1px 0 var(--red-deep), 0 4px 12px rgba(224, 51, 43, .22); }
.btn-primary:hover:not(:disabled) { background: var(--red-deep); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: #1a4fd8; }
.btn-ink { background: var(--primary); color: #fff; }
.btn-ink:hover:not(:disabled) { background: var(--primary-2); }
.btn-ghost { background: var(--white); color: var(--primary); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--primary); }
.btn-sm { padding: 7px 11px; font-size: .84rem; gap: 6px; }
.btn-sm .ic { width: 16px; height: 16px; }
.btn .dim { font-family: var(--font-mono); font-weight: 400; font-size: .78rem; opacity: .75; }
.icon-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line); background: var(--white); color: var(--ink-mid); cursor: pointer; }
.icon-btn:hover { color: var(--err); border-color: currentColor; }
.icon-btn .ic { width: 15px; height: 15px; }
.linkish { background: none; border: 0; padding: 0; color: var(--blue); text-decoration: underline; cursor: pointer; }

/* ---------- tags ---------- */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 600; background: var(--floor); color: var(--ink-mid); white-space: nowrap; }
.tag .ic { width: 13px; height: 13px; }
.tag-room { background: var(--blue-wash); color: #1846c4; }
.tag-sample { background: var(--warn-bg); color: var(--warn); }
.tag-done { background: var(--ok-bg); color: var(--ok); }

/* ---------- scan field ---------- */
.scan { position: relative; display: flex; align-items: center; gap: 10px; background: var(--white); border: 1.5px solid var(--line-strong); border-radius: 12px; padding: 0 6px 0 14px; transition: border-color .15s, box-shadow .15s; }
.scan:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(31, 94, 255, .14); }
.scan > .ic { color: var(--blue); width: 22px; height: 22px; }
.scan input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 12px 0; font-family: var(--font-mono); font-size: .95rem; }
.scan input::placeholder { font-family: var(--font-body); color: var(--ink-soft); }
.scan-lg { padding: 6px 6px 6px 18px; border-radius: 14px; box-shadow: var(--shadow-2); border-color: transparent; }
.scan-lg input { font-size: 1.15rem; padding: 14px 0; }
.scan-lg .btn { padding: 14px 22px; font-size: 1rem; }
.form-msg { min-height: 1.5em; margin: 10px 2px 0; color: var(--err); font-weight: 500; }

/* ---------- home ---------- */
.v-home { padding: 0 24px 64px; }
.home { max-width: 1160px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 24px 56px; }
.home-intro { padding: 64px 0 8px; align-self: center; }
.home-intro h1 { font-size: clamp(2.3rem, 4.6vw, 3.6rem); font-weight: 800; letter-spacing: -.03em; color: var(--primary); max-width: 14ch; }
.lead { font-size: 1.1rem; color: var(--ink-mid); max-width: 56ch; margin: 18px 0 30px; }
.lead b { color: var(--ink); }
.home-art { margin: 0; padding-top: 56px; position: relative; min-height: 300px; }
.art-floor { position: absolute; inset: 70px 70px auto 0; padding-bottom: 26px !important; background: var(--floor); border-radius: 18px; padding: 18px; display: grid; gap: 12px; align-content: start;
}
.art-lane { display: flex; align-items: center; gap: 8px; padding: 12px 12px 10px; border-radius: 12px; background: repeating-linear-gradient(90deg, var(--tape) 0 10px, transparent 10px 18px) 12px 0 / calc(100% - 24px) 3px no-repeat, rgba(255, 255, 255, .45); }
.art-lane span { font-family: var(--font-display); font-weight: 700; font-size: .9rem; color: var(--primary); width: 100px; }
.art-box { display: grid; place-items: center; width: 40px; height: 34px; border-radius: 6px; background: var(--white); box-shadow: inset 0 8px 0 #111, var(--shadow-1); padding-top: 8px; font: 700 .78rem var(--font-mono); font-style: normal; }
.art-label { position: absolute; right: 0; top: 30px; --in: 44px; transform: rotate(4deg); filter: drop-shadow(0 14px 28px rgba(10, 26, 51, .18)); }
.tickets { grid-column: 1 / -1; margin-top: 24px; }
.tickets-head { display: flex; align-items: baseline; gap: 14px; padding: 0 4px 12px; border-bottom: 1px solid var(--line); }
.tickets-head h2 { font-size: 1.35rem; color: var(--primary); }
.tk-list { list-style: none; margin: 0; padding: 0; }
.tk { display: grid; grid-template-columns: 110px minmax(0, 1.6fr) minmax(0, .9fr) minmax(0, 1.4fr) 20px; align-items: center; gap: 18px; padding: 14px 8px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: background-color .15s; }
.tk:hover { background: var(--white); }
.tk:hover .tk-go { color: var(--blue); transform: translateX(3px); }
.tk-no { font-weight: 700; font-size: 1rem; color: var(--primary); }
.tk-who { display: flex; flex-direction: column; min-width: 0; }
.tk-who b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-who > span { font-size: .84rem; color: var(--ink-mid); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-n { font-size: .88rem; color: var(--ink-mid); }
.tk-n b { color: var(--ink); font-weight: 600; }
.tk-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tk-date { font-size: .82rem; color: var(--ink-soft); min-width: 92px; text-align: right; }
.tk-go { color: var(--line-strong); transition: transform .2s var(--ease-out), color .15s; }
.tk-sample { background: linear-gradient(90deg, rgba(253, 243, 223, .7), transparent 60%); }
.tk-loading, .tk-empty { padding: 22px 8px; color: var(--ink-mid); display: flex; align-items: center; gap: 10px; }
.spin { width: 16px; height: 16px; border: 2px solid var(--line-strong); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.v-load { padding: 80px 24px; }
.loading { max-width: 560px; margin: 0 auto; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--ink-mid); }
.loading.err { flex-direction: column; color: var(--err); }

/* ---------- packing view ---------- */
.v-pack { padding-bottom: 92px; }
.tbar { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; padding: 14px 24px; background: var(--white); border-bottom: 1px solid var(--line); }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-mid); text-decoration: none; font-weight: 600; font-size: .88rem; padding: 6px 8px 6px 4px; border-radius: 8px; }
.back:hover { color: var(--primary); background: var(--surface); }
.tb-id { display: flex; flex-direction: column; gap: 2px; }
.tb-id .k, .tb-meta dt { font-size: .72rem; color: var(--ink-soft); font-weight: 600; }
.tb-id b { font-size: 1.45rem; color: var(--primary); line-height: 1.1; }
.tb-id .tag { margin-top: 4px; align-self: flex-start; }
.tb-ship { display: flex; flex-direction: column; min-width: 0; flex: 1 1 220px; padding-left: 22px; border-left: 1px solid var(--line); }
.tb-ship b { font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; }
.tb-ship span { font-size: .86rem; color: var(--ink-mid); }
.tb-meta { display: flex; gap: 22px; margin: 0; }
.tb-meta dd { margin: 2px 0 0; font-weight: 600; font-size: .9rem; }
.tb-progress { display: flex; flex-direction: column; gap: 6px; min-width: 200px; font-size: .84rem; color: var(--ink-mid); }
.tb-progress b { color: var(--ink); }
.meter { height: 8px; border-radius: 99px; background: var(--floor); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--blue); border-radius: inherit; transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform .5s var(--ease-out); }
.instr { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 24px; background: var(--warn-bg); color: var(--warn); font-size: .88rem; font-weight: 500; }

.pack-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr) 372px; align-items: start; min-height: calc(100vh - 60px - 82px - 76px); }

/* tray */
.tray { position: sticky; top: 60px; max-height: calc(100vh - 60px - 76px); display: flex; flex-direction: column; background: var(--white); border-right: 1px solid var(--line); }
.tray .scan { margin: 16px 16px 4px; }
.tray-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 10px; }
.tray-head h2 { font-size: 1.1rem; color: var(--primary); }
.tray-body { overflow-y: auto; padding: 0 8px 16px; overscroll-behavior: contain; }
.grp { padding: 4px 0 8px; }
.grp h3 { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 7px; padding: 10px 8px 6px; background: var(--white); font-size: .95rem; color: var(--primary); }
.grp h3 .ic { width: 16px; height: 16px; color: var(--blue); }
.grp h3 span { margin-left: auto; font: 500 .75rem var(--font-body); color: var(--ink-soft); }
.grp-none h3 { color: var(--warn); }
.grp-note { margin: 0 8px 6px; font-size: .8rem; color: var(--ink-mid); }
.ent { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; }
.ent:hover { background: var(--surface); }
.ent-main { display: flex; flex-direction: column; min-width: 0; }
.ent-id { font-size: .84rem; font-weight: 700; }
.ent-desc { font-size: .8rem; color: var(--ink-mid); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ent-rem { font-family: var(--font-mono); font-size: .8rem; color: var(--ink-soft); }
.ent-rem b { font-size: 1rem; color: var(--ink); }
.ent-act { display: flex; gap: 4px; }
.btn-mini { height: 30px; min-width: 38px; padding: 0 9px; border-radius: 7px; border: 1px solid var(--line-strong); background: var(--white); font-weight: 600; font-size: .8rem; cursor: pointer; }
.btn-mini:hover { border-color: var(--blue); color: var(--blue); }
.btn-mini.strong { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-mini.strong:hover { background: #1a4fd8; color: #fff; }
.btn-mini.sel { max-width: 112px; padding: 0 6px; }
.tray-done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 40px 20px; color: var(--ink-mid); }
.tray-done .ic { width: 34px; height: 34px; color: var(--ok); margin-bottom: 4px; }
.tray-done b { color: var(--ink); font-family: var(--font-display); font-size: 1.1rem; }

/* floor */
.floor { padding: 16px 20px 28px; min-width: 0; }
.floor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.floor-head h2 { font-size: 1.1rem; color: var(--primary); }
.room-form { display: flex; gap: 6px; }
.room-form input { width: 170px; padding: 7px 11px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--white); font-size: .86rem; }
.room-form input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31, 94, 255, .14); }
.lanes { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; align-items: start; }
.lanes > .floor-empty { grid-column: 1 / -1; }
.lane { position: relative; background: var(--floor); border-radius: 14px; padding: 12px 14px 14px; }
.lane::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; border: 2px dashed transparent;
  background: repeating-linear-gradient(90deg, var(--tape) 0 16px, transparent 16px 28px) 14px 0 / calc(100% - 28px) 3px no-repeat; }
.lane header { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.lane h3 { font-size: 1.32rem; font-weight: 800; letter-spacing: -.02em; color: var(--primary); }
.lane header > span { font-size: .8rem; color: var(--ink-mid); }
.lane header .icon-btn { margin-left: auto; align-self: center; }
.lane-boxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.boxc { display: flex; flex-direction: column; text-align: left; min-height: 152px; padding: 0; border: 0; border-radius: 9px; background: var(--white); box-shadow: var(--shadow-1); cursor: pointer; overflow: hidden; transition: box-shadow .2s, transform .2s var(--ease-out); }
.boxc:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.boxc.on { box-shadow: 0 0 0 3px var(--blue), var(--shadow-2); }
.boxc.empty { opacity: .8; }
.boxc-band { display: flex; flex-direction: column; gap: 3px; padding: 7px 10px 8px; background: #0d0d0d; color: #fff; }
.boxc-cap { display: flex; justify-content: space-between; font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.boxc-band b { font: 800 1.02rem/1 var(--font-display); text-transform: uppercase; letter-spacing: -.01em; line-height: 1.02; overflow-wrap: anywhere; }
.boxc-c { color: #a8a8a8; letter-spacing: 0; }
.boxc-body { flex: 1; display: flex; flex-direction: column; gap: 3px; padding: 9px 10px 4px; }
.boxc-row { display: flex; gap: 7px; font-size: .78rem; }
.boxc-row b { min-width: 20px; text-align: right; font-family: var(--font-mono); }
.boxc-row .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.boxc-more { font-size: .75rem; color: var(--ink-soft); }
.boxc-foot { padding: 6px 10px 8px; font-size: .74rem; font-weight: 600; color: var(--ink-mid); border-top: 1px dashed var(--line); }
.boxc.drop { animation: drop .55s var(--ease-out); }
@keyframes drop {
  0% { transform: translateY(-10px) scale(1.03); box-shadow: 0 0 0 3px var(--blue), 0 22px 36px rgba(10, 26, 51, .22); }
  60% { transform: translateY(1px) scale(.995); }
  100% { transform: none; }
}
.newbox { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 152px; border: 2px dashed var(--line-strong); border-radius: 9px; background: transparent; color: var(--ink-mid); font-weight: 600; font-size: .84rem; cursor: pointer; transition: border-color .15s, color .15s, background-color .15s; }
.newbox:hover { border-color: var(--blue); color: var(--blue); background: rgba(255, 255, 255, .6); }
.floor-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 44px 24px; background: var(--floor); border-radius: 14px; color: var(--ink-mid); }
.floor-empty > .ic { width: 34px; height: 34px; color: var(--blue); }
.floor-empty b { color: var(--ink); font-family: var(--font-display); font-size: 1.15rem; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; max-width: 560px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px 7px 9px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--white); font-size: .84rem; font-weight: 600; cursor: pointer; }
.chip .ic { width: 15px; height: 15px; color: var(--blue); }
.chip:hover { border-color: var(--blue); color: var(--blue); }

/* preview */
.preview { position: sticky; top: 60px; max-height: calc(100vh - 60px - 76px); overflow-y: auto; padding: 18px 20px 24px; background: var(--white); border-left: 1px solid var(--line); --in: 76px; }
.pv-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.pv-head h2 { font-size: 1.1rem; color: var(--primary); }
.pv-head .mono { font-size: .78rem; }
.pv-label { display: flex; justify-content: center; padding: 14px 0; background: var(--floor); border-radius: 12px; }
.pv-label .lbl { box-shadow: var(--shadow-2); }
.pv-row { display: flex; gap: 8px; margin: 12px 0 4px; }
.pv-row .btn { flex: 1; }
.pv-h { display: flex; align-items: baseline; gap: 8px; margin: 18px 0 8px; font-size: .95rem; color: var(--primary); }
.pv-h span { font: 500 .78rem var(--font-body); color: var(--ink-soft); }
.pv-contents { list-style: none; margin: 0; padding: 0; }
.pv-contents li { display: grid; grid-template-columns: 30px auto minmax(0, 1fr) 28px; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: .82rem; }
.pv-contents .q { font-family: var(--font-mono); font-weight: 700; text-align: right; }
.pv-contents .mono { font-weight: 600; }
.pv-contents .d { color: var(--ink-mid); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-none, .pv-more { font-size: .84rem; color: var(--ink-mid); }
.pv-items { display: grid; grid-template-columns: repeat(2, max-content); gap: 8px; --in: 76px; }
.pv-items .lbl { box-shadow: var(--shadow-1); outline: 1px solid var(--line); }
.pv-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 30px 12px; color: var(--ink-mid); font-size: .88rem; }
.pv-empty b { color: var(--ink); font-family: var(--font-display); font-size: 1.05rem; }
.ghost-label { width: 152px; height: 228px; border: 2px dashed var(--line-strong); border-radius: 10px; display: grid; place-items: center; margin-bottom: 12px; font: 600 .9rem var(--font-mono); color: var(--ink-soft); }

/* print bar */
.printbar { position: fixed; z-index: 25; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(10, 26, 51, .06); }
.pb-sum { display: flex; flex-direction: column; margin-right: auto; font-size: .82rem; color: var(--ink-mid); line-height: 1.3; }
.pb-sum b { color: var(--ink); font-size: .95rem; }
.seg { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 10px; background: var(--floor); }
.seg-k { font-size: .76rem; color: var(--ink-mid); font-weight: 600; padding: 0 8px 0 6px; }
.seg button { border: 0; background: transparent; padding: 7px 11px; border-radius: 7px; font-size: .82rem; font-weight: 600; color: var(--ink-mid); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--white); color: var(--primary); box-shadow: var(--shadow-1); }

/* toasts */
.toasts { position: fixed; z-index: 40; left: 50%; bottom: 88px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { padding: 10px 16px; border-radius: 10px; background: var(--primary); color: #fff; font-size: .88rem; box-shadow: var(--shadow-2); animation: toast-in .35s var(--ease-out); max-width: min(560px, calc(100vw - 32px)); }
.toast.warn { background: #6b4410; }
.toast.err { background: var(--err); }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- how ---------- */
.v-how { padding: 32px 24px 80px; }
.how { max-width: 760px; margin: 0 auto; }
.how h1 { font-size: clamp(2rem, 4vw, 2.8rem); font-weight: 800; color: var(--primary); margin-top: 18px; letter-spacing: -.025em; }
.how h2 { font-size: 1.3rem; color: var(--primary); margin: 40px 0 12px; }
.how p, .how li { line-height: 1.65; }
.chain { list-style: none; margin: 0; padding: 0; counter-reset: c; }
.chain li { position: relative; display: block; padding: 10px 0 10px 40px; border-bottom: 1px solid var(--line); }
.chain li > span:not(.mono) { display: block; margin-top: 2px; }
.chain li::before { counter-increment: c; content: counter(c); position: absolute; left: 0; top: 11px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-wash); color: #1846c4; font: 700 .78rem var(--font-mono); }
.chain li > span:not(.mono) { color: var(--ink-mid); font-size: .92rem; }
.chain .mono { font-weight: 600; font-size: .9rem; }
.how-labels { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: start; }
.how-labels figure { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.how-labels figcaption { font-size: .9rem; color: var(--ink-mid); max-width: 40ch; }
.how-labels figcaption b { color: var(--ink); }
.lbl-demo { --in: 70px; }
.lbl-demo .lbl { box-shadow: var(--shadow-2); outline: 1px solid var(--line); }
.plain { padding-left: 20px; }

/* ================================================================
   LABEL STOCK. All label geometry is in var(--in): 1in when printed,
   a pixel stand-in on screen, so the preview is the print.
   ================================================================ */
.lbl { background: #fff; color: #000; font-family: 'Inter', Arial, sans-serif; overflow: hidden; position: relative; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.lbl .bc { display: block; width: 100%; }

.lbl-box { width: calc(var(--in) * 4); height: calc(var(--in) * 6); border-radius: calc(var(--in) * .08); display: flex; flex-direction: column; }
.lb-band { background: #000; color: #fff; padding: calc(var(--in) * .14) calc(var(--in) * .2) calc(var(--in) * .16); }
.lb-cap { display: flex; justify-content: space-between; align-items: baseline; font-size: calc(var(--in) * .12); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.lb-cap b { font-family: 'Bricolage Grotesque', sans-serif; font-size: calc(var(--in) * .3); font-weight: 800; letter-spacing: 0; }
.lb-room { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; text-transform: uppercase; font-size: calc(var(--in) * var(--fs)); line-height: .92; letter-spacing: -.02em; white-space: nowrap; margin-top: calc(var(--in) * .06); }
.lb-room.wrap { white-space: normal; }
.lb-k { display: block; font-size: calc(var(--in) * .085); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; }
.lb-ship { display: flex; flex-direction: column; padding: calc(var(--in) * .12) calc(var(--in) * .2) calc(var(--in) * .1); border-bottom: calc(var(--in) * .02) solid #000; font-size: calc(var(--in) * .13); line-height: 1.25; }
.lb-ship b { font-size: calc(var(--in) * .17); line-height: 1.2; margin: calc(var(--in) * .02) 0 calc(var(--in) * .02); }
.lb-ship > b, .lb-ship > span:not(.lb-k) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* fixed height keeps the contents row count true */
.lb-grid { display: grid; grid-template-columns: 1.15fr 1.15fr 1fr .9fr; border-bottom: calc(var(--in) * .02) solid #000; }
.lb-grid > div { padding: calc(var(--in) * .07) calc(var(--in) * .08) calc(var(--in) * .07) calc(var(--in) * .2); border-right: calc(var(--in) * .01) solid #000; }
.lb-grid > div + div { padding-left: calc(var(--in) * .08); }
.lb-grid > div:last-child { border-right: 0; }
.lb-grid b { display: block; font-family: 'JetBrains Mono', monospace; font-size: calc(var(--in) * .14); font-weight: 700; white-space: nowrap; }
.lb-contents { flex: 1; min-height: 0; padding: calc(var(--in) * .08) calc(var(--in) * .2) 0; overflow: hidden; }
.lb-ch { display: flex; justify-content: space-between; margin-bottom: calc(var(--in) * .04); }
.lb-contents table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: calc(var(--in) * .118); }
.lb-contents td { padding: calc(var(--in) * .022) 0; border-bottom: calc(var(--in) * .006) solid #999; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-contents td.q { width: calc(var(--in) * .32); font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.lb-contents td.i { width: calc(var(--in) * 1.18); font-family: 'JetBrains Mono', monospace; font-weight: 700; }
.lb-more { font-size: calc(var(--in) * .1); font-weight: 600; margin-top: calc(var(--in) * .05); }
.lb-bc { padding: calc(var(--in) * .06) calc(var(--in) * .2) calc(var(--in) * .12); text-align: center; }
.lb-bc .bc { height: calc(var(--in) * .62); }
.lb-bc span { display: block; font-family: 'JetBrains Mono', monospace; font-size: calc(var(--in) * .11); font-weight: 600; margin-top: calc(var(--in) * .03); letter-spacing: .04em; }

.lbl-item { width: calc(var(--in) * 2); height: calc(var(--in) * 1); border-radius: calc(var(--in) * .05); display: flex; flex-direction: column; }
.li-room { background: #000; color: #fff; font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800; text-transform: uppercase; font-size: calc(var(--in) * var(--fs)); line-height: 1; padding: calc(var(--in) * .04) calc(var(--in) * .08) calc(var(--in) * .035); white-space: nowrap; overflow: hidden; letter-spacing: -.01em; }
.li-body { display: flex; flex-direction: column; padding: calc(var(--in) * .03) calc(var(--in) * .08) 0; min-width: 0; line-height: 1.15; }
.li-body b { font-family: 'JetBrains Mono', monospace; font-size: calc(var(--in) * .11); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-body span { font-size: calc(var(--in) * .085); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-foot { flex: 1; min-height: 0; display: flex; align-items: flex-end; gap: calc(var(--in) * .06); padding: 0 calc(var(--in) * .08) calc(var(--in) * .05); }
.li-foot .bc { height: calc(var(--in) * .3); flex: 1; min-width: 0; }
.li-foot span { font-size: calc(var(--in) * .085); font-weight: 700; text-align: right; line-height: 1.15; white-space: nowrap; text-transform: uppercase; }

#print-root { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .pack-grid { grid-template-columns: 320px minmax(0, 1fr); }
  .preview { grid-column: 1 / -1; position: static; max-height: none; border-left: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 28px; align-items: start; }
  .preview > .pv-head, .preview > .pv-label, .preview > .pv-row { grid-column: 1; }
  .preview > .pv-h, .preview > .pv-contents, .preview > .pv-items, .preview > .pv-more, .preview > .pv-none { grid-column: 2; }
  .preview > .pv-h:first-of-type { margin-top: 0; }
  .preview > .pv-empty { grid-column: 1 / -1; }
  .pv-items { grid-template-columns: repeat(auto-fill, calc(var(--in) * 2)); }
}
@media (max-width: 900px) {
  .home { grid-template-columns: minmax(0, 1fr); }
  .home-intro { padding-top: 36px; }
  .home-art { display: none; }
  .tk { grid-template-columns: 90px minmax(0, 1fr) 20px; gap: 4px 14px; }
  .tk-n { grid-column: 2; grid-row: 2; }
  .tk-tags { grid-column: 2; grid-row: 3; justify-content: flex-start; }
  .tk-go { grid-column: 3; grid-row: 1 / span 3; }
  .tk-date { text-align: left; min-width: 0; }
  .pack-grid { grid-template-columns: minmax(0, 1fr); }
  .tray { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .tray-body { max-height: 52vh; }
  .preview { display: block; }
  .tb-ship { padding-left: 0; border-left: 0; flex-basis: 100%; order: 3; }
  .tb-meta { order: 4; flex-wrap: wrap; gap: 14px; }
  .tb-progress { order: 5; flex-basis: 100%; }
}
@media (max-width: 640px) {
  .bar { padding: 0 16px; gap: 12px; }
  .brand-by, .bar-status span:last-child { display: none; }
  .bar-link { padding: 6px 10px; font-size: .82rem; }
  .v-home, .v-how { padding-left: 16px; padding-right: 16px; }
  .scan-lg { flex-wrap: wrap; padding: 6px; }
  .scan-lg > .ic { margin-left: 10px; }
  .scan-lg .btn { flex-basis: 100%; }
  .tbar { padding: 12px 16px; gap: 12px; }
  .instr { padding: 10px 16px; }
  .floor { padding: 14px 12px 24px; }
  .room-form { width: 100%; }
  .room-form input { flex: 1; width: auto; }
  .lane-boxes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .preview { padding: 16px 12px 24px; --in: 72px; }
  .pv-items { --in: 72px; grid-template-columns: repeat(2, max-content); justify-content: center; }
  .printbar { flex-wrap: wrap; padding: 10px 12px; gap: 8px; }
  .printbar .btn { flex: 1 1 40%; padding: 10px 8px; font-size: .84rem; }
  .pb-sum { flex: 1 1 auto; margin-right: 0; }
  .pb-sum { order: 0; }
  .seg { order: 1; flex: 0 0 auto; }
  .seg-k { display: none; }
  .printbar .btn { order: 2; }
  .v-pack { padding-bottom: 150px; }
  .toasts { bottom: 158px; }
  .how-labels { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- print ---------- */
@page { margin: 0; }
@page box { size: 4in 6in; margin: 0; }
@page item { size: 2in 1in; margin: 0; }
@media print {
  body { background: #fff; min-height: 0; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; --in: 1in; }
  #print-root .lbl { border-radius: 0; box-shadow: none; outline: 0; break-after: page; break-inside: avoid; }
  #print-root .lbl:last-child { break-after: auto; }
  #print-root .lbl-box { page: box; }
  #print-root .lbl-item { page: item; }
}
