
  :root {
    --primary: #e85d04;
    --primary-deep: #d00000;
    --primary-soft: #ff7b2e;
    --accent: #f48c06;
    --bg: #fff5f0;
    --bg2: #ffe8dc;
    --card: rgba(255,255,255,0.72);
    --text: #1f2937;
    --muted: #6b7280;
    --border: rgba(255,255,255,0.55);
    --member: #059669;
    --price: #d00000;
    --glass: rgba(255,255,255,0.55);
    --glass-border: rgba(255,255,255,0.65);
    --shadow: 0 8px 32px rgba(232,93,4,0.12);
  }
  * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(165deg, #fff8f3 0%, #ffe5d4 40%, #ffd4c0 100%);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(135deg, #e85d04 0%, #f48c06 50%, #d00000 100%);
    color: white;
    padding: 6px 12px 8px;
    padding-top: calc(6px + env(safe-area-inset-top));
    box-shadow: 0 4px 20px rgba(208,0,0,0.25);
    backdrop-filter: saturate(1.2) blur(12px);
    -webkit-backdrop-filter: saturate(1.2) blur(12px);
  }
  .header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }
  .header-top > div:first-child {
    min-width: 0;
    flex: 1 1 auto;
  }
  .header h1 { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 42vw; }
  .header-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex: 0 0 auto;
    min-width: max-content;
  }
  .icon-btn {
    background: rgba(255,255,255,0.22);
    border: 1px solid rgba(255,255,255,0.28);
    color: white;
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  }
  .header-actions .icon-btn[style*="display:none"] { display:none !important; }
  #langBtn, #sysMarkBtn, #uploadBtn, #recentBtn, #undoEditBtn, #hikeDueBtn, #fontBtn { display:none !important; }
  #refreshBtn {
    order: -10;
    background: rgba(255,255,255,0.34);
    border-color: rgba(255,255,255,0.5);
    box-shadow: 0 2px 10px rgba(0,0,0,0.14);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  #refreshBtn.syncing { animation: qsv3RefreshSpin .9s linear infinite; }
  @keyframes qsv3RefreshSpin { from { transform:rotate(0deg); } to { transform:rotate(360deg); } }
  .icon-btn:active { background: rgba(255,255,255,0.4); }
  #offlineBar {
    display:none; margin:6px 10px 0; padding:7px 10px; border-radius:10px;
    background:#fff7ed; border:1px solid #fdba74; color:#9a3412;
    font-size:12px; font-weight:700; line-height:1.35;
  }
  #offlineBar.on { display:block; }
  @media (max-width: 430px) {
    .header { padding-left: 8px; padding-right: 8px; }
    .header-top { gap: 4px; margin-bottom: 6px; }
    .header-top > div:first-child { min-width: 0; overflow: hidden; }
    .header-actions { gap: 4px; }
    .icon-btn { width: 34px; min-width:34px; height:34px; border-radius:11px; font-size:15px; }
    .header h1 { font-size:13px; max-width:25vw; }
    .sync-status { max-width:24px; font-size:0; overflow:visible; }
    .sync-status::before { content:'☁️'; font-size:12px; }
    .sync-status.error::before { content:'⚠️'; }
    .sync-status.syncing::before { content:'⟳'; }
  }
  @media (max-width: 360px) {
    .header h1 { max-width:20vw; }
    .header-actions { gap:3px; }
    .icon-btn { width:38px; min-width:38px; height:38px; }
  }
  .search-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
  }
  .search-box { position: relative; flex: 1; min-width: 0; margin-bottom: 0; }
  .search-box input {
    width: 100%;
    padding: 8px 36px 8px 12px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    background: white;
    color: #111;
  }
  .search-box .clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #9ca3af;
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 13px;
    line-height: 20px;
    text-align: center;
    cursor: pointer;
    display: none;
  }
  .scan-inline-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    background: rgba(255,255,255,0.95);
    color: #e85d04;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(232,93,4,0.2);
  }
  .scan-inline-btn:active { background: #fff0e6; transform: scale(0.96); }

  .card-with-thumb {
    display: flex;
    gap: 10px;
    align-items: flex-start;
  }
  .card-thumb-wrap {
    position: relative;
    flex-shrink: 0;
  }
  .card-thumb-wrap .fav-btn {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    font-size: 14px;
    background: rgba(255,255,255,0.94);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  }
  .card-detail { margin-top: 10px; }
  .card-thumb {
    flex-shrink: 0;
    width: 88px;
    height: 88px;
    border-radius: 12px;
    object-fit: cover;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(232,93,4,0.25);
    touch-action: manipulation;
  }
  .card-thumb:active { opacity: 0.85; transform: scale(0.97); }
  #thumbZoomPopup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100002;
    background: rgba(0,0,0,0.82);
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
  }
  #thumbZoomPopup.show { display: flex; }
  #thumbZoomPopup .box {
    background: #0a0a0a;
    border-radius: 14px;
    padding: 10px 10px 12px;
    width: min(100vw - 8px, 980px);
    max-height: 94vh;
    text-align: center;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  #thumbZoomPopup img {
    width: 100%;
    max-width: 100%;
    max-height: 82vh;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    background: #000;
    image-rendering: auto;
  }
  #thumbZoomPopup .caption {
    color: #e5e7eb;
    font-size: 13px;
    margin: 10px 0 8px;
    word-break: break-word;
  }
  #thumbZoomPopup .btn-close {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: #e85d04;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
  }
  #cropModal .modal { max-width: 430px; }
  .crop-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    max-height: 62vh;
    overflow: hidden;
    background: #111;
    border-radius: 12px;
    touch-action: none;
    user-select: none;
  }
  .crop-stage img {
    position: absolute;
    max-width: none;
    pointer-events: none;
    user-select: none;
  }
  .crop-selection {
    position: absolute;
    box-sizing: border-box;
    border: 2px solid #fff;
    box-shadow: 0 0 0 9999px rgba(0,0,0,.48);
    cursor: move;
    touch-action: none;
  }
  .crop-selection .grid-v, .crop-selection .grid-h {
    position: absolute; opacity: .45; pointer-events: none;
  }
  .crop-selection .grid-v { top: 0; bottom: 0; width: 1px; border-left: 1px solid #fff; }
  .crop-selection .grid-h { left: 0; right: 0; height: 1px; border-top: 1px solid #fff; }
  .crop-handle {
    position: absolute; width: 18px; height: 18px; border: 2px solid #fff;
    background: rgba(255,255,255,.95); border-radius: 50%; box-sizing: border-box;
    touch-action: none; z-index: 2;
  }
  .crop-handle.nw { left: -10px; top: -10px; cursor: nwse-resize; }
  .crop-handle.n  { left: 50%; top: -10px; margin-left: -9px; cursor: ns-resize; }
  .crop-handle.ne { right: -10px; top: -10px; cursor: nesw-resize; }
  .crop-handle.e  { right: -10px; top: 50%; margin-top: -9px; cursor: ew-resize; }
  .crop-handle.se { right: -10px; bottom: -10px; cursor: nwse-resize; }
  .crop-handle.s  { left: 50%; bottom: -10px; margin-left: -9px; cursor: ns-resize; }
  .crop-handle.sw { left: -10px; bottom: -10px; cursor: nesw-resize; }
  .crop-handle.w  { left: -10px; top: 50%; margin-top: -9px; cursor: ew-resize; }
  .crop-tools { margin-top: 10px; }
  .crop-tools input[type=range] { width: 100%; }
  .drive-box {
    margin-top: 12px;
    padding: 10px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 12px;
  }
  .drive-box label { font-size: 12px; color: #4338ca; font-weight: 700; display: block; margin-bottom: 4px; }
  .drive-box input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #c7d2fe;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 8px;
  }
  .drive-status { font-size: 12px; color: #3730a3; margin: 4px 0 0; }
  .card-thumb.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #d1d5db;
  }
  .card-body { flex: 1; min-width: 0; }
  .edit-thumb-box {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
    padding: 10px;
    background: #fff7ed;
    border-radius: 12px;
    border: 1px solid #fed7aa;
  }
  .edit-thumb-preview {
    width: 120px;
    height: 120px;
    border-radius: 14px;
    object-fit: cover;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
  }
  .edit-thumb-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
  }
  .edit-thumb-actions button {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
  }
  .edit-thumb-box { flex-wrap: wrap; }
  .edit-thumb-strip {
    width: 100%;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 2px 2px;
  }
  .edit-thumb-chip {
    position: relative;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
  }
  .edit-thumb-chip img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    background: #fff;
  }
  .edit-thumb-chip.on img { border-color: #e85d04; }
  .edit-thumb-chip .x {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: #b91c1c;
    color: #fff;
    font-size: 11px;
    line-height: 18px;
    padding: 0;
  }
  .card-thumb-badge {
    position: absolute;
    left: 4px;
    bottom: 4px;
    background: rgba(0,0,0,0.62);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
  }
  #thumbZoomPopup .navs { display:flex; gap:8px; margin-top:8px; }
  #thumbZoomPopup .navs button {
    flex:1; padding:10px; border:none; border-radius:10px;
    background:#374151; color:#fff; font-weight:700;
  }
  .photo-search-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    background: rgba(255,255,255,0.95);
    color: #7c3aed;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(124,58,237,0.2);
  }
  .photo-search-btn:active { background: #f5f3ff; transform: scale(0.96); }


  .cat-row {
    display: flex;
    gap: 6px;
    align-items: center;
  }
  .cat-row .cat-select { min-width: 0; }
  .cat-select {
    flex: 1;
    padding: 7px 10px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    color: #111;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
  }
  .cat-manage-btn {
    flex-shrink: 0;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
  }
  .cat-manage-btn:active { background: rgba(255,255,255,0.35); }
  .cat-list-manage {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 50vh;
    overflow-y: auto;
  }
  .cat-list-manage li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 8px;
    border-bottom: 1px solid #e5e7eb;
    background: white;
    font-size: 15px;
  }
  .cat-list-manage li .cat-name {
    flex: 1;
    word-break: break-word;
  }
  .cat-list-manage .move-btns {
    display: flex;
    gap: 4px;
  }
  .cat-list-manage .move-btns button {
    width: 36px;
    height: 36px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
  }
  .cat-list-manage .move-btns button:active {
    background: #e5e7eb;
  }
  .cat-list-manage .move-btns button:disabled {
    opacity: 0.3;
  }
  .cat-list-manage li.cat-l1 {
    flex-wrap: wrap;
    background: #fff;
  }
  .cat-list-manage li.cat-l2 {
    padding-left: 18px;
    background: #fafafa;
  }
  .cat-list-manage .cat-name-input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
  }
  .cat-list-manage .cat-l2-list {
    list-style: none;
    width: 100%;
    margin: 6px 0 0;
    padding: 0 0 0 8px;
    border-left: 3px solid #fed7aa;
  }
  .cat-list-manage .cat-add2 {
    flex-shrink: 0;
    padding: 6px 8px;
    border: 1px solid #fed7aa;
    background: #fff7ed;
    color: #9a3412;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
  }
  .cat-list-manage .del-cat {
    width: 36px;
    height: 36px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;
    border-radius: 8px;
    cursor: pointer;
  }
  .cat-list-manage .drag-handle {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #fed7aa;
    background: #fff7ed;
    border-radius: 10px;
    cursor: grab;
    color: #c2410c;
    font-size: 16px;
    font-weight: 700;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
  }
  .cat-list-manage .drag-handle:active { cursor: grabbing; background: #ffedd5; }
  .cat-list-manage li.dragging {
    opacity: 0.7;
    background: #fff7ed;
    box-shadow: 0 8px 20px rgba(232,93,4,0.2);
    z-index: 6;
  }
  .cat-list-manage li.drag-over-top { box-shadow: inset 0 3px 0 0 #e85d04; }
  .cat-list-manage li.drag-over-bottom { box-shadow: inset 0 -3px 0 0 #e85d04; }
  .cat-list-manage li.cat-l1.drag-over-into {
    background: #ffedd5;
    outline: 2px solid #e85d04;
  }
  .cat-list-manage .cat-l2-list.drag-over-into {
    background: #fff7ed;
    outline: 2px dashed #e85d04;
  }
  .stats { font-size: 11px; opacity: 0.9; margin-top: 5px; }
  .list { padding: 12px 10px 24px; }
  .card {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(18px) saturate(1.4);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border-radius: 20px;
    padding: 14px 14px 12px;
    margin-bottom: 12px;
    box-shadow: 0 10px 28px rgba(232,93,4,0.10);
    border: 1px solid rgba(255,255,255,0.8);
  }
  .card-chip-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
  }
  .chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    max-width: 100%;
  }
  .chip-cat {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 18em;
  }
  .chip-cat { background: #ffedd5; color: #9a3412; }
  .chip-loc { background: #ede9fe; color: #6d28d9; }
  .chip-ok { background: #d1fae5; color: #065f46; }
  .chip-dead { background: #fee2e2; color: #991b1b; }
  .chip-new { background: #dbeafe; color: #1e40af; }
  .chip-warn { background: #fee2e2; color: #b91c1c; }
  .card-top {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 4px;
  }
  .card-top .name { flex: 1; }
  .fav-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid #fed7aa;
    background: #fff7ed;
    color: #c2410c;
    font-size: 18px;
    cursor: pointer;
  }
  .fav-btn.on { background: #ffedd5; color: #ea580c; border-color: #fdba74; }
  .price-pill {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 20px;
    padding: 12px 14px;
    margin: 0 0 8px;
    background: #fffaf7;
    border: 1px solid #ffedd5;
    border-radius: 12px;
  }
  .price-pill .plabel { font-size: 15px; color: #6b7280; margin-right: 6px; font-weight: 600; }
  .price-pill .member { color: #059669; font-weight: 800; font-size: 34px; letter-spacing: -0.4px; }
  .price-pill .normal { color: #d00000; font-weight: 800; font-size: 34px; letter-spacing: -0.4px; }
  .price-pill .punit { color: #6b7280; font-weight: 700; font-size: 18px; margin-left: 2px; }
  .hike-banner {
    margin: 0 0 8px;
    padding: 8px 10px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    color: #9a3412;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.45;
  }
  .hike-banner .when { color: #c2410c; }
  .card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #f3f4f6;
  }
  .card-actions button {
    flex: 1;
    padding: 10px 8px;
    border: none;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
  }
  .card-actions .act-copy { background: #fff1f2; color: #e11d48; }
  .card-actions .act-edit { background: #ecfdf5; color: #047857; }
  .card-actions .act-del { background: #fef2f2; color: #b91c1c; }
  .card-actions button:active { opacity: 0.85; transform: scale(0.98); }
  .barcode-line {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 0 0 8px;
    padding: 12px 12px;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    border-radius: 12px;
    font-size: 22px;
    color: #111827;
    font-weight: 800;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    letter-spacing: 0.4px;
    cursor: pointer;
    text-align: left;
  }
  .barcode-line .bc-num {
    flex: 1;
    min-width: 0;
    word-break: break-all;
    line-height: 1.25;
  }
  .barcode-line:active { background: #eef2ff; border-color: #c7d2fe; }
  .barcode-line .bc-toggle-ico {
    flex-shrink: 0;
    color: #e85d04;
    font-size: 14px;
    width: 16px;
    text-align: center;
  }
  .barcode-line .bc-toggle-hint {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 11px;
    color: #6b7280;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  }
  .barcode-line .bc2 {
    color: #6b7280;
    font-weight: 500;
    margin-left: 8px;
  }
  .barcode-line .bc6 {
    display: block;
    margin-top: 4px;
    color: #6b7280;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.2px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  }
  body.bc-hide .card .bc-img-wrap { display: none; }
  .edit-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .edit-field {
    margin-bottom: 10px;
  }
  .edit-field label {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
    font-weight: 600;
  }
  .edit-field input, .edit-field select, .edit-field textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    background: #fff;
  }
  .edit-field textarea { min-height: 72px; resize: vertical; }
  .edit-bc-row {
    display: flex;
    gap: 8px;
    align-items: center;
  }
  .edit-bc-row input { flex: 1; }
  .edit-bc-row button {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border: 1px solid #fed7aa;
    background: #fff7ed;
    border-radius: 12px;
    font-size: 18px;
    cursor: pointer;
  }
  .note-auto-row {
    display: flex;
    gap: 8px;
    margin-top: 6px;
  }
  .note-auto-row button {
    flex: 1;
    padding: 8px;
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #3730a3;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
  }
  .card .cat {
    font-size: 11px;
    color: #9a3412;
    background: rgba(255,237,213,0.9);
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    margin-bottom: 6px;
    font-weight: 600;
  }
  .card .status {
    font-size: 11px;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #f3f4f6;
    color: #6b7280;
  }
  .card .status.ok { background: #d1fae5; color: #065f46; }
  .card .status.new { background: #dbeafe; color: #1e40af; }
  .card .status.dead { background: #fee2e2; color: #991b1b; }
  .system-prefix-inline { font-weight: 800; color: #6b7280; }

  .card .sys-marks {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 4px 0 2px;
  }
  .card .sys-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    min-width: 0;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid #e5e7eb;
    background: #f3f4f6;
    color: #374151;
    -webkit-tap-highlight-color: rgba(26,115,232,0.25);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    z-index: 2;
  }
  #sysMarkPopup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0,0,0,0.55);
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
  }
  #sysMarkPopup.show { display: flex; }
  #sysMarkPopup .box {
    background: #fff;
    border-radius: 14px;
    padding: 20px 18px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  }
  #sysMarkPopup .box h3 {
    margin: 0 0 10px;
    font-size: 18px;
    color: #1a73e8;
    font-weight: 800;
  }
  #sysMarkPopup .box p {
    margin: 0 0 16px;
    font-size: 15px;
    line-height: 1.55;
    color: #111827;
  }
  #sysMarkPopup .box button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: #1a73e8;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
  }
  .card .sys-mark:active { transform: scale(0.96); }
  .card .sys-mark.m-bang { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
  .card .sys-mark.m-at { background: #ffedd5; color: #9a3412; border-color: #fed7aa; }
  .card .sys-mark.m-aa { background: #fef3c7; color: #92400e; border-color: #fde68a; }
  .card .sys-mark.m-hang { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
  .card .sys-mark.m-t { background: #fce7f3; color: #9d174d; border-color: #fbcfe8; }
  .card .sys-mark.m-j { background: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }
  .card .sys-mark.m-g { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
  .card .sys-mark.m-b { background: #e0f2fe; color: #075985; border-color: #bae6fd; }
  .card .sys-mark.m-x { background: #fee2e2; color: #7f1d1d; border-color: #fecaca; }
  .card .inv-stats {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    margin: 0 0 8px;
    font-size: 11px;
    color: #6b7280;
  }
  .card .inv-stats span {
    flex: 1;
    min-width: 0;
    text-align: center;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 10px;
    padding: 6px 2px 5px;
    line-height: 1.2;
  }
  .card .inv-stats span b {
    display: block;
    color: #111827;
    font-weight: 800;
    font-size: 15px;
    margin-top: 2px;
  }
  .card .inv-stats.low span b { color: #b91c1c; }
  .card .inv-stats .ok { color: #047857; }
  .sys-legend-list { list-style: none; padding: 0; margin: 0; max-height: 60vh; overflow: auto; }
  .sys-legend-list li {
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
    line-height: 1.45;
  }
  .sys-legend-list li:last-child { border-bottom: none; }
  #sysMarkModal.modal-overlay.show { display: flex; z-index: 9999; }
  .sys-legend-list .mk {
    display: inline-block;
    min-width: 42px;
    font-weight: 800;
    color: #1a73e8;
    margin-right: 6px;
  }

  .card .name {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.28;
    margin-bottom: 2px;
    word-break: break-word;
  }
  .card .name-en {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.3;
    margin-bottom: 0;
    font-weight: 400;
    word-break: break-word;
  }
  .card .name-en.loading {
    color: #9ca3af;
    font-style: italic;
  }

  .card .prices {
    align-items: center;
  }
  .card .price-edit-btn {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px 10px;
    background: #f0fdf4;
    color: #047857;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
  }
  .card .price-edit-btn:active { background: #dcfce7; }
  .card .mem-x{margin-left:6px;border:0;background:#fee2e2;color:#b91c1c;width:22px;height:22px;border-radius:11px;font-size:14px;line-height:22px;padding:0;font-weight:700;}
  #scanPriceMember .mem-x{width:26px;height:26px;border-radius:13px;font-size:16px;vertical-align:middle;}
  .price-item.tap {
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 6px;
  }
  .card .price-item.tap:active { background: #f3f4f6; }
  #priceEditModal input[type="number"],
  #priceEditModal input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 16px;
    margin-bottom: 8px;
  }
  #priceEditModal .price-field-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 4px;
  }
  #priceEditModal .price-field-row input { flex: 1; margin-bottom: 0; }
  #priceEditModal .price-field-row button {
    flex-shrink: 0;
    padding: 10px 12px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
  }

  .card .prices {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
  }
  .card .price-item { font-size: 15px; }
  .card .price-item .label {
    font-size: 11px;
    color: var(--muted);
    margin-right: 4px;
  }
  .card .member { color: var(--member); font-weight: 700; font-size: 16px; }
  .card .normal { color: var(--price); font-weight: 700; font-size: 16px; }
  .card .meta {
    font-size: 13px;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }

  .card .bc-img-wrap {
    margin: 0 0 8px;
    padding: 12px 10px 10px;
    background: #ffffff;
    border: 2px solid #111111;
    border-radius: 12px;
    overflow: hidden;
    text-align: center;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(26,115,232,0.2);
    touch-action: manipulation;
    position: relative;
  }
  .card .bc-img-wrap:active {
    border-color: #1a73e8;
    background: #f8fafc;
  }
  .card .bc-img-wrap svg {
    max-width: 100%;
    width: 100%;
    height: auto;
    min-height: 92px;
    display: block;
    margin: 0 auto;
    background: #ffffff;
    filter: contrast(1.45);
  }
  .card .bc-img-wrap .bc-fail {
    font-size: 12px;
    color: #9ca3af;
  }
  .card .bc-img-wrap .bc-zoom-hint {
    display: none;
  }
  .card .desc {
    margin-top: 0;
    margin-bottom: 6px;
  }
  .card .note {
    margin-top: 0;
    margin-bottom: 6px;
  }
  #bcZoomPopup {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100001;
    background: rgba(0,0,0,0.72);
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
  }
  #bcZoomPopup.show { display: flex; }
  #bcZoomPopup .box {
    background: #fff;
    border-radius: 14px;
    padding: 16px 12px 14px;
    width: 100%;
    max-width: 520px;
    text-align: center;
  }
  #bcZoomPopup .box h3 {
    margin: 0 0 8px;
    font-size: 14px;
    color: #6b7280;
    font-weight: 600;
    word-break: break-all;
  }
  #bcZoomPopup #bcZoomSvgWrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 0;
    background: #fff;
  }
  #bcZoomPopup #bcZoomSvgWrap svg {
    max-width: none;
    width: 100%;
    min-height: 140px;
    display: block;
    margin: 0 auto;
  }
  #bcZoomPopup .hint {
    font-size: 12px;
    color: #9ca3af;
    margin: 6px 0 12px;
  }
  #bcZoomPopup .actions {
    display: flex;
    gap: 8px;
  }
  #bcZoomPopup .actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
  }
  #bcZoomPopup .btn-close {
    background: #1a73e8;
    color: #fff;
  }
  #bcZoomPopup .btn-bigger {
    background: #eef2ff;
    color: #3730a3;
  }

  .card .barcode {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    letter-spacing: 0.3px;
  }
  .copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #fff0e6;
    color: var(--primary);
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
  }
  .copy-btn:active { background: #ffe0cc; }
  .copy-btn.copied { background: #d1fae5; color: #059669; }
  .card .desc {
    margin-top: 6px;
    font-size: 13px;
    color: #4b5563;
    line-height: 1.4;
  }
  .card .note {
    margin-top: 8px;
    font-size: 13px;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 8px 10px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
  }
  .card .note .note-label {
    font-size: 11px;
    color: #b45309;
    font-weight: 600;
    margin-right: 4px;
  }
  #noteInput {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    margin-bottom: 8px;
    line-height: 1.4;
  }

  .empty { text-align: center; padding: 60px 20px; color: var(--muted); }
  .empty .icon { font-size: 48px; margin-bottom: 12px; }
  .hint {
    font-size: 13px;
    color: #9ca3af;
    text-align: center;
    padding: 8px 16px 20px;
  }
  .toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: #111827;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 999;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    max-width: 90%;
    text-align: center;
  }
  .toast.show { opacity: 1; }
  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
  }
  .modal-overlay.show { display: flex; }
  #scanModal.modal-overlay.show { z-index: 10050; background: rgba(17,17,17,0.88); }
  #batchLocModal.modal-overlay.show { z-index: 200; }
  .modal {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    width: 100%;
    max-width: 500px;
    border-radius: 18px 18px 0 0;
    padding: 14px 14px 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    max-height: 88vh;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.7);
    box-shadow: 0 -8px 40px rgba(232,93,4,0.15);
  }
  .modal h2 { font-size: 16px; margin-bottom: 4px; }
  .modal .sub { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
  .modal .btn-row { margin-top: 8px; }
  .modal .btn { padding: 10px; font-size: 14px; }
  #batchLocModal .modal, #shopModal .modal {
    display: flex;
    flex-direction: column;
    max-height: 88vh;
  }
  #batchLocModal .batch-list, #shopModal .loc-list-manage {
    flex: 1 1 auto;
    min-height: 80px;
    max-height: 26vh;
  }
  #batchLocModal .modal-actions, #shopModal .modal-actions {
    position: sticky;
    bottom: 0;
    background: #fff;
    padding-top: 8px;
    margin-top: 6px;
    border-top: 1px solid #f3f4f6;
    z-index: 2;
  }
  .upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 28px 16px;
    text-align: center;
    background: #f8fafc;
    cursor: pointer;
    margin-bottom: 12px;
  }
  .upload-zone:active, .upload-zone.drag {
    border-color: var(--primary);
    background: #e8f0fe;
  }
  .upload-zone .icon { font-size: 36px; margin-bottom: 8px; }
  .upload-zone p { font-size: 14px; color: #475569; }
  .upload-zone .small { font-size: 12px; color: #94a3b8; margin-top: 4px; }
  .btn-row { display: flex; gap: 10px; margin-top: 12px; }
  .btn {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
  }
  .btn-primary { background: var(--primary); color: white; }
  .btn-secondary { background: #e5e7eb; color: #374151; }
  .btn-danger { background: #fee2e2; color: #b91c1c; }
  .info-box {
    background: #f0f9ff;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    color: #0369a1;
    margin-bottom: 12px;
  }

  /* font size levels */
  body.fs-s .card .name { font-size: 15px; }
  body.fs-s .card .name-en { font-size: 12px; }
  body.fs-s .card .member, body.fs-s .card .normal { font-size: 14px; }
  body.fs-s .card .price-item { font-size: 13px; }
  body.fs-s .card .meta { font-size: 12px; }
  body.fs-s .card .desc { font-size: 12px; }

  body.fs-m .card .name { font-size: 18px; }
  body.fs-m .card .name-en { font-size: 13px; }
  body.fs-m .card .member, body.fs-m .card .normal { font-size: 16px; }
  body.fs-m .card .price-item { font-size: 15px; }
  body.fs-m .card .meta { font-size: 13px; }
  body.fs-m .card .desc { font-size: 13px; }

  body.fs-l .card .name { font-size: 21px; }
  body.fs-l .card .name-en { font-size: 15px; }
  body.fs-l .card .member, body.fs-l .card .normal { font-size: 18px; }
  body.fs-l .card .price-item { font-size: 16px; }
  body.fs-l .card .meta { font-size: 14px; }
  body.fs-l .card .desc { font-size: 14px; }

  body.fs-xl .card .name { font-size: 24px; }
  body.fs-xl .card .name-en { font-size: 16px; }
  body.fs-xl .card .member, body.fs-xl .card .normal { font-size: 20px; }
  body.fs-xl .card .price-item { font-size: 17px; }
  body.fs-xl .card .meta { font-size: 15px; }
  body.fs-xl .card .desc { font-size: 15px; }

  body.fs-s .price-pill .member, body.fs-s .price-pill .normal { font-size: 28px; }
  body.fs-m .price-pill .member, body.fs-m .price-pill .normal { font-size: 34px; }
  body.fs-l .price-pill .member, body.fs-l .price-pill .normal { font-size: 40px; }
  body.fs-xl .price-pill .member, body.fs-xl .price-pill .normal { font-size: 44px; }


  #scanModal .modal {
    max-height: 70vh;
    max-width: 340px;
    margin: 0 auto;
    border-radius: 16px;
    padding: 12px;
  }
  #scanModal.show {
    align-items: center;
    justify-content: center;
  }
  #scanReader {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    min-height: 160px;
    max-height: 220px;
  }
  #scanReader video {
    border-radius: 12px !important;
    max-height: 220px !important;
    width: 100% !important;
    object-fit: cover;
  }
  #scanReader img { max-height: 220px !important; }
  .scan-hint {
    font-size: 12px;
    color: #6b7280;
    text-align: center;
    margin: 6px 0 2px;
  }
  .scan-result {
    font-size: 13px;
    text-align: center;
    color: #059669;
    font-weight: 600;
    min-height: 18px;
    margin-bottom: 4px;
  }


  .filter-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-top: 6px;
  }
  .loc-select {
    flex: 1;
    padding: 7px 10px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    color: #111;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 28px;
  }
  .shop-badge {
    font-size: 11px;
    opacity: 0.95;
    background: rgba(255,255,255,0.18);
    padding: 2px 8px;
    border-radius: 6px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .card .loc-tag {
    font-size: 11px;
    color: #7c3aed;
    background: #ede9fe;
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 6px;
  }
  .card .card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
  }
  .card .card-top .name { flex: 1; margin-bottom: 0; }
  .fav-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    border-radius: 10px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #9ca3af;
    padding: 0;
  }
  .fav-btn.on {
    background: #fef3c7;
    color: #f59e0b;
  }
  .fav-btn:active { transform: scale(0.94); }

  .loc-list-manage {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 26vh;
    overflow-y: auto;
  }
  .loc-list-manage li {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 4px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
  }
  .loc-list-manage input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
  }
  .loc-list-manage .del-loc {
    width: 36px;
    height: 36px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;
    border-radius: 8px;
    cursor: pointer;
  }
  .loc-list-manage .move-btns {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
  }
  .loc-list-manage .move-btns button {
    width: 36px;
    height: 36px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
  }
  .loc-list-manage .move-btns button:active {
    background: #e5e7eb;
  }
  .loc-list-manage .move-btns button:disabled {
    opacity: 0.3;
  }
  .loc-list-manage li {
    touch-action: pan-y;
    background: #fff;
    transition: background 0.12s, transform 0.12s;
    position: relative;
  }
  .loc-list-manage li.dragging {
    opacity: 0.92;
    background: #e8f0fe;
    box-shadow: 0 8px 20px rgba(26,115,232,0.25);
    z-index: 5;
    transform: scale(1.02);
  }
  .loc-list-manage li.drag-over-top {
    box-shadow: inset 0 3px 0 0 var(--primary, #1a73e8);
  }
  .loc-list-manage li.drag-over-bottom {
    box-shadow: inset 0 -3px 0 0 var(--primary, #1a73e8);
  }
  .loc-list-manage .drag-handle {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    border-radius: 10px;
    cursor: grab;
    color: #4338ca;
    font-size: 20px;
    font-weight: 700;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
  }
  .loc-list-manage .drag-handle:active {
    cursor: grabbing;
    background: #c7d2fe;
  }
  .loc-hint {
    font-size: 12px;
    color: #6366f1;
    background: #eef2ff;
    border-radius: 8px;
    padding: 8px 10px;
    margin: 6px 0 8px;
  }
  .shop-name-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 15px;
    margin-bottom: 10px;
  }


  .batch-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
  }
  .batch-toolbar select, .batch-toolbar input[type="search"] {
    flex: 1;
    min-width: 100px;
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
  }
  .batch-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 28vh;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
  }
  .batch-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 6px 8px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 13px;
  }
  .batch-list li:last-child { border-bottom: none; }
  .batch-list li label {
    flex: 1;
    cursor: pointer;
    line-height: 1.35;
  }
  .batch-list .b-meta {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
  }
  .batch-list input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    flex-shrink: 0;
  }
  .batch-assign-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
  }
  .batch-assign-row select, .batch-assign-row input {
    flex: 1;
    min-width: 100px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
  }
  .batch-count {
    font-size: 13px;
    color: #0369a1;
    background: #f0f9ff;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 8px;
  }


  .print-settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
  }
  .print-settings-grid label {
    font-size: 12px;
    color: #6b7280;
    display: block;
    margin-bottom: 4px;
  }
  .print-settings-grid select,
  .print-settings-grid input[type="number"],
  .print-settings-grid input[type="text"] {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
  }
  .print-check-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin: 8px 0 14px;
    font-size: 14px;
  }
  .print-check-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
  }
  .label-preview {
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    padding: 10px;
    background: #f8fafc;
    margin-bottom: 12px;
    text-align: center;
  }
  .label-preview .lp-box {
    display: inline-block;
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 6px 8px;
    text-align: center;
    box-sizing: border-box;
  }




  /* 打印區：螢幕移出視窗外（不可 display:none，否則 iOS 印空白） */


  #labelEditCanvas {
    display: block;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 1px 6px rgba(0,0,0,.12);
    max-width: 100%;
    height: auto;
    /* 橫向標籤：寬 > 高 */
    object-fit: contain;
  }
  .label-vis-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
    justify-content: center;
  }
  .label-vis-tools button {
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12px;
    cursor: pointer;
  }
  .label-vis-tools button:active { background: #e5e7eb; }
  details.label-advanced {
    margin: 8px 0 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px 10px;
    background: #fafafa;
  }
  details.label-advanced summary {
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
    font-weight: 600;
  }


  .recv-block {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e5e7eb;
    font-size: 12px;
    color: #4b5563;
  }
  .recv-block .recv-title {
    font-weight: 600;
    color: #0f766e;
    margin-bottom: 4px;
    font-size: 12px;
  }
  .recv-block .recv-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    padding: 3px 0;
    border-bottom: 1px solid #f3f4f6;
  }
  .recv-block .recv-row:last-child { border-bottom: none; }
  .recv-block .recv-date { color: #6b7280; min-width: 72px; }
  .recv-block .recv-q { color: #111827; }
  .recv-block .recv-q b { font-weight: 700; color: #0f766e; }

  #fileInput, #uploadFileInput, #deployFileInput { display: none; }
  .io-sec { margin: 0 0 14px; padding: 12px; background: #fff; border: 1px solid #fed7aa; border-radius: 14px; }
  .io-sec h3 { font-size: 14px; margin: 0 0 8px; color: #9a3412; }
  .io-sec .hint-line { font-size: 12px; color: #6b7280; line-height: 1.45; margin: 0 0 8px; }
  .io-stat { font-size: 12px; color: #374151; background: #fff7ed; border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; line-height: 1.55; }
  .io-stat b { color: #9a3412; }
  .io-stat .err { color: #b91c1c; word-break: break-word; }
  .io-progress { display:none; margin: 8px 0; font-size: 12px; color: #1d4ed8; font-weight: 700; }
  .io-progress.show { display:block; }
  .tpl-grid { display:flex; flex-direction:column; gap:8px; }
  .tpl-grid button, .io-sec .btn { width:100%; }
  select.tpl-select { width:100%; padding:12px; border:1px solid #e5e7eb; border-radius:12px; font-size:15px; background:#fff; margin-bottom:8px; }

  .loading { text-align: center; padding: 40px; color: var(--muted); }
  .sync-status {
    display:inline-flex;align-items:center;gap:4px;font-size:11px;color:#6b7280;
    white-space:nowrap;max-width:120px;overflow:hidden;text-overflow:ellipsis;
  }
  .sync-status.syncing { color:#2563eb; }
  .sync-status.ok { color:#059669; }
  .sync-status.error { color:#dc2626; }

/* ⚠️ 異常模式：極簡列表，減少 DOM／圖片／文字負擔 */
.anomaly-compact-list{display:flex;flex-direction:column;gap:8px;padding:4px 0;}
.anomaly-compact-row{width:100%;min-height:64px;padding:8px 12px;margin:0;border:1px solid rgba(0,0,0,.08);border-radius:12px;background:#fff;display:flex;align-items:center;gap:12px;text-align:left;cursor:pointer;box-sizing:border-box;}
.anomaly-compact-row:active{transform:scale(.99);}
.anomaly-compact-thumb{width:48px!important;height:48px!important;min-width:48px!important;object-fit:cover;border-radius:8px;background:#f3f4f6;display:block;}
.anomaly-no-image{display:flex;align-items:center;justify-content:center;font-size:24px;}
.anomaly-compact-name{flex:1;min-width:0;font-size:16px;font-weight:700;line-height:1.35;color:#1f2937;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.anomaly-compact-arrow{font-size:26px;line-height:1;color:#9ca3af;padding-left:4px;}


  .note-clear-wrap { position: relative; }
  .note-clear-wrap textarea { width: 100%; padding-right: 40px; box-sizing: border-box; }
  .note-clear-x {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 14px;
    background: rgba(17,24,39,0.08);
    color: #6b7280;
    font-size: 18px;
    line-height: 28px;
    text-align: center;
    padding: 0;
    z-index: 2;
  }

  #nowItemBar{display:none;position:fixed;left:10px;right:10px;bottom:10px;margin:0;padding:10px 12px;border-radius:12px;background:rgba(255,255,255,.96);border:1px solid #fdba74;box-shadow:0 8px 24px rgba(0,0,0,.16);z-index:45;} body.now-on{padding-bottom:92px;}
  #nowItemBar.on{display:block;}
  #nowItemBar .ni-name{font-weight:700;font-size:15px;color:#111;}
  #nowItemBar .ni-meta{font-size:12px;color:#6b7280;margin-top:2px;}
  #nowItemBar .ni-price{font-size:18px;font-weight:800;color:#c2410c;margin-top:4px;}
  #nowItemBar .ni-acts{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px;}
  #nowItemBar .ni-acts button{flex:1;min-width:72px;padding:8px 6px;border:0;border-radius:8px;font-size:12px;background:#fff7ed;color:#9a3412;}
  #clipBar{display:none;margin:6px 12px 0;padding:8px 10px;border-radius:10px;background:#ecfeff;border:1px solid #67e8f9;font-size:13px;}
  #clipBar.on{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}
  #clipBar button{padding:6px 10px;border:0;border-radius:8px;background:#0891b2;color:#fff;font-size:12px;}

  #scanPriceBox{display:none;margin:8px 0;padding:10px 12px;border-radius:12px;background:#fff7ed;border:1px solid #fdba74;text-align:center;}
  #scanPriceBox.on{display:block;}
  #scanPriceName{font-size:14px;font-weight:700;color:#111;margin-bottom:4px;}
  #scanPriceMain{font-size:34px;font-weight:800;color:#d00000;line-height:1.1;}
  #scanPriceMember{font-size:22px;font-weight:800;color:#059669;margin-top:4px;}
  #scanPriceUnit{font-size:28px;font-weight:800;color:#d00000;margin-top:2px;display:none;}
  #scanPriceExtra{font-size:12px;color:#6b7280;margin-top:4px;}
