/* Duka POS: big, simple, offline. System fonts only. */
:root {
  --green: #0a9d58; --green-d: #07804a; --green-l: #e3f6ec;
  --red: #d93025; --red-l: #fde8e6; --orange: #e37400; --orange-l: #fff1dc;
  --blue: #1a73e8; --ink: #1b1d1f; --ink2: #5a6168; --line: #e3e6e8;
  --bg: #f4f6f3; --card: #ffffff; --r: 18px; --tap: 56px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font: 18px/1.4 var(--font); overflow-x: hidden; }
body { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:active { transform: scale(0.97); }
button[disabled] { opacity: 0.4; cursor: not-allowed; transform: none; }
.app { max-width: 560px; margin: 0 auto; padding: 0 14px 130px; }

/* header */
.top { position: sticky; top: 0; z-index: 10; background: var(--bg); display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 0 10px; }
.top h1 { flex: 1; min-width: 0; margin: 0; font-size: 22px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top h1 small { display: block; font-size: 14px; font-weight: 500; color: var(--ink2); }
.langs { display: flex; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.langs button { border: 0; background: transparent; min-width: 44px; min-height: 44px; border-radius: 999px; font-size: 15px; font-weight: 700; color: var(--ink2); }
.langs button.on { background: var(--ink); color: #fff; }
.icon-btn { width: var(--tap); height: var(--tap); border-radius: 50%; border: 1px solid var(--line); background: #fff; font-size: 26px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.badge-practice { display: inline-block; background: var(--orange); color: #fff; font-size: 13px; font-weight: 800; padding: 2px 8px; border-radius: 999px; vertical-align: middle; margin-left: 6px; }

/* banners */
.banner { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: var(--r); margin: 0 0 12px; font-size: 17px; }
.banner.warn { background: var(--orange-l); border: 2px solid var(--orange); }
.banner.practice { background: #fff6e5; border: 2px dashed var(--orange); }
.banner b { font-size: 28px; }
.banner .grow { flex: 1; }

/* tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: #fff; border-top: 1px solid var(--line); display: flex; justify-content: center; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
.tabs .in { display: flex; width: 100%; max-width: 560px; gap: 4px; }
.tabs button { flex: 1; min-height: 66px; border: 0; background: transparent; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 15px; font-weight: 700; color: var(--ink2); }
.tabs button span { font-size: 28px; line-height: 1; }
.tabs button.on { background: var(--green-l); color: var(--green-d); }
.fab { position: fixed; right: max(14px, calc(50% - 266px)); bottom: 96px; z-index: 21; min-height: var(--tap); padding: 0 20px; border: 0; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 800; font-size: 18px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }

/* generic */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin-bottom: 12px; }
.card h2 { margin: 0 0 10px; font-size: 18px; color: var(--ink2); font-weight: 700; }
.btn { min-height: var(--tap); padding: 0 18px; border-radius: 16px; border: 2px solid var(--line); background: #fff; font-weight: 700; font-size: 18px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; color: var(--ink); }
.btn.block { width: 100%; margin-top: 10px; }
.btn.green, .big-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.red { color: var(--red); border-color: var(--red-l); background: var(--red-l); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.big-green { width: 100%; min-height: 72px; border: 0; border-radius: 20px; font-size: 24px; font-weight: 800; margin-top: 12px; box-shadow: 0 4px 0 var(--green-d); }
.big-green:active { box-shadow: none; transform: translateY(3px); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.muted { color: var(--ink2); font-size: 16px; }
.empty { color: var(--ink2); text-align: center; padding: 18px 8px; font-size: 18px; }
.red-t { color: var(--red); font-weight: 800; }
.green-t { color: var(--green-d); font-weight: 800; }
.searchbar { display: flex; gap: 10px; margin-bottom: 12px; }
.searchbar input { flex: 1; min-width: 0; min-height: var(--tap); border-radius: 16px; border: 2px solid var(--line); padding: 0 14px; background: #fff; font-size: 18px; }
.searchbar .btn { flex: none; }

/* product tiles */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
@media (min-width: 480px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tile { position: relative; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: var(--r); padding: 12px; min-height: 132px; display: flex; flex-direction: column; gap: 2px; }
.tile .em { font-size: 40px; line-height: 1.1; }
.tile .nm { font-weight: 700; font-size: 18px; line-height: 1.2; overflow-wrap: anywhere; }
.tile .pr { font-size: 20px; font-weight: 800; color: var(--green-d); }
.tile .st { font-size: 15px; color: var(--ink2); }
.tile .st.low { color: var(--red); font-weight: 700; }
.tile.inb { border-color: var(--green); background: var(--green-l); }
.tile .qb { position: absolute; top: 8px; right: 8px; min-width: 34px; height: 34px; border-radius: 999px; background: var(--green); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; padding: 0 8px; }

/* basket */
.line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.line:first-of-type { border-top: 0; }
.line .em { font-size: 30px; width: 40px; text-align: center; flex: none; }
.line .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.line .grow small { display: block; color: var(--ink2); font-size: 15px; }
.qty { display: flex; align-items: center; gap: 6px; flex: none; }
.qty button { width: var(--tap); height: var(--tap); border-radius: 50%; border: 2px solid var(--line); background: #fff; font-size: 26px; font-weight: 800; }
.qty b { min-width: 40px; min-height: var(--tap); display: inline-flex; align-items: center; justify-content: center; font-size: 22px; border: 0; background: transparent; }
.total { display: flex; justify-content: space-between; align-items: baseline; padding-top: 12px; margin-top: 6px; border-top: 2px solid var(--ink); font-size: 22px; font-weight: 800; }
.total strong { font-size: 32px; }

/* lists */
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); width: 100%; background: transparent; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.item:first-child { border-top: 0; }
.item .em { font-size: 32px; width: 44px; text-align: center; flex: none; }
.item .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.item .grow small { display: block; color: var(--ink2); font-size: 15px; }
.item .amt { font-weight: 800; font-size: 19px; white-space: nowrap; }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 15px; font-weight: 800; white-space: nowrap; }
.pill.red { background: var(--red-l); color: var(--red); }
.pill.green { background: var(--green-l); color: var(--green-d); }
.pill.orange { background: var(--orange-l); color: var(--orange); }

/* segments */
.seg { display: flex; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 5px; margin-bottom: 12px; overflow-x: auto; }
.seg button { flex: 1; min-height: 52px; border: 0; border-radius: 14px; background: transparent; font-weight: 700; font-size: 16px; color: var(--ink2); white-space: nowrap; padding: 0 8px; }
.seg button.on { background: var(--ink); color: #fff; }

/* money stats */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.stat .em { font-size: 28px; }
.stat .v { font-size: 26px; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.stat .l { font-size: 16px; color: var(--ink2); font-weight: 600; }
.stat.big { grid-column: 1 / -1; background: var(--green); color: #fff; border: 0; }
.stat.big .l { color: #e8fff2; }
.stat.big .v { font-size: 38px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding-top: 8px; }
.bars div { flex: 1; background: var(--green); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars div.zero { background: var(--line); }
.bars-l { display: flex; gap: 3px; font-size: 12px; color: var(--ink2); margin-top: 4px; }
.bars-l span { flex: 1; text-align: center; overflow: hidden; white-space: nowrap; }
.kv { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); font-size: 18px; }
.kv:first-of-type { border-top: 0; }
.kv b { font-weight: 800; }

/* sheet + modals */
.back { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 30; display: none; }
.sheet { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: min(560px, 100%); max-height: 92vh; overflow-y: auto; z-index: 31; background: var(--bg); border-radius: 24px 24px 0 0; padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); display: none; }
body.sheet-open .back, body.sheet-open .sheet { display: block; }
.sheet h3 { margin: 0 0 14px; font-size: 24px; font-weight: 800; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.x { width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; background: #e6e9e7; font-size: 24px; flex: none; }
.pays { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pays button { min-height: 110px; border-radius: 20px; border: 2px solid var(--line); background: #fff; font-size: 20px; font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.pays button span { font-size: 44px; line-height: 1; }
.pays button.owe { border-color: var(--orange); }
.bigtotal { text-align: center; font-size: 44px; font-weight: 900; margin: 0 0 14px; }
.bigtotal small { display: block; font-size: 18px; font-weight: 600; color: var(--ink2); }
.f { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; font-weight: 700; font-size: 17px; color: var(--ink2); }
.f input, .f select, .numf { min-height: var(--tap); border-radius: 14px; border: 2px solid var(--line); padding: 0 14px; background: #fff; font-size: 20px; color: var(--ink); width: 100%; min-width: 0; }
.numf { text-align: left; font-weight: 800; }
.f .hint { font-weight: 500; font-size: 15px; }
.warn { padding: 10px 12px; border-radius: 12px; background: var(--orange-l); color: #8a4600; font-size: 16px; margin: 0 0 10px; }
.warn:empty { display: none; }
.emojis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 12px; }
.emojis button { min-height: 52px; font-size: 28px; border-radius: 12px; border: 2px solid var(--line); background: #fff; }
.emojis button.on { border-color: var(--green); background: var(--green-l); }
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.acts .btn { min-height: 72px; font-size: 19px; flex-direction: column; gap: 2px; }
.acts .btn span { font-size: 28px; }
.rcpt { font: 15px/1.5 ui-monospace, "Roboto Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace; white-space: pre-wrap; background: #fff; padding: 16px; border-radius: 14px; border: 2px dashed var(--line); color: #000; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chips button { min-height: 52px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--line); background: #fff; font-weight: 700; font-size: 16px; }
.msg { padding: 12px 14px; border-radius: 16px; margin-bottom: 8px; white-space: pre-line; font-size: 18px; }
.msg.u { background: var(--ink); color: #fff; margin-left: 20%; }
.msg.a { background: #fff; border: 1px solid var(--line); margin-right: 6%; }

/* keypad */
.kp-wrap, .confirm-wrap, .tick-wrap, .full { position: fixed; inset: 0; z-index: 50; display: none; }
.kp-wrap { background: rgba(0,0,0,.5); align-items: flex-end; justify-content: center; }
.kp-wrap.on, .confirm-wrap.on, .tick-wrap.on, .full.on { display: flex; }
.kp { width: min(560px, 100%); background: var(--bg); border-radius: 24px 24px 0 0; padding: 16px 14px calc(16px + env(safe-area-inset-bottom)); }
.kp h4 { margin: 0 0 8px; font-size: 20px; text-align: center; color: var(--ink2); }
.kp .disp { background: #fff; border: 2px solid var(--ink); border-radius: 16px; min-height: 76px; font-size: 44px; font-weight: 900; display: flex; align-items: center; justify-content: flex-end; padding: 0 16px; margin-bottom: 8px; overflow: hidden; }
.kp .sub { text-align: center; min-height: 28px; font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.kp .keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kp .keys button { min-height: 68px; border-radius: 16px; border: 0; background: #fff; font-size: 32px; font-weight: 800; box-shadow: 0 2px 0 var(--line); }
.kp .keys button.fn { background: #e6e9e7; font-size: 26px; }
.kp .quick { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 8px; }
.kp .quick button { flex: none; min-height: 52px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--green); background: var(--green-l); color: var(--green-d); font-weight: 800; font-size: 18px; }
.kp .ok-row { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; margin-top: 8px; }
.kp .ok-row button { min-height: 68px; border-radius: 16px; font-size: 22px; font-weight: 800; border: 0; }
.kp .ok-row .no { background: #e6e9e7; }
.kp .ok-row .yes { background: var(--green); color: #fff; }

.confirm-wrap { background: rgba(0,0,0,.55); align-items: center; justify-content: center; padding: 20px; }
.confirm { width: min(460px, 100%); background: #fff; border-radius: 24px; padding: 24px 18px 18px; text-align: center; }
.confirm .em { font-size: 60px; }
.confirm p { white-space: pre-line; font-size: 21px; font-weight: 700; margin: 8px 0 18px; }
.confirm .yn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.confirm .yn button { min-height: 76px; border-radius: 18px; border: 0; font-size: 24px; font-weight: 900; }
.confirm .yn .no { background: #e6e9e7; }
.confirm .yn .yes { background: var(--green); color: #fff; }
.confirm .yn .yes.danger { background: var(--red); }

.tick-wrap { align-items: center; justify-content: center; background: rgba(255,255,255,.88); flex-direction: column; gap: 10px; pointer-events: none; }
.tick { width: 150px; height: 150px; border-radius: 50%; background: var(--green); color: #fff; font-size: 96px; font-weight: 900; display: flex; align-items: center; justify-content: center; animation: pop .35s ease-out; box-shadow: 0 10px 30px rgba(10,157,88,.4); }
.tick-wrap p { font-size: 26px; font-weight: 900; margin: 0; text-align: center; padding: 0 20px; }
.tick-wrap p.big { font-size: 40px; color: var(--green-d); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.toast { position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translate(-50%, -160%); max-width: calc(100% - 28px); padding: 14px 18px; border-radius: 16px; background: var(--ink); color: #fff; font-size: 18px; font-weight: 700; z-index: 60; transition: transform .2s; pointer-events: none; text-align: center; }
.toast.on { transform: translate(-50%, 0); }

/* full-screen: setup, tour, scanner */
.full { background: var(--bg); overflow-y: auto; flex-direction: column; align-items: center; }
.full .wrap { width: min(520px, 100%); padding: calc(24px + env(safe-area-inset-top)) 18px 30px; }
.full h2 { font-size: 28px; margin: 10px 0 16px; text-align: center; }
.full .logo { display: block; width: 96px; height: 96px; border-radius: 24px; margin: 0 auto; box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.choice { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 76px; margin-bottom: 10px; padding: 0 18px; border-radius: 20px; border: 3px solid var(--line); background: #fff; font-size: 22px; font-weight: 800; text-align: left; }
.choice span { font-size: 36px; }
.choice.on { border-color: var(--green); background: var(--green-l); }
.dots { display: flex; justify-content: center; gap: 8px; margin: 14px 0; }
.dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--green); width: 30px; border-radius: 6px; }
.tour-pic { font-size: 120px; text-align: center; line-height: 1.2; margin-top: 20px; }
.tour-txt { font-size: 24px; font-weight: 700; text-align: center; margin: 10px 0 18px; }
.scan-full { background: #000; color: #fff; justify-content: center; }
.scan-full .wrap { text-align: center; }
#reader { width: 100%; max-width: 420px; margin: 0 auto 14px; border-radius: 18px; overflow: hidden; background: #111; min-height: 220px; }
#reader video { width: 100% !important; object-fit: cover; }
.scan-full .f { color: #ddd; }
.scan-full .f input { background: #fff; color: #000; font-size: 24px; letter-spacing: 1px; }

@media print {
  body * { visibility: hidden !important; }
  #print-area, #print-area * { visibility: visible !important; }
  #print-area { position: absolute; left: 0; top: 0; width: 72mm; border: 0; padding: 0; font-size: 12px; }
  .sheet { position: absolute; max-height: none; overflow: visible; transform: none; left: 0; }
}
