/* Offline till – self-contained (works without the main app's styles, also on offline.html). */
.zpo-overlay, .zpo-overlay * { box-sizing: border-box; }
.zpo-overlay { position: fixed; inset: 0; z-index: 6000; display: flex; flex-direction: column; background: #050a0f; color: #e2e8f0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; font-size: 16px; overflow: hidden; }
.zpo-overlay[hidden] { display: none; }
html.zpo-open, html.zpo-open body { overflow: hidden; }
.zpo-overlay button { font: inherit; -webkit-tap-highlight-color: transparent; }

/* header */
.zpo-head { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #0d161f; border-bottom: 2px solid #ffb020; }
.zpo-title { flex: 1 1 auto; min-width: 0; }
.zpo-title strong { display: block; color: #ffb020; font-size: 1.05rem; }
.zpo-title small { display: block; color: #94a3b8; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zpo-status { flex: none; padding: 4px 10px; border-radius: 999px; background: rgba(255, 176, 32, .15); color: #ffb020; font-size: .78rem; white-space: nowrap; }
.zpo-status[hidden] { display: none; }
.zpo-icon { flex: none; width: 40px; height: 40px; border-radius: 10px; border: 1px solid rgba(0, 242, 255, .3); background: transparent; color: #e2e8f0; font-size: 1.3rem; cursor: pointer; }

/* layout */
.zpo-body { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 380px; }

/* items */
.zpo-items { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 0; }
.zpo-input { width: 100%; min-width: 0; padding: 11px 12px; border-radius: 10px; border: 1px solid #1f3346; background: #0a121a; color: #e2e8f0; font-size: 16px; }
.zpo-input:focus { outline: none; border-color: #00f2ff; }
.zpo-chips { flex: none; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.zpo-chips::-webkit-scrollbar { display: none; }
.zpo-chip { flex: none; padding: 7px 14px; border-radius: 999px; border: 1px solid #1f3346; background: transparent; color: #cbd5e1; font-size: .85rem; cursor: pointer; white-space: nowrap; }
.zpo-chip.active { background: #00f2ff; border-color: #00f2ff; color: #050a0f; font-weight: 600; }
.zpo-grid { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px; align-content: start; padding-bottom: 12px; overscroll-behavior: contain; }
.zpo-item { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-width: 0; min-height: 76px;
    padding: 10px; border-radius: 12px; border: 1px solid rgba(0, 242, 255, .2); background: #0d161f; color: #e2e8f0; text-align: left; cursor: pointer; }
.zpo-item:active { transform: scale(.97); }
.zpo-item.in-cart { border-color: #00f2ff; box-shadow: inset 0 0 0 1px #00f2ff; }
.zpo-item-name { font-weight: 600; font-size: .92rem; line-height: 1.2; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.zpo-item-price { color: #00f2ff; font-size: .88rem; }
.zpo-badge { position: absolute; top: 6px; right: 6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: #00f2ff; color: #050a0f;
    font-size: .75rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

/* sale panel */
.zpo-cart { min-width: 0; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 12px; background: #0d161f; border-left: 1px solid #1a2a3a; }
.zpo-cart-head { display: flex; align-items: center; gap: 10px; }
.zpo-cart-head strong { flex: 1 1 auto; }
.zpo-back { display: none; padding: 8px 12px; border-radius: 10px; border: 1px solid #1f3346; background: transparent; color: #e2e8f0; cursor: pointer; }
.zpo-link { background: none; border: none; color: #94a3b8; cursor: pointer; text-decoration: underline; padding: 6px; }
.zpo-lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.zpo-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #16232f; }
.zpo-line-main { min-width: 0; display: flex; flex-direction: column; }
.zpo-line-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.zpo-line-main small { color: #94a3b8; }
.zpo-stepper { display: flex; align-items: center; gap: 6px; }
.zpo-step { width: 36px; height: 36px; border-radius: 10px; border: 1px solid rgba(0, 242, 255, .3); background: transparent; color: #e2e8f0; font-size: 1.2rem; cursor: pointer; }
.zpo-qty { min-width: 22px; text-align: center; font-weight: 600; }
.zpo-line-price { white-space: nowrap; font-weight: 600; }
.zpo-total { font-size: 2rem; font-weight: 700; color: #fff; text-align: right; }
.zpo-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.zpo-method { padding: 12px; border-radius: 12px; border: 1px solid rgba(0, 242, 255, .3); background: transparent; color: #e2e8f0; cursor: pointer; font-weight: 600; }
.zpo-method.active { background: #00f2ff; border-color: #00f2ff; color: #050a0f; }
.zpo-cash { display: flex; flex-direction: column; gap: 8px; }
.zpo-cash[hidden] { display: none; }
.zpo-cash label { color: #94a3b8; font-size: .85rem; }
.zpo-cash-input { font-size: 1.4rem; text-align: right; }
.zpo-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.zpo-quick-btn { padding: 10px 4px; border-radius: 10px; border: 1px solid #1f3346; background: #0a121a; color: #e2e8f0; cursor: pointer; font-size: .9rem; }
.zpo-change { min-height: 1.4em; font-size: 1.15rem; font-weight: 700; color: #00ffaa; text-align: right; }
.zpo-change.short { color: #ff4d4d; }
.zpo-primary { padding: 15px; border-radius: 12px; border: none; background: #ffb020; color: #050a0f; font-weight: 700; font-size: 1.05rem; cursor: pointer; }
.zpo-primary:disabled { opacity: .4; cursor: not-allowed; }
.zpo-empty { color: #94a3b8; font-size: .92rem; list-style: none; }

/* sticky pay bar (phones only) */
.zpo-bar { display: none; }

/* "sale saved" message */
.zpo-toast { position: absolute; left: 12px; right: 12px; bottom: 84px; z-index: 2; display: flex; flex-direction: column; gap: 2px; padding: 12px 14px;
    border-radius: 12px; background: #062a1f; border: 1px solid #00ffaa; color: #e2e8f0; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.zpo-toast[hidden] { display: none; }
.zpo-toast strong { color: #00ffaa; font-size: 1.05rem; }
.zpo-toast span:last-child { color: #94a3b8; font-size: .8rem; }
@media (min-width: 769px) { .zpo-toast { left: auto; right: 400px; bottom: 16px; width: 360px; } }

/* ---------- phones ---------- */
@media (max-width: 768px) {
    .zpo-body { grid-template-columns: minmax(0, 1fr); }
    .zpo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-bottom: 90px; }
    .zpo-cart { display: none; border-left: none; padding-bottom: 24px; }
    .zpo-back { display: inline-block; }

    /* the sale opens as its own full screen */
    .zpo-show-cart .zpo-items { display: none; }
    .zpo-show-cart .zpo-cart { display: flex; }
    .zpo-show-cart .zpo-bar { display: none !important; }

    .zpo-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 12px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        background: #0d161f; border-top: 1px solid #1f3346; box-shadow: 0 -8px 24px rgba(0, 0, 0, .4); }
    .zpo-bar-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
    .zpo-bar-count { color: #94a3b8; font-size: .8rem; }
    .zpo-bar-total { font-size: 1.35rem; color: #fff; }
    .zpo-bar-pay { flex: none; min-width: 120px; }
}

/* "You're back online – switch to live sales?" */
.zpo-live { flex: none; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; background: #062a1f;
    border-bottom: 2px solid #00ffaa; animation: zpoSlide .25s ease; }
.zpo-live[hidden] { display: none; }
.zpo-live-text { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.zpo-live-text strong { color: #00ffaa; font-size: 1.05rem; }
.zpo-live-text span { color: #cbd5e1; font-size: .85rem; }
.zpo-live-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.zpo-live-go { padding: 11px 16px; border-radius: 10px; border: none; background: #00ffaa; color: #050a0f; font-weight: 700; cursor: pointer; }
.zpo-live-go:disabled { opacity: .5; cursor: not-allowed; }
.zpo-live-stay { padding: 11px 14px; border-radius: 10px; border: 1px solid #1f3346; background: transparent; color: #e2e8f0; cursor: pointer; }
@media (max-width: 768px) { .zpo-live-actions { width: 100%; } .zpo-live-actions button { flex: 1; } }
@keyframes zpoSlide { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
