:root{
  --card: rgba(255,255,255,.06);
  --line: rgba(255,255,255,.10);
  --text:#f4f6ff;
  --muted: rgba(255,255,255,.65);
  --gold1:#f7d27a;
  --gold2:#d6a847;
  --green:#19d37b;
  --danger:#b23b3b;
  --shadow: 0 18px 50px rgba(0,0,0,.55);
}
*{box-sizing:border-box}
html{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial;
  color:var(--text);
  background:
    radial-gradient(1200px 700px at 50% 8%, rgba(247,210,122,.18), transparent 60%),
    radial-gradient(900px 600px at 50% 35%, rgba(45,212,191,.10), transparent 55%),
    linear-gradient(180deg, #04050a 0%, #070911 55%, #05060b 100%);
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}
.hero{padding:26px 14px 10px; text-align:center}
.hero-inner{max-width:1040px;margin:0 auto}
.hero-logo{width:74px;height:74px;border-radius:18px;box-shadow:0 10px 35px rgba(0,0,0,.55)}
h1{margin:12px 0 4px; font-size:28px}
.sub{margin:0 0 14px; color:var(--muted); font-size:12px}
.row{display:flex;gap:12px;justify-content:center;flex-wrap:wrap}

.seg{display:inline-flex; gap:10px; padding:8px;background:rgba(0,0,0,.35);border:1px solid var(--line);border-radius:999px;box-shadow:var(--shadow)}
.segbtn,.segbtn2{
  min-width:110px;padding:10px 14px;border-radius:999px;border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.04);color:var(--text);font-weight:900;cursor:pointer
}
.segbtn.active,.segbtn2.active{
  border-color: rgba(247,210,122,.55);
  background: linear-gradient(180deg, rgba(247,210,122,.22), rgba(0,0,0,.15));
  box-shadow: 0 0 0 3px rgba(247,210,122,.10) inset
}

.wrap{max-width:1040px;margin:0 auto;padding:14px;display:flex;flex-direction:column;gap:14px}
.card{background: var(--card);border:1px solid var(--line);border-radius:18px;box-shadow: var(--shadow);padding:16px}
.cardhead{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}
.cardhead h2{margin:0;font-size:16px}
.pill{padding:8px 12px;border-radius:999px;border:1px solid rgba(255,255,255,.10);color:rgba(255,255,255,.78);background:rgba(0,0,0,.25);font-size:12px}
.bar{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-start;margin-top:12px}

.big-total{padding:18px 16px}
.total-label{color:var(--muted); font-size:12px; margin-bottom:8px}
.total-amt{font-size:54px;font-weight:1000;color: var(--green);text-align:center}
@media (max-width:820px){.total-amt{font-size:42px}.segbtn,.segbtn2{min-width:92px}}

.grid{display:grid;grid-template-columns: repeat(2, minmax(0,1fr));gap:12px}
@media (max-width:820px){.grid{grid-template-columns:1fr}}

.field label{display:block;color:rgba(255,255,255,.78);font-size:12px;margin:2px 0 8px}
.field input,.field select{
  width:100%;padding:14px 14px;border-radius:14px;border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.35);color:var(--text);outline:none;scroll-margin-top: 110px;
}
.field input:focus,.field select:focus{border-color: rgba(247,210,122,.55);box-shadow: 0 0 0 3px rgba(247,210,122,.10)}
.hint{margin-top:8px;color:var(--muted);font-size:11px}
.err{margin-top:10px; padding:10px; border-radius:14px; background: rgba(178,59,59,.18); border:1px solid rgba(178,59,59,.40); color: rgba(255,220,220,.95); font-size:12px; white-space:pre-wrap}

.btnrow{display:flex;gap:12px;flex-wrap:wrap;margin-top:14px}
.btn{
  flex:1;min-width:140px;padding:14px 14px;border-radius:14px;border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);color:var(--text);font-weight:950;cursor:pointer
}
.btn.mini{min-width:0; flex:0; padding:10px 12px; border-radius:12px}
.btn.gold{background: linear-gradient(90deg, rgba(247,210,122,.95), rgba(214,168,71,.95));color:#1b1402;border-color: rgba(247,210,122,.65)}
.btn.danger{background: rgba(178,59,59,.18); border-color: rgba(178,59,59,.40)}
.btn:active{transform: translateY(1px)}

.liveGrid{display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:12px}
@media (max-width:820px){.liveGrid{grid-template-columns:1fr}}
.liveBox{border:1px solid rgba(255,255,255,.10); border-radius:16px; padding:12px; background: rgba(0,0,0,.18)}
.liveBox .k{color:rgba(255,255,255,.70); font-size:12px; margin-bottom:6px}
.liveBox .v{font-size:24px; font-weight:1000}
.liveBox .s{margin-top:6px; color:rgba(255,255,255,.65); font-size:12px}

.rowInline{display:flex; gap:10px}
.rowInline input{flex:1}
.rowInline select{flex:0}

.tablewrap{overflow:auto;border-radius:14px;border:1px solid rgba(255,255,255,.10);margin-top:10px}
.tbl{width:100%;border-collapse:collapse;min-width:980px}
.tbl th,.tbl td{padding:10px 10px;border-bottom:1px solid rgba(255,255,255,.08);text-align:center;font-size:13px}
.tbl th{color:var(--muted);font-weight:950;background: rgba(255,255,255,.03)}
.iconbtn{padding:8px 10px;border-radius:12px;border:1px solid rgba(255,255,255,.12);background:rgba(0,0,0,.28);color:var(--text);cursor:pointer}
.thumb{width:42px;height:42px;border-radius:10px;object-fit:cover;border:1px solid rgba(255,255,255,.12)}

.history{display:flex; flex-direction:column; gap:10px; margin-top:12px}
.hitem{border:1px solid rgba(255,255,255,.10); border-radius:14px; padding:12px; background:rgba(0,0,0,.20); display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap}
.hmeta{display:flex; flex-direction:column; gap:4px}
.hmeta .t{font-weight:950}
.hmeta .s{color:var(--muted); font-size:12px}
.hbtns{display:flex; gap:10px; align-items:center; flex-wrap:wrap}

.sheet{
  position:fixed; inset:0;
  background: rgba(0,0,0,.70);
  display:none;
  padding: env(safe-area-inset-top) 12px env(safe-area-inset-bottom) 12px;
  z-index: 50;
}
.sheet.show{display:block}
.sheet-card{
  max-width:1040px; margin: 16px auto;
  background:#fff; color:#111;
  border-radius:16px; overflow:hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.65);
}
.sheet-top{
  display:flex; justify-content:space-between; align-items:center;
  padding:12px 12px; border-bottom:1px solid #eee;
}
.sheet-title{font-weight:950}
.sheet-body{padding:16px}
.page{
  background:#fff;
  border:1px solid #eee;
  border-radius:14px;
  padding:16px;
  margin-bottom:14px;
}
.phead{display:flex; gap:14px; align-items:center; border-bottom:2px solid #f1f1f1; padding-bottom:12px; margin-bottom:12px}
.plogo{width:54px;height:54px;border-radius:14px}
.ptitle{font-weight:950; font-size:16px}
.psub{color:#444; font-size:12px; margin-top:2px}
.twoCol{display:grid; grid-template-columns: 1fr 1fr; gap:12px}
.box{border:1px solid #eee; border-radius:12px; padding:12px}
.rowline{display:flex; justify-content:space-between; gap:10px; font-size:12px; padding:4px 0}
.bigRow strong{font-size:18px}
.ptbl{width:100%; border-collapse:collapse; margin-top:10px}
.ptbl th,.ptbl td{border:1px solid #eee; padding:8px; font-size:11px; text-align:center}
.ptbl th{background:#fafafa}
.phGrid{display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:10px; margin-top:10px}
.ph{border:1px solid #eee;border-radius:12px; overflow:hidden}
.ph img{width:100%; height:120px; object-fit:cover; display:block}
.pfoot{margin-top:12px; padding-top:10px; border-top:1px solid #eee; font-size:11px; color:#555; text-align:center}

@media print{
  body{background:#fff}
  .hero,.wrap{display:none!important}
  .sheet{display:block!important;background:transparent!important;padding:0!important}
  .sheet-card{box-shadow:none!important;margin:0!important;border-radius:0!important}
  .sheet-top{display:none!important}
  .page{page-break-after: always; border:none; border-radius:0; margin:0; padding:18px}
  .page:last-child{page-break-after:auto}
  @page{size: letter; margin: 12mm;}
}

.qid{color:rgba(255,255,255,.72); font-size:12px}
