:root {
  --bg: #f6efe7;
  --card: #ffffff;
  --ink: #2a211c;
  --muted: #8a7c70;
  --line: #ece2d6;
  --brand: #7a1f1f;
  --brand-2: #a83232;
  --accent: #e0a83e;
  --green: #2e9e6b;
  --shadow: 0 6px 22px rgba(60, 30, 15, 0.10);
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
/* Το letterbox χρώμα μπαίνει στο html ώστε να καλύπτει ΟΛΟ το scroll canvas (ποτέ γυμνή/λευκή λωρίδα κάτω-κάτω). */
html { background: #d9cbbb; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  background: #d9cbbb;
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  /* flex-start (όχι stretch): το .device παίρνει το ΥΨΟΣ ΤΟΥ ΠΕΡΙΕΧΟΜΕΝΟΥ, δεν κλειδώνεται στο viewport
     → το κρεμ background εκτείνεται σε όλο το ύψος κατά το scroll (fix: «κάτω-κάτω δεν έχει background»). */
  align-items: flex-start;
}

/* phone-like frame on desktop, full screen on mobile */
.device {
  width: 100%;
  max-width: 460px;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 40px rgba(0,0,0,.18);
}

/* Sticky header wrapper: topbar + store bar πινάρονται μαζί ως ένα block (σωστό stacking, χωρίς επικάλυψη) */
.apphead { position: sticky; top: 0; z-index: 30; }

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  /* safe-area-inset-top: μην περνά το περιεχόμενο κάτω από το notch/status bar σε iOS (viewport-fit=cover) */
  padding: max(14px, env(safe-area-inset-top)) 16px 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.brand-logo { font-size: 22px; }
.brand-name { font-size: 20px; letter-spacing: .3px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.erp-badge {
  font-size: 11px; font-weight: 700; background: rgba(255,255,255,.16);
  padding: 4px 8px; border-radius: 999px; color: #ffd9d9;
}
.erp-badge.live { color: #c7ffd9; }
.erp-badge.ok { color: #d6ffe2; }
.erp-badge.err { color: #ffd0d0; }
.icon-btn {
  background: rgba(255,255,255,.16); border: 0; color: #fff;
  width: 38px; height: 38px; border-radius: 12px; font-size: 18px; cursor: pointer;
  position: relative; display: grid; place-items: center;
}
.cart-count {
  position: absolute; top: -6px; right: -6px; background: var(--accent);
  color: #3a2a00; font-size: 11px; font-weight: 800; border-radius: 999px;
  min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px;
}

/* Store selector bar (κάτω από το brand — μέσα στο .apphead sticky wrapper) */
.storebar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(60,30,15,.05);
}
.storebar .sb-ico { font-size: 18px; flex: none; }
.storebar .sb-select {
  flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; font-weight: 700; color: var(--ink); background: #fff; cursor: pointer;
}
.storebar .sb-near {
  flex: none; width: 40px; height: 38px; border: 1px solid var(--line); border-radius: 10px;
  background: #efe6da; font-size: 17px; cursor: pointer; display: grid; place-items: center;
}
.storebar .sb-near:active { transform: translateY(1px); }

/* View area */
.view { flex: 1; padding: 16px 16px 96px; }
.section-title { font-size: 18px; font-weight: 800; margin: 22px 2px 12px; }
.muted { color: var(--muted); }

/* Cards */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}

/* Hero / points card */
.points-card {
  background: linear-gradient(135deg, #2a211c, #54372b);
  color: #fff; border-radius: 20px; padding: 18px; position: relative; overflow: hidden;
  box-shadow: var(--shadow);
}
.points-card::after {
  content: "🍝"; position: absolute; right: -10px; bottom: -18px; font-size: 96px; opacity: .12;
}
.points-card .pc-label { font-size: 12px; opacity: .8; text-transform: uppercase; letter-spacing: 1px; }
.points-card .pc-value { font-size: 38px; font-weight: 900; line-height: 1; margin: 6px 0; }
.tier-chip {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 13px;
  padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.14);
}
.progress { height: 8px; border-radius: 999px; background: rgba(255,255,255,.18); margin-top: 12px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.progress-light { background: var(--line); }
.progress-light > i { background: var(--brand-2); }

/* Quick actions */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.quick button {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; font-size: 11px; font-weight: 700; color: var(--ink);
}
.quick button span { font-size: 22px; }

/* Horizontal scroll row */
.hscroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.hscroll::-webkit-scrollbar { display: none; }
.deal {
  min-width: 220px; scroll-snap-align: start; border-radius: 16px; padding: 14px;
  color: #fff; background: linear-gradient(135deg, var(--brand-2), #d4671f); box-shadow: var(--shadow);
}
.deal .deal-emoji { font-size: 26px; }
.deal h4 { margin: 8px 0 2px; font-size: 16px; }
.deal small { opacity: .9; }
.deal .deal-timer { margin-top: 10px; font-weight: 800; font-size: 13px; background: rgba(0,0,0,.18); display: inline-block; padding: 4px 8px; border-radius: 8px; }

/* List rows */
.row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .emoji { font-size: 26px; width: 40px; text-align: center; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 700; }
.row .sub { font-size: 12px; color: var(--muted); }
.price { font-weight: 800; color: var(--brand); white-space: nowrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 800; font-size: 15px; cursor: pointer;
  background: var(--brand); color: #fff; width: 100%;
}
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #efe6da; color: var(--ink); }
.btn.ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.btn.sm { width: auto; padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Chips / segmented */
.seg { display: flex; gap: 8px; background: #efe6da; border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 9px; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

/* Builder */
.opt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.opt {
  border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 12px; cursor: pointer;
  display: flex; align-items: center; gap: 10px; text-align: left; font-weight: 600; color: var(--ink);
}
.opt.active { border-color: var(--brand); background: #fdf3f0; }
.opt .oe { font-size: 22px; }
.opt .op { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 700; }
.step-label { font-weight: 800; margin: 16px 2px 8px; display: flex; align-items: center; gap: 8px; }
.step-num { background: var(--brand); color: #fff; width: 22px; height: 22px; border-radius: 999px; display: grid; place-items: center; font-size: 12px; }

/* Qty */
.qty { display: inline-flex; align-items: center; gap: 10px; }
.qty button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-size: 18px; cursor: pointer; line-height: 1; }

/* Missions */
.mission { display: flex; align-items: center; gap: 12px; }
.mission .mi { font-size: 24px; }
.mission .reward { font-weight: 800; color: var(--green); font-size: 13px; }
.bar { height: 7px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--green); }

/* Loyalty QR card (Στοιχεία λογαριασμού) */
.loyalty-card {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; border-radius: 18px; padding: 18px; box-shadow: var(--shadow);
}
.loyalty-card .lc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.loyalty-card .lc-name { font-size: 17px; font-weight: 800; }
.loyalty-card .lc-tier { font-size: 12px; font-weight: 800; margin-top: 3px; opacity: .95; }
.loyalty-card .lc-pts { text-align: right; white-space: nowrap; }
.loyalty-card .lc-pts b { font-size: 26px; font-weight: 900; line-height: 1; }
.loyalty-card .lc-pts small { display: block; font-size: 11px; opacity: .85; text-transform: uppercase; letter-spacing: .5px; }
.loyalty-card .lc-qr { display: flex; align-items: center; gap: 14px; margin-top: 14px; background: rgba(255,255,255,.12); border-radius: 14px; padding: 12px; }
.loyalty-card .lc-qr img { width: 108px; height: 108px; flex: none; image-rendering: pixelated; border-radius: 10px; background: #fff; padding: 6px; box-sizing: border-box; }
.loyalty-card .lc-qr .lc-qrinfo { min-width: 0; }
.loyalty-card .lc-qr .lc-hint { font-size: 12px; opacity: .9; }
.loyalty-card .lc-qr .lc-code { font-weight: 900; font-size: 15px; letter-spacing: .5px; margin-top: 6px; word-break: break-all; }

/* Coupons */
.coupon {
  display: flex; align-items: center; gap: 12px; border: 1.5px dashed var(--brand-2);
  border-radius: 14px; padding: 12px; margin-bottom: 10px; background: #fff;
}
.qr { width: 64px; height: 64px; flex: none; image-rendering: pixelated; border-radius: 8px; border: 1px solid var(--line); }

/* Stores / map */
.map {
  position: relative; height: 180px; border-radius: 16px; overflow: hidden; margin-bottom: 14px;
  background: linear-gradient(135deg, #cfe8d6, #aacbb5);
  box-shadow: var(--shadow);
}
.map .pin { position: absolute; transform: translate(-50%,-100%); font-size: 24px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.3)); cursor: pointer; }
.map .roads::before, .map .roads::after { content: ""; position: absolute; background: rgba(255,255,255,.5); }
.map .roads::before { left: 0; right: 0; top: 55%; height: 10px; }
.map .roads::after { top: 0; bottom: 0; left: 40%; width: 10px; }

/* Status timeline */
.timeline { list-style: none; padding: 0; margin: 8px 0 0; }
.timeline li { display: flex; gap: 12px; padding-bottom: 18px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.dot { width: 24px; height: 24px; border-radius: 999px; border: 2px solid var(--line); background: #fff; display: grid; place-items: center; flex: none; font-size: 12px; }
.timeline li.done .dot { background: var(--green); border-color: var(--green); color: #fff; }
.timeline li.active .dot { background: var(--brand); border-color: var(--brand); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100%{ box-shadow: 0 0 0 0 rgba(122,31,31,.4);} 50%{ box-shadow: 0 0 0 6px rgba(122,31,31,0);} }

/* Profile toggles */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #cfc3b5; border-radius: 999px; transition: .2s; cursor: pointer; }
.slider::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 999px; transition: .2s; }
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* Drawer */
.drawer { position: fixed; inset: 0; z-index: 50; display: flex; justify-content: center; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.4); }
.drawer-panel {
  position: absolute; bottom: 0; width: 100%; max-width: 460px; background: var(--bg);
  border-radius: 20px 20px 0 0; padding: 16px 16px 24px; max-height: 82vh; overflow-y: auto;
  animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(100%);} to { transform: translateY(0);} }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cart-items .row .price { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.cart-footer { margin-top: 12px; }
.totals { margin: 8px 0; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { font-weight: 900; font-size: 18px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }
.coupon-input { display: flex; gap: 8px; margin: 10px 0; }
.coupon-input input { flex: 1; padding: 11px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }

/* Tabbar */
.tabbar {
  position: sticky; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5,1fr);
  background: #fff; border-top: 1px solid var(--line); padding: 6px 6px max(6px, env(safe-area-inset-bottom));
}
.tab { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--muted); cursor: pointer; font-weight: 700; }
.tab span { font-size: 20px; }
.tab label { font-size: 10px; cursor: pointer; }
.tab.active { color: var(--brand); }
.tab-main span { background: var(--brand); color: #fff; width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center; margin-top: -18px; box-shadow: var(--shadow); }
.tab-main.active span { background: var(--brand-2); }

/* Γρήγορη μπάρα ταμείου (sticky) — running total + άμεσο checkout */
.quickbar { position: sticky; top: 8px; z-index: 25; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--brand); color: #fff; border-radius: 14px; padding: 11px 16px; margin: 10px 0; box-shadow: var(--shadow); font-size: 15px; }
.quickbar .btn { background: #fff; color: var(--brand); font-weight: 800; }
.quickbar[hidden] { display: none; }

/* Toast */
.toast {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: #2a211c; color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 60;
  font-weight: 700; box-shadow: var(--shadow); max-width: 90%; text-align: center;
}

.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty .big { font-size: 48px; }
.spinner { width: 34px; height: 34px; margin: 30px auto 0; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 999px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.badge-soft { background: #fdf3f0; color: var(--brand); font-weight: 800; font-size: 11px; padding: 3px 8px; border-radius: 999px; }
.referral-box { display:flex; align-items:center; gap:10px; background:#fdf3f0; border:1.5px dashed var(--brand-2); border-radius:12px; padding:12px; }
.referral-box code { font-weight: 900; font-size: 18px; color: var(--brand); flex:1; }
