:root {
  --brand: #0F766E;
  --bg: #F6F4EF;
  --card: #FFFFFF;
  --ink: #1C1917;
  --muted: #78716C;
  --line: #E7E5E4;
  --ok: #15803D;
  --err: #B91C1C;
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 460px; margin: 0 auto; padding: 0 16px 48px; }
.wide { max-width: 1040px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* Толгой хэсэг */
.hero {
  background: var(--brand); color: #fff; padding: 28px 16px 72px; text-align: center;
  background-image: radial-gradient(circle at 85% -10%, rgba(255,255,255,.22), transparent 55%);
}
.hero .mark {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 10px; display: grid; place-items: center;
  background: rgba(255,255,255,.18); font-size: 26px; font-weight: 800; border: 1px solid rgba(255,255,255,.35);
}
.logo-card {
  background: #fff; border-radius: 20px; padding: 12px 18px; width: min(240px, 70%); margin: 0 auto 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.logo-card img { display: block; width: 100%; height: auto; max-height: 150px; object-fit: contain; }
.mark img, .topbar .mark img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block; }
.topbar .mark { overflow: hidden; background: #fff; }
.hero h1 { margin: 0; font-size: 22px; letter-spacing: .2px; }
.hero p { margin: 4px 0 0; opacity: .85; font-size: 14px; }
.lift { margin-top: -52px; }

.card {
  background: var(--card); border-radius: var(--radius); padding: 20px; margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(28,25,23,.04), 0 6px 24px rgba(28,25,23,.06);
}
.card h2 { margin: 0 0 12px; font-size: 17px; }

/* Бонус карт */
.balance-label { font-size: 13px; color: var(--muted); }
.balance { font-size: 40px; font-weight: 800; letter-spacing: -1px; color: var(--brand); }
.progress { height: 14px; background: #F1EFEA; border-radius: 99px; overflow: hidden; margin: 14px 0 8px; }
.progress > div { height: 100%; background: var(--brand); border-radius: 99px; transition: width .9s cubic-bezier(.2,.8,.2,1); min-width: 4px; }
.progress-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.progress-row b { color: var(--ink); }

/* Маягт */
label { display: block; font-size: 13px; font-weight: 600; margin: 12px 0 6px; }
input, select {
  width: 100%; font: inherit; font-size: 17px; padding: 13px 14px; border: 1.5px solid var(--line);
  border-radius: 12px; background: #fff; color: var(--ink); outline: none;
}
input:focus { border-color: var(--brand); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  font: inherit; font-weight: 700; font-size: 16px; padding: 14px 18px; border: 0; border-radius: 12px;
  background: var(--brand); color: #fff; cursor: pointer; margin-top: 16px; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--line); }
.btn.small { width: auto; padding: 9px 14px; font-size: 14px; margin-top: 0; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.linkbtn { background: none; border: 0; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; padding: 0; }
.msg { margin-top: 12px; padding: 11px 13px; border-radius: 10px; font-size: 14px; }
.msg.err { background: #FEF2F2; color: var(--err); }
.msg.ok { background: #F0FDF4; color: var(--ok); }

.tabs2 { display: flex; background: #F1EFEA; border-radius: 12px; padding: 4px; margin-bottom: 6px; }
.tabs2 button { flex: 1; border: 0; background: none; padding: 10px; border-radius: 9px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs2 button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.steps { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { position: relative; padding: 0 0 12px 38px; font-size: 14px; }
.steps li::before {
  counter-increment: s; content: counter(s); position: absolute; left: 0; top: -2px; width: 26px; height: 26px;
  border-radius: 50%; background: color-mix(in srgb, var(--brand) 14%, white); color: var(--brand);
  font-weight: 800; font-size: 13px; display: grid; place-items: center;
}

.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 14px; }
.history li:first-child { border-top: 0; }
.amt-plus { color: var(--ok); font-weight: 700; white-space: nowrap; }
.amt-minus { color: var(--err); font-weight: 700; white-space: nowrap; }
.amt-buy { color: var(--ink); font-weight: 600; white-space: nowrap; }

.refbox { display: flex; gap: 8px; align-items: center; background: #F7F6F2; border: 1.5px dashed var(--line); border-radius: 12px; padding: 10px 12px; font-size: 13px; word-break: break-all; }

/* Амжилтын цонх */
.toast-overlay { position: fixed; inset: 0; background: rgba(28,25,23,.45); display: grid; place-items: center; z-index: 50; padding: 16px; }
.toast-box { background: #fff; border-radius: 22px; padding: 28px 22px; text-align: center; max-width: 360px; width: 100%; animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
.toast-box .big { font-size: 34px; font-weight: 800; color: var(--brand); margin: 6px 0; }
.toast-box .check { width: 64px; height: 64px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; margin: 0 auto 8px; font-size: 32px; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

/* Касс */
.topbar { background: var(--brand); color: #fff; }
.topbar .inner { max-width: 1040px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.topbar .mark { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.2); display: grid; place-items: center; font-weight: 800; }
.topbar .t { font-weight: 700; flex: 1; }
.topbar button { background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 9px; padding: 8px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.nav { display: flex; gap: 6px; overflow-x: auto; padding: 14px 0 6px; }
.nav button { border: 0; background: #fff; padding: 10px 16px; border-radius: 99px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.nav button.on { background: var(--ink); color: #fff; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.amount-input { font-size: 34px; font-weight: 800; text-align: right; padding: 14px 16px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.quick button { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 4px; font: inherit; font-weight: 600; cursor: pointer; }
.qrbox { text-align: center; }
.qrbox .qr { width: min(320px, 100%); margin: 6px auto; background: #fff; padding: 10px; border-radius: 16px; border: 1px solid var(--line); }
.qrbox .qr svg { display: block; width: 100%; height: auto; }
.qr-amount { font-size: 30px; font-weight: 800; }
.status { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 99px; background: #F1EFEA; font-weight: 600; font-size: 14px; margin-top: 6px; }
.status.ok { background: #DCFCE7; color: var(--ok); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #F59E0B; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: #fff; border-radius: 16px; padding: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.kpi .v { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.kpi .l { font-size: 12.5px; color: var(--muted); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 6px; border-top: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; border-top: 0; }
td.r, th.r { text-align: right; }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 8px; }
.bars div { flex: 1; background: var(--brand); border-radius: 6px 6px 2px 2px; min-height: 3px; position: relative; opacity: .85; }
.bars-l { display: flex; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 4px; }
.bars-l span { flex: 1; text-align: center; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #F1EFEA; }
.cust-box { background: #F7F6F2; border-radius: 14px; padding: 14px; margin-top: 12px; }

/* Постер */
.poster-body { background: #e7e5e4; }
.poster-tools { text-align: center; padding: 16px; }
.poster-tools .btn { width: auto; }
.poster { width: 148mm; min-height: 200mm; margin: 0 auto 24px; background: #fff; padding: 14mm 12mm; text-align: center; border-top: 10mm solid var(--brand); }
.poster-top { display: flex; align-items: center; justify-content: center; gap: 10px; }
.poster-mark { width: 44px; height: 44px; border-radius: 12px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 22px; }
.poster-logo { max-width: 78mm; max-height: 48mm; object-fit: contain; }
.poster-name { font-size: 24px; font-weight: 800; }
.poster-head { font-size: 30px; font-weight: 800; line-height: 1.15; margin: 10mm 0 6mm; color: var(--brand); }
.poster-qr { width: 70mm; margin: 0 auto; }
.poster-qr svg { width: 100%; height: auto; display: block; }
.poster-steps { text-align: left; margin: 8mm auto 0; max-width: 110mm; font-size: 15px; }
.poster-steps div { padding: 4px 0; }
.poster-steps div > b:first-child { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; margin-right: 8px; font-size: 13px; }
.poster-foot { margin-top: 8mm; font-weight: 700; padding: 10px; border-radius: 10px; background: color-mix(in srgb, var(--brand) 12%, white); }
@media print {
  .noprint { display: none; }
  .poster-body { background: #fff; }
  .poster { margin: 0 auto; }
  @page { size: A5; margin: 0; }
}
