
  :root {
    --ink: #3A2A22;
    --paper: #FFFDF8;
    --muted: #8a7c6f;
    --accent: #C89A5A;
  }
  * { box-sizing: border-box; }
  body {
    margin: 0;
    padding: 24px;
    background: #ece7e0;
    font-family: "Jua", "ZCOOL KuaiLe", sans-serif;
    color: var(--ink);
  }
  h1 {
    font-family: "Jua", "ZCOOL KuaiLe", sans-serif;
    font-size: 28px;
    margin: 0 0 4px;
  }
  .subtitle { color: var(--muted); font-size: 14px; margin-bottom: 20px; }

  .toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid #ddd3c4;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 20px;
  }
  .toolbar input[type=file] { font-size: 14px; }
  .toolbar button {
    font-family: inherit;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    padding: 9px 16px;
    cursor: pointer;
    background: var(--ink);
    color: #fff;
  }
  .toolbar button:disabled { background: #bbb; cursor: not-allowed; }
  .toolbar .count { font-size: 14px; color: var(--muted); margin-left: auto; }

  .error {
    display: none;
    background: #fff2f0;
    border: 1px solid #e6a49a;
    color: #9c3b2e;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 14px;
    margin-bottom: 20px;
    white-space: pre-wrap;
  }

  .sheet {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
  }

  .receipt {
    width: 58mm;
    background: var(--paper);
    border: 1px solid #ddd3c4;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    padding: 6mm 4mm;
    font-family: "Jua", "ZCOOL KuaiLe", sans-serif;
    font-size: 11px;
    line-height: 1.6;
    position: relative;
    transition: opacity .15s;
  }
  .receipt.excluded { opacity: 0.35; }

  .receipt .toggle {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--muted);
  }

  .receipt .logo { width: 100%; display: block; margin-bottom: 4mm; }
  .receipt .order-no {
    text-align: center;
    font-weight: 500;
    font-size: 17px;
    letter-spacing: 0.5px;
    margin-bottom: 1mm;
  }
  .receipt .meta {
    text-align: center;
    font-size: 11px;
    color: var(--ink);
    margin-bottom: 3mm;
  }
  .receipt hr {
    border: none;
    border-top: 1px dashed #b8ac9a;
    margin: 3mm 0;
  }
  .receipt .item-line {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    font-size: 11px;
    margin-bottom: 1.5mm;
  }
  .receipt .item-line .name { flex: 1; }
  .receipt .item-line .price { white-space: nowrap; }
  .receipt .total-line {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 13px;
    margin-top: 1mm;
  }
  .receipt .note {
    margin-top: 3mm;
    font-size: 10.5px;
    color: var(--ink);
    word-break: break-word;
  }
  .receipt .note .label { color: var(--muted); }
  .receipt .footer {
    text-align: center;
    margin-top: 4mm;
    font-size: 9px;
    color: var(--muted);
  }

  @media print {
    body { background: #fff; padding: 0; }
    .toolbar, .subtitle, h1, .error { display: none !important; }
    .sheet { display: block; }
    .receipt {
      box-shadow: none;
      border: none;
      background: #fff;
      width: 58mm;
      page-break-after: always;
    }
    .receipt.excluded { display: none !important; }
    .receipt .toggle { display: none !important; }
    @page { size: 58mm auto; margin: 0; }
  }

body {font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;max-width:1200px;margin:auto;padding:32px 24px}
h1{font-family:inherit;font-size:26px;margin:0}header{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:28px}
.brand{font-size:12px;letter-spacing:3px;margin-bottom:8px}.toolbar{margin-bottom:16px}.toolbar button{font-size:16px;min-height:44px}.toolbar input{max-width:100%}.secondary{background:#fff!important;color:var(--ink)!important;border:1px solid #b8ac9a!important}
.subtitle,.count,#connection,#status{font-size:14px;line-height:1.6}#status{margin:16px 0}#empty{padding:60px 24px;text-align:center;border:1px dashed #b8ac9a;border-radius:10px;color:#706254}.receipt{background:#fff}.receipt .toggle{position:static;justify-content:flex-end;margin-bottom:8px;font:14px sans-serif}.receipt input{width:18px;height:18px}.receipt .logo{margin-top:6px}.receipt .note{white-space:pre-wrap}
#connection{margin-top:8px;max-width:360px}button{cursor:pointer}button:disabled{cursor:default}.sheet{align-items:flex-start}.server-preview{width:100%;display:block}.receipt:has(.server-preview){padding:10px;width:240px}.receipt .label{font:14px sans-serif;overflow-wrap:anywhere}
@media(max-width:600px){body{padding:20px 14px}header{display:block}header>div:last-child{margin-top:20px}.toolbar{align-items:stretch}.toolbar button{flex:1}.sheet{justify-content:center}h1{font-size:24px}}
@media print{header,#status,#empty{display:none!important}.receipt{break-inside:avoid}.receipt:has(.server-preview){width:58mm;padding:0}.receipt .label{display:none}}
