:root {
  --bg:#0b1220; --panel:#131c2f; --panel2:#1b2742; --line:#26324d; --ink:#f8fafc; --mut:#94a3b8;
  --brand:#2f7bff; --ok:#22c55e; --warn:#f59e0b; --bad:#ef4444; --cash:#16a34a; --card:#2563eb; --online:#475569;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html, body { margin:0; height:100%; background:var(--bg); color:var(--ink);
  font:17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior:none; }
button { font:inherit; color:inherit; border:0; cursor:pointer; touch-action:manipulation; }
input { font:inherit; }
#app { height:100%; display:flex; flex-direction:column; padding-top:var(--safe-t); }
.hidden { display:none !important; }

/* giriş */
.login { margin:auto; width:min(420px, 100%); padding:28px 22px calc(28px + var(--safe-b)); }
.login .logo { width:72px; height:72px; border-radius:20px; background:var(--brand); display:grid; place-items:center;
  font-size:30px; font-weight:800; margin:0 auto 18px; }
.login h1 { text-align:center; font-size:24px; margin:0 0 6px; }
.login p { text-align:center; color:var(--mut); margin:0 0 26px; }
.field { display:block; margin-bottom:14px; }
.field span { display:block; color:var(--mut); font-size:14px; margin-bottom:6px; }
.field input { width:100%; height:56px; border-radius:14px; border:2px solid var(--line); background:var(--panel);
  color:var(--ink); padding:0 16px; font-size:20px; }
.field input:focus { outline:none; border-color:var(--brand); }
.err { color:#fecaca; background:rgba(239,68,68,.14); border:1px solid rgba(239,68,68,.45); border-radius:12px; padding:10px 14px; margin-bottom:14px; }

/* üst çubuk */
.top { display:flex; align-items:center; gap:8px; padding:10px 10px; background:var(--panel); border-bottom:1px solid var(--line); }
.top .who { flex:1; min-width:84px; }
.top .who b { display:block; font-size:16px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.top .who small { color:var(--mut); }
.conn { width:12px; height:12px; border-radius:50%; background:var(--bad); flex:none; }
.conn.on { background:var(--ok); }
.stsel { display:flex; background:var(--panel2); border-radius:12px; padding:3px; }
.stsel button { background:transparent; padding:9px 8px; border-radius:10px; font-size:13px; font-weight:600; color:var(--mut); min-height:40px; }
.stsel button.act { background:var(--brand); color:#fff; }
.stsel button.act.BREAK { background:var(--warn); color:#111; }
.stsel button.act.OFFLINE { background:#64748b; }

main { flex:1; overflow-y:auto; padding:14px 14px 18px; -webkit-overflow-scrolling:touch; }
nav.tabs { display:flex; background:var(--panel); border-top:1px solid var(--line); padding-bottom:var(--safe-b); }
nav.tabs button { flex:1; background:transparent; padding:12px 4px 10px; font-size:13px; font-weight:700; color:var(--mut); position:relative; min-height:62px; }
nav.tabs button svg { display:block; margin:0 auto 4px; width:26px; height:26px; }
nav.tabs button.act { color:var(--brand); }
nav.tabs .badge { position:absolute; top:6px; left:calc(50% + 8px); background:var(--bad); color:#fff; border-radius:99px; font-size:12px; min-width:20px; height:20px; line-height:20px; padding:0 5px; }

/* paket kartı */
.pkg { background:var(--panel); border:1px solid var(--line); border-radius:18px; margin-bottom:14px; overflow:hidden; }
.pay { padding:14px 16px; font-weight:900; font-size:22px; letter-spacing:.3px; display:flex; justify-content:space-between; align-items:baseline; }
.pay small { font-size:14px; font-weight:700; opacity:.9; }
.pay.cash { background:var(--cash); } .pay.card { background:var(--card); } .pay.online { background:var(--online); }
.pkg .body { padding:14px 16px 6px; }
.pkg .name { font-size:20px; font-weight:800; }
.pkg .code { color:var(--mut); font-weight:600; font-size:14px; }
.pkg .addr { margin:6px 0 4px; font-size:18px; }
.pkg .items { color:var(--mut); font-size:15px; margin:6px 0; }
.pkg .note { background:rgba(245,158,11,.16); border:1px solid rgba(245,158,11,.5); color:#fde68a; border-radius:10px; padding:8px 12px; margin:8px 0; font-size:15px; }
.acts { display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; padding:8px 14px 0; }
.btn { border-radius:14px; padding:14px 8px; font-weight:800; text-align:center; background:var(--panel2); min-height:54px; display:flex; align-items:center; justify-content:center; gap:6px; text-decoration:none; color:var(--ink); font-size:15px; }
.btn.primary { background:var(--brand); } .btn.ok { background:var(--ok); color:#06210f; } .btn.warn { background:var(--warn); color:#1a1200; }
.btn.bad { background:var(--bad); } .btn.wide { grid-column:1 / -1; font-size:19px; min-height:62px; }
.btn[disabled] { opacity:.45; }
.pkg .foot { padding:8px 14px 14px; display:grid; gap:8px; }
.empty { text-align:center; color:var(--mut); padding:56px 20px; }
.empty b { display:block; font-size:20px; color:var(--ink); margin-bottom:8px; }

/* ödeme / onay sayfası */
.sheet-bg { position:fixed; inset:0; background:rgba(2,6,23,.72); display:flex; align-items:flex-end; z-index:20; }
.sheet { width:100%; background:var(--panel); border-radius:22px 22px 0 0; padding:20px 16px calc(20px + var(--safe-b)); border-top:1px solid var(--line); max-height:88vh; overflow:auto; }
.sheet h3 { margin:0 0 4px; font-size:21px; } .sheet p { color:var(--mut); margin:0 0 16px; }
.sheet .opts { display:grid; gap:10px; margin-bottom:10px; }
.opt { background:var(--panel2); border:3px solid transparent; border-radius:16px; padding:16px; font-size:20px; font-weight:800; text-align:left; display:flex; justify-content:space-between; }
.opt.sel { border-color:var(--brand); background:#12306b; }

/* QR */
.scan { position:relative; border-radius:18px; overflow:hidden; background:#000; aspect-ratio:3/4; max-height:56vh; width:100%; }
.scan video { width:100%; height:100%; object-fit:cover; }
.scan .frame { position:absolute; inset:18% 14%; border:3px solid rgba(255,255,255,.9); border-radius:22px; box-shadow:0 0 0 999px rgba(0,0,0,.38); pointer-events:none; }
.scan .hint { position:absolute; left:0; right:0; bottom:10px; text-align:center; font-weight:700; text-shadow:0 1px 4px #000; }
.scan.flash { outline:6px solid var(--ok); }
.row { display:flex; gap:10px; margin:12px 0; } .row .btn { flex:1; }
.manual { display:flex; gap:8px; margin-top:6px; }
.manual input { flex:1; height:54px; border-radius:14px; border:2px solid var(--line); background:var(--panel); color:var(--ink); padding:0 14px; font-size:18px; text-transform:uppercase; letter-spacing:1px; }
.log { margin-top:14px; } .log h4 { margin:0 0 8px; color:var(--mut); font-size:14px; text-transform:uppercase; letter-spacing:.5px; }
.logrow { display:flex; justify-content:space-between; gap:10px; background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:10px 14px; margin-bottom:8px; }
.logrow.good { border-color:rgba(34,197,94,.6); } .logrow.fail { border-color:rgba(239,68,68,.6); }

/* kasam */
.sum { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-bottom:14px; }
.stat { background:var(--panel); border:1px solid var(--line); border-radius:16px; padding:14px; }
.stat small { color:var(--mut); display:block; font-size:13px; } .stat b { font-size:24px; }
.stat.cash b { color:#4ade80; } .stat.card b { color:#60a5fa; } .stat.meal b { color:#fbbf24; }
.stat.big { grid-column:1 / -1; background:var(--panel2); } .stat.big b { font-size:32px; }
h4.sec { margin:18px 0 8px; color:var(--mut); font-size:14px; text-transform:uppercase; letter-spacing:.5px; }
.line { display:flex; justify-content:space-between; gap:10px; padding:11px 2px; border-bottom:1px solid var(--line); }

#toast { position:fixed; left:12px; right:12px; top:calc(12px + var(--safe-t)); z-index:40; background:#0f172a; border:2px solid var(--brand);
  border-radius:14px; padding:14px 16px; font-weight:700; opacity:0; transform:translateY(-14px); transition:.2s; pointer-events:none; }
#toast.show { opacity:1; transform:none; } #toast.bad { border-color:var(--bad); } #toast.ok { border-color:var(--ok); }

/* dar ekran: ad satırı üstte, durum anahtarı alt satırda tam genişlikte (ad kesilmesin) */
.top { flex-wrap:wrap; row-gap:8px; }
.top .who { order:1; flex:1 1 0; }
.top > .btn { order:2; }
.stsel { order:3; flex:1 1 100%; }
.stsel button { flex:1; }

/* v3: rakip analizi ile eklenenler */
.strip { display:flex; justify-content:space-between; align-items:center; background:var(--panel2); border:1px solid var(--line); border-radius:14px; padding:10px 14px; margin-bottom:12px; font-weight:700; }
.pkg .dist { color:#7dd3fc; font-weight:700; font-size:15px; margin-top:2px; }
.pkg .note.bad { background:rgba(239,68,68,.14); border-color:rgba(239,68,68,.5); color:#fecaca; }
.pkg .acts + .acts { padding-top:8px; }
.queue { background:rgba(245,158,11,.16); border:1px solid rgba(245,158,11,.55); color:#fde68a; border-radius:12px; padding:10px 14px; margin-bottom:12px; font-weight:700; }
.sheetin { width:100%; height:52px; border-radius:14px; border:2px solid var(--line); background:var(--panel2); color:var(--ink); padding:0 14px; font-size:17px; margin-top:6px; }
.sheetin:focus, #app input:focus { outline:none; border-color:var(--brand); }
.proofimg { display:block; width:100%; max-height:200px; object-fit:cover; border-radius:14px; margin-bottom:10px; }
.stat.earn b { color:#fbbf24; }
.stat b small { display:inline; }
.line .sub { display:block; color:var(--mut); font-size:13px; }
.profile-in { margin-bottom:8px; }
main input:not([type=file]) { width:100%; height:52px; border-radius:14px; border:2px solid var(--line); background:var(--panel); color:var(--ink); padding:0 14px; font-size:18px; }
main .manual input { width:auto; flex:1; height:54px; }
