/* 管理后台：电脑与平板优先，手机可用 */
body { font-size: 14px; }
.layout { display: grid; grid-template-columns: 200px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: var(--paper); padding: 20px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { padding: 0 20px 20px; font-family: var(--serif); font-size: 18px; letter-spacing: 0.3em; }
.side .brand small { display: block; font-family: var(--sans); font-size: 11px; letter-spacing: 0.1em; opacity: 0.6; margin-top: 4px; }
.side a { display: flex; justify-content: space-between; padding: 10px 20px; color: rgba(244, 239, 231, 0.75); text-decoration: none; }
.side a:hover { color: var(--paper); }
.side a.on { color: var(--paper); background: rgba(244, 239, 231, 0.08); box-shadow: inset 2px 0 0 var(--lamp); }
.side .who { padding: 20px; font-size: 12px; opacity: 0.7; border-top: 1px solid rgba(244, 239, 231, 0.12); margin-top: 16px; }
.side .who button { min-height: 30px; padding: 0 10px; margin-top: 8px; font-size: 12px; background: transparent; color: var(--paper); border-color: rgba(244, 239, 231, 0.3); }
.main { padding: 24px 28px 64px; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head h1 { margin: 0; }
.bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.bar input, .bar select { width: auto; min-width: 160px; min-height: 38px; }
.bar button, .main button { min-height: 38px; padding: 0 14px; }
button.sm { min-height: 30px; padding: 0 10px; font-size: 13px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--linen); padding: 14px 16px; border-radius: var(--radius); text-decoration: none; display: block; }
.stat .k { font-size: 12px; color: var(--stone-ink); }
.stat .v { font-family: var(--serif); font-size: 26px; color: var(--ink); margin-top: 2px; }
.stat.alert .v { color: var(--ochre); }
.panel { background: #FBF8F3; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; min-width: 0; }
.panel h2 { font-size: 16px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.table-wrap { overflow-x: auto; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--linen); }
td .thumb { width: 40px; height: 50px; object-fit: cover; background: var(--linen); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

dialog { border: 0; padding: 0; width: min(760px, calc(100vw - 24px)); max-height: 90vh; background: var(--paper); color: var(--ink); border-radius: var(--radius); }
dialog::backdrop { background: rgba(30, 22, 15, 0.5); }
dialog .inner { padding: 20px 24px; max-height: 90vh; overflow-y: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.sku-table input, .sku-table select { min-height: 34px; padding: 4px 6px; font-size: 13px; }
.sku-table td { padding: 4px; }
.imgs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.imgs figure { margin: 0; position: relative; }
.imgs img { width: 72px; height: 90px; object-fit: cover; background: var(--linen); }
.imgs figure button { position: absolute; top: 2px; right: 2px; min-height: 22px; width: 22px; padding: 0; font-size: 12px; }

.pos { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
.pos .results { max-height: 60vh; overflow-y: auto; }
.pos .ticket { position: sticky; top: 16px; }
.total { font-family: var(--serif); font-size: 30px; }
.chart { width: 100%; height: 140px; }
.call { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); margin-bottom: 8px; border-radius: var(--radius); }
.call.open { border-color: var(--ochre); background: #F7EDE3; }
.call .room { font-family: var(--serif); font-size: 26px; min-width: 64px; }

.login { max-width: 360px; margin: 12vh auto; padding: 32px; background: #FBF8F3; border: 1px solid var(--line); }
.login h1 { letter-spacing: 0.3em; text-align: center; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; display: flex; overflow-x: auto; padding: 0; }
  .side .brand, .side .who { display: none; }
  .side a { white-space: nowrap; padding: 12px 14px; }
  .main { padding: 16px; }
  .two, .pos, .grid2, .grid3 { grid-template-columns: 1fr; }
}
@media print {
  .side, .no-print { display: none !important; }
  .layout { display: block; }
}

/* ---------- 吊牌打印 ---------- */
.labels { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.lab-view { position: sticky; top: 16px; }
.lab-picked { max-height: 360px; overflow: auto; }
.lab-results { max-height: 280px; overflow: auto; margin-top: 8px; }
.lab-fields { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 10px; }
.chk { display: flex; gap: 6px; align-items: center; margin: 0; cursor: pointer; }
.chk input { width: auto; min-height: 0; }
.chk.off { opacity: 0.45; cursor: default; }
.lab-stage { background: var(--linen); padding: 20px; overflow: auto; display: grid; place-items: center; min-height: 220px; max-height: 70vh; border-radius: var(--radius); }
.lab-paper { background: #fff; box-shadow: 0 1px 3px rgba(42, 32, 24, 0.25); overflow: hidden; flex: none; }
.lab-nav { margin-top: 8px; }
.lab-warn { color: var(--ochre); margin: 6px 0 0; }
.lab-measure { position: absolute; left: -10000px; top: 0; visibility: hidden; }

/* 标签本体：只用纯黑，尺寸全部用毫米，屏幕预览与打印共用 */
.lbl { box-sizing: border-box; background: #fff; color: #000; overflow: hidden; display: flex; flex-direction: column; font-family: var(--sans); line-height: 1.2; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.lbl .l-top { display: flex; gap: 0.5em; flex: 1; min-height: 0; }
.lbl .l-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.12em; overflow: hidden; }
.lbl .l-shop { font-family: var(--serif); font-size: max(0.82em, 1.9mm); letter-spacing: 0.25em; font-weight: 600; white-space: nowrap; }
.lbl .l-title { font-weight: 700; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lbl .l-price { font-size: 1.9em; font-weight: 700; line-height: 1.05; margin-top: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lbl .l-small { font-size: max(0.82em, 1.9mm); }
.lbl .l-qr { flex: none; display: flex; flex-direction: column; align-items: center; }
.lbl .l-qr img { display: block; filter: grayscale(1); }
.lbl .l-qr-ph { box-sizing: border-box; border: 0.3mm dashed #000; display: grid; place-items: center; font-size: max(0.8em, 1.9mm); }
.lbl .l-hint { font-size: max(0.8em, 1.9mm); white-space: nowrap; margin-top: 0.15em; }
.lbl .l-bar { flex: none; display: flex; flex-direction: column; align-items: center; margin-top: 0.4em; }
.lbl .l-bar svg { display: block; }
.lbl .l-digits { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: max(0.85em, 1.9mm); letter-spacing: 0.12em; line-height: 1.15; margin-top: 0.12em; }
.lbl.tall { text-align: center; }
.lbl.tall .l-text { flex: none; align-items: center; }
.lbl.tall .l-price { margin-top: 0.15em; }
.lbl.tall .l-qr { margin: 0.6em auto 0; }
.lbl.tall .l-extra { margin-top: 0.4em; }
.lbl.tall .l-bar { margin-top: auto; }

@media screen { #label-print { display: none; } }
@media print {
  body.printing-labels { margin: 0; padding: 0; background: #fff; }
  body.printing-labels > *:not(#label-print) { display: none !important; }
  #label-print .lbl { break-after: page; page-break-after: always; }
  #label-print .lbl:last-child { break-after: auto; page-break-after: auto; }
}
@media (max-width: 1100px) { .labels { grid-template-columns: 1fr; } .lab-view { position: static; } }
