/* ---------- Theme: quiet neutrals, one ink colour, hairline borders ---------- */
:root {
  --bg: #f7f7f5; --surface: #ffffff; --surface-2: #f0f0ee; --text: #1a1a19; --muted: #6f6f6b; --faint: #a3a39e;
  --ink: #1a1a19; --ink-text: #ffffff; --danger: #c2372f; --danger-soft: #fbeceb;
  --border: #e4e4e0; --border-strong: #d2d2cc; --focus: rgba(26, 26, 25, .14);
  --radius: 12px; --radius-sm: 8px; --tabbar: 60px;
  --safe-b: env(safe-area-inset-bottom); --safe-t: env(safe-area-inset-top);
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110; --surface: #1a1a19; --surface-2: #232321; --text: #ededea; --muted: #9c9c96; --faint: #6c6c67;
    --ink: #ededea; --ink-text: #111110; --danger: #f07167; --danger-soft: #3a1d1b;
    --border: #2a2a28; --border-strong: #3a3a37; --focus: rgba(237, 237, 234, .18);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-padding-top: 70px; }
body {
  margin: 0; font: 15px/1.5 var(--sans);
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; letter-spacing: -.005em;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg.i { display: block; flex: none; }
.mono { font-family: var(--mono); letter-spacing: 0; }

/* ---------- App bar ---------- */
#appbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 4px;
  min-height: 54px; padding: calc(6px + var(--safe-t)) 8px 6px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
}
#appbar .title { flex: 1; font-size: 1.05rem; font-weight: 600; padding-left: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#back + .title { padding-left: 0; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; color: var(--text);
  display: grid; place-items: center; flex: none; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.sm { width: 34px; height: 34px; color: var(--muted); }

main { max-width: 680px; margin: 0 auto; padding: 4px 16px calc(var(--tabbar) + 28px + var(--safe-b)); }

/* ---------- Tab bar ---------- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border); padding-bottom: var(--safe-b);
}
#tabbar .inner { display: flex; width: 100%; max-width: 520px; height: var(--tabbar); align-items: center; }
#tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none;
  font-size: .68rem; font-weight: 500; color: var(--faint); padding: 6px 0;
}
#tabbar a.active { color: var(--text); }
#tabbar a.add .ic { width: 34px; height: 26px; border-radius: 8px; background: var(--ink); color: var(--ink-text);
  display: grid; place-items: center; }
#tabbar a.add { color: var(--muted); }
#tabbar a.add.active { color: var(--text); }

/* ---------- Building blocks ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; min-width: 0; }
.section-title { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); margin: 26px 2px 8px; }
.lead { color: var(--muted); font-size: .9rem; margin: 2px 2px 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); text-decoration: none;
  font-weight: 500; cursor: pointer; white-space: nowrap; max-width: 100%; transition: background .12s, opacity .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { opacity: .8; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.btn.primary:hover { opacity: .9; }
.btn.danger { color: var(--danger); border-color: var(--border); background: transparent; }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.link { background: none; border: 0; padding: 0; color: var(--text); text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--border-strong); cursor: pointer; font: inherit; }

input, textarea, select {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 16px; outline: none; transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus, select:focus { border-color: var(--text); box-shadow: 0 0 0 3px var(--focus); }
textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.field { margin-bottom: 20px; }
.field > label, .field > .label { display: block; font-weight: 500; font-size: .85rem; margin: 0 1px 7px; }
.field .hint { font-size: .8rem; color: var(--muted); margin: 7px 1px 0; }
.opt { color: var(--faint); font-weight: 400; }

/* Chips (filters + pickers) */
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 1px 1px 6px; margin: 0 -1px; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none; height: 34px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: .85rem; font-weight: 500; cursor: pointer;
  white-space: nowrap; text-decoration: none; color: var(--text);
}
.chip .n { color: var(--faint); font-weight: 400; font-variant-numeric: tabular-nums; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--ink-text); }
.chip.on .n { color: inherit; opacity: .6; }
.chip.add { border-style: dashed; color: var(--muted); background: transparent; }
.chips-lead { align-self: center; color: var(--faint); padding: 0 2px 0 4px; flex: none; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 6px; font-size: .72rem; font-family: var(--sans);
  font-weight: 500; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.fragile { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1px currentColor; text-transform: uppercase;
  letter-spacing: .06em; font-weight: 600; font-size: .65rem; padding: 1px 6px; }

/* Loading */
.loading { display: grid; place-items: center; padding: 80px 0; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--text);
  animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Place picker / inline add */
.sub-label { font-weight: 500; font-size: .85rem; margin: 14px 1px 7px; }
.add-row { display: flex; gap: 8px; margin-top: 8px; }
.add-row input { flex: 1; min-width: 0; }
.add-row .btn { flex: none; }

/* Size picker */
.dims { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto; align-items: end; gap: 6px; margin-top: 10px; }
.dims label { display: block; font-size: .72rem; color: var(--muted); margin: 0 1px 4px; }
.dims input { text-align: center; font-variant-numeric: tabular-nums; padding: 10px 6px; }
.dims .x { color: var(--faint); padding-bottom: 11px; }
.dims .unit { color: var(--muted); padding-bottom: 11px; font-size: .85rem; }
.size-note { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .82rem; color: var(--muted);
  margin: 9px 1px 0; min-height: 20px; }
.size-note:empty { display: none; }
.size-note .sep { color: var(--faint); }

/* Toggle switch */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 2px 1px; font-weight: 500; }
.switch .spacer small { display: block; color: var(--muted); font-weight: 400; font-size: .8rem; }
.switch input { appearance: none; width: 44px; min-height: 0; height: 26px; padding: 0; border-radius: 99px; background: var(--border-strong);
  position: relative; flex: none; border: 0; cursor: pointer; transition: background .2s; }
.switch input:focus { box-shadow: 0 0 0 3px var(--focus); }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(18px); background: var(--ink-text); }
.divider { height: 1px; background: var(--border); margin: 18px -16px; }

/* ---------- List ---------- */
.searchbar { position: relative; margin: 4px 0 12px; }
.searchbar input { padding-left: 40px; padding-right: 40px; height: 46px; background: var(--surface); }
.searchbar input::-webkit-search-cancel-button { display: none; }
.searchbar .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.searchbar .clear { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.list-head { display: flex; align-items: center; gap: 8px; margin: 10px 2px 8px; font-size: .85rem; color: var(--muted); }
.list-head select { width: auto; min-height: 32px; padding: 3px 28px 3px 10px; font-size: 16px; border-radius: 8px; border-color: var(--border);
  background: var(--surface); color: var(--text); }
.group-title { display: flex; align-items: baseline; gap: 8px; font-size: .75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted); margin: 22px 2px 8px; }
.group-title .n { color: var(--faint); font-weight: 400; }

.list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.box-item { display: flex; gap: 14px; align-items: center; text-decoration: none; padding: 12px 14px; border-top: 1px solid var(--border); }
.box-item:first-child { border-top: 0; }
.box-item:hover { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.thumb { width: 52px; height: 52px; border-radius: var(--radius-sm); background: var(--surface-2); object-fit: cover; flex: none;
  display: grid; place-items: center; overflow: hidden; color: var(--faint); }
.box-item .info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.box-item .top { display: flex; gap: 8px; align-items: center; }
.box-item .id { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.box-item .desc { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.box-item .meta { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.box-item .meta .dot { color: var(--faint); margin: 0 5px; }
.box-item .match { font-size: .8rem; color: var(--muted); }
.box-item .chev { color: var(--faint); }
mark { background: #fde68a; color: #1a1a19; border-radius: 2px; padding: 0 1px; }

.empty { text-align: center; padding: 56px 20px; }
.empty .big { width: 52px; height: 52px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
  display: grid; place-items: center; margin: 0 auto 16px; color: var(--muted); }
.empty h2 { margin: 0 0 6px; font-size: 1.1rem; font-weight: 600; }
.empty p { margin: 0 auto 20px; max-width: 320px; color: var(--muted); font-size: .92rem; }

/* ---------- Detail ---------- */
.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 -16px 18px; padding: 0 16px; }
.gallery::-webkit-scrollbar { display: none; }
.gallery img { height: 260px; max-width: 85%; flex: none; scroll-snap-align: center; border-radius: var(--radius);
  object-fit: cover; background: var(--surface-2); cursor: zoom-in; aspect-ratio: 3/4; }
.gallery img:only-child { max-width: 100%; width: 100%; aspect-ratio: auto; }
.hero-empty { height: 120px; border-radius: var(--radius); display: flex; gap: 10px; align-items: center; justify-content: center;
  margin-bottom: 18px; border: 1px dashed var(--border-strong); cursor: pointer; color: var(--muted); font-size: .9rem; }
.hero-empty:hover { background: var(--surface); }
.detail-head { margin: 0 2px 18px; }
.detail-head .id { font-family: var(--mono); font-size: .8rem; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.detail-head .desc { font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; margin: 4px 0 0; }
.info-row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-top: 1px solid var(--border); }
.info-row:first-child { border-top: 0; padding-top: 0; }
.info-row:last-child { padding-bottom: 0; }
.info-row > .i { color: var(--faint); margin-top: 1px; }
.info-row .k { font-size: .75rem; color: var(--muted); margin-bottom: 2px; }
.info-row a { text-decoration: none; font-weight: 500; }
.info-row a:hover { text-decoration: underline; }
.info-row .sub { color: var(--muted); font-size: .85rem; }
.contents-list { margin: 4px 0 0; padding-left: 18px; }
.contents-list li { padding: 1px 0; }
.contents-list li::marker { color: var(--faint); }
.pre { white-space: pre-wrap; }
.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.actions .btn { flex-direction: column; height: 64px; gap: 5px; font-size: .75rem; padding: 0 4px; color: var(--text); }
.actions .btn .i { color: var(--muted); }
.meta-lines { font-size: .8rem; color: var(--muted); display: grid; gap: 2px; margin: 18px 2px 0; }

/* ---------- Form ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin-bottom: 10px; }
.photo-grid:empty { display: none; }
.photo-grid .ph { position: relative; aspect-ratio: 1; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); }
.photo-grid .del { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #fff; cursor: pointer; display: grid; place-items: center; }
.photo-grid .new::after { content: 'new'; position: absolute; left: 5px; bottom: 5px; font-size: .65rem; font-weight: 600;
  background: rgba(0,0,0,.6); color: #fff; padding: 0 6px; border-radius: 4px; }
.sticky-save { position: sticky; bottom: calc(var(--tabbar) + var(--safe-b) + 10px); z-index: 5; display: flex; gap: 8px;
  padding: 8px; margin: 0 -4px; border-radius: 14px; background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,.06); }
.sticky-save .btn { flex: 1; }

/* ---------- Sheet & lightbox & toast ---------- */
.backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(10, 10, 10, .4); display: flex; align-items: flex-end;
  justify-content: center; animation: fade .15s; }
.sheet-panel { width: 100%; max-width: 520px; background: var(--surface); border-radius: 16px 16px 0 0; padding: 10px 20px calc(20px + var(--safe-b));
  animation: up .22s cubic-bezier(.2,.8,.2,1); max-height: 88vh; overflow: auto; }
@media (min-width: 600px) {
  .backdrop { align-items: center; }
  .sheet-panel { border-radius: 16px; padding-bottom: 20px; }
  .sheet-panel .grab { display: none; }
}
.sheet-panel .grab { width: 36px; height: 4px; border-radius: 9px; background: var(--border-strong); margin: 0 auto 14px; }
.sheet-panel h3 { margin: 6px 0 14px; font-size: 1.1rem; font-weight: 600; }
.sheet-panel p.muted { margin-top: -6px; font-size: .9rem; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

#lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.95); display: flex; align-items: center; justify-content: center;
  touch-action: pan-y; }
#lightbox img { max-width: 100vw; max-height: 100vh; object-fit: contain; user-select: none; }
#lightbox .nav, #lightbox .close { position: absolute; color: #fff; background: rgba(255,255,255,.1); border-radius: 50%; }
#lightbox .nav { top: 50%; transform: translateY(-50%); }
#lightbox .prev { left: 10px; } #lightbox .next { right: 10px; }
#lightbox .close { top: calc(10px + var(--safe-t)); right: 10px; }
#lightbox .count { position: absolute; bottom: calc(16px + var(--safe-b)); color: #fff; opacity: .7; font-size: .85rem; font-variant-numeric: tabular-nums; }

#toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + 18px + var(--safe-b)); transform: translateX(-50%); z-index: 80;
  background: var(--ink); color: var(--ink-text); padding: 10px 16px; border-radius: 10px; font-size: .9rem; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.15); animation: up .2s; max-width: 90vw; }
#offline { background: var(--surface-2); color: var(--muted); text-align: center; font-size: .8rem; padding: 6px; border-bottom: 1px solid var(--border); }

/* ---------- Login ---------- */
.login { max-width: 340px; margin: 14vh auto 0; text-align: center; }
.login .big { margin-bottom: 20px; }
.login h1 { margin: 0 0 6px; font-size: 1.4rem; font-weight: 600; letter-spacing: -.02em; }
.login p { color: var(--muted); margin: 0 0 24px; font-size: .92rem; }
.login input { margin-bottom: 10px; }
.login .err { color: var(--danger); font-weight: 500; }
body.locked #tabbar, body.locked #appbar { display: none; }

/* ---------- Scan ---------- */
.scanner { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 3/4; max-height: 62vh; width: 100%; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner .frame { position: absolute; inset: 20%; border: 2px solid rgba(255,255,255,.85); border-radius: 18px;
  box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); }
.scanner .msg { position: absolute; left: 0; right: 0; bottom: 16px; text-align: center; color: #fff; font-size: .9rem;
  text-shadow: 0 1px 4px rgba(0,0,0,.7); padding: 0 12px; }

/* ---------- Manage lists (places, box types) ---------- */
.mrow { display: flex; align-items: center; gap: 4px; padding: 10px 6px 10px 16px; border-top: 1px solid var(--border); }
.mrow:first-child { border-top: 0; }
.mrow .name { font-weight: 500; }
.mrow .sub { font-size: .8rem; color: var(--muted); }
.mrow .sub a { color: var(--muted); }
.mrow.child { padding-left: 34px; }
.mrow.child .name { font-weight: 400; }
.mrow.foot { padding: 6px 8px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0; padding: 0; overflow: hidden; }
.stats > div { padding: 14px 16px; border-top: 1px solid var(--border); }
.stats > div:nth-child(-n+2) { border-top: 0; }
.stats > div:nth-child(even) { border-left: 1px solid var(--border); }
.stats .v { font-size: 1.4rem; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stats .l { font-size: .78rem; color: var(--muted); }
.menu { padding: 0; overflow: hidden; }
.menu a, .menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px 13px 16px; border: 0; background: none;
  border-top: 1px solid var(--border); text-decoration: none; cursor: pointer; text-align: left; font: inherit; color: var(--text); }
.menu > :first-child { border-top: 0; }
.menu a:hover, .menu button:hover { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.menu .i { color: var(--muted); }
.menu .spacer + .i { color: var(--faint); }
.menu .val { color: var(--muted); font-size: .85rem; }
.menu .danger, .menu .danger .i { color: var(--danger); }

/* ---------- Labels (screen) ---------- */
.sel-item { display: flex; gap: 12px; align-items: center; padding: 11px 14px; border-top: 1px solid var(--border); cursor: pointer; }
.sel-item:first-child { border-top: 0; }
.sel-item input { width: 18px; height: 18px; min-height: 0; accent-color: var(--ink); flex: none; }
.sel-item .t { flex: 1; min-width: 0; }
.sel-item .t div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.print-bar { position: sticky; bottom: calc(var(--tabbar) + var(--safe-b) + 10px); z-index: 5; }
.preview-wrap { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.preview-wrap .sheet { zoom: .42; box-shadow: 0 2px 16px rgba(0,0,0,.12); }
@media (max-width: 520px) { .preview-wrap .sheet { zoom: .4; } }
details.card summary { cursor: pointer; font-weight: 500; list-style: none; display: flex; align-items: center; }
details.card summary::-webkit-details-marker { display: none; }
details.card summary::after { content: ''; margin-left: auto; width: 7px; height: 7px; border-right: 1.5px solid var(--faint);
  border-bottom: 1.5px solid var(--faint); transform: rotate(-45deg); transition: transform .2s; }
details.card[open] summary::after { transform: rotate(45deg); }

/* ---------- Labels (the printed thing): 4 per A4 ---------- */
.sheet { width: 210mm; height: 297mm; display: grid; grid-template-columns: 105mm 105mm; grid-template-rows: 148.5mm 148.5mm;
  background: #fff; color: #000; font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif; }
.plabel { border: .3mm dashed #c8c8c8; padding: 7mm 8mm; display: flex; flex-direction: column; align-items: center;
  text-align: center; overflow: hidden; position: relative; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.plabel.blank { border-color: #eee; }
.plabel .qr { width: 72mm; height: 72mm; margin-top: 4mm; }
.plabel .qr svg { width: 100%; height: 100%; display: block; }
.plabel .lid { font-size: 34pt; font-weight: 800; margin-top: 4mm; letter-spacing: .5pt; line-height: 1; word-break: break-all; }
.plabel .ldesc { font-size: 15pt; margin-top: 3mm; line-height: 1.2; max-height: 3.6em; overflow: hidden; font-weight: 500; }
.plabel .foot { margin-top: auto; display: flex; justify-content: center; align-items: center; align-self: stretch;
  font-size: 10pt; color: #444; gap: 4mm; }
.plabel .frag { border: .6mm solid #000; padding: .8mm 2.5mm; font-weight: 800; font-size: 11pt; letter-spacing: 1pt; color: #000; }

@page { size: A4; margin: 0; }
@media print {
  html, body { background: #fff !important; }
  body > *:not(main), main > *:not(#print-area) { display: none !important; }
  main { padding: 0 !important; max-width: none; margin: 0; }
  .preview-wrap { display: block; gap: 0; }
  .preview-wrap .sheet { zoom: 1; box-shadow: none; break-after: page; page-break-after: always; }
  .preview-wrap .sheet:last-child { break-after: auto; page-break-after: auto; }
}
