:root{
  --bg: #0a0a0d;
  --bg-elevated: #111114;
  --glass: rgba(255,255,255,0.045);
  --glass-strong: rgba(255,255,255,0.075);
  --glass-border: rgba(255,255,255,0.09);
  --glass-border-soft: rgba(255,255,255,0.055);
  --red: #ff2d46;
  --red-dim: #c81730;
  --red-glow: rgba(255,45,70,0.35);
  --text: #f3f3f6;
  --text-dim: #96969f;
  --text-faint: #616168;
  --green: #34d399;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 10px;
  --ease: cubic-bezier(.22,.9,.32,1);
}

*{box-sizing:border-box; margin:0; padding:0;}
html,body{height:100%;}
body.gudaguda-app{
  font-family:'Vazirmatn', sans-serif;
  background:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(255,45,70,0.10), transparent 60%),
    radial-gradient(ellipse 700px 500px at 100% 10%, rgba(255,45,70,0.06), transparent 55%),
    var(--bg);
  color:var(--text);
  min-height:100vh;
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
}
::selection{ background:var(--red); color:#fff; }
::-webkit-scrollbar{width:8px; height:8px;}
::-webkit-scrollbar-thumb{background:rgba(255,255,255,0.12); border-radius:10px;}
::-webkit-scrollbar-track{background:transparent;}

button{ font-family:inherit; cursor:pointer; border:none; background:none; color:inherit; }
input, select{ font-family:inherit; color:inherit; }
a{ text-decoration:none; color:inherit; }
code{ background:rgba(255,255,255,0.06); padding:2px 6px; border-radius:6px; font-size:12px; }

/* ---------- Layout shell ---------- */
.shell{ display:flex; min-height:100vh; }

/* ---------- Sidebar ---------- */
.sidebar{
  width:250px; flex:0 0 250px;
  background:linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015));
  border-left:1px solid var(--glass-border-soft);
  padding:26px 18px;
  display:flex; flex-direction:column; gap:6px;
  position:sticky; top:0; height:100vh;
}
.brand{ padding:6px 10px 22px; display:block; }
.brand .logo{
  font-size:22px; font-weight:900; letter-spacing:0.5px;
  display:flex; align-items:baseline; gap:2px;
}
.brand .logo span{ color:var(--red); }
.brand .sub{
  font-size:10.5px; color:var(--text-faint); letter-spacing:2.5px; margin-top:4px; font-weight:600;
}
.nav-group{ display:flex; flex-direction:column; gap:3px; margin-bottom:18px;}
.nav-label{ font-size:11px; color:var(--text-faint); padding:14px 12px 6px; letter-spacing:0.5px; font-weight:600;}
.nav-item{
  display:flex; align-items:center; gap:11px;
  padding:11px 13px; border-radius:12px;
  color:var(--text-dim); font-size:13.5px; font-weight:500;
  transition:background .18s var(--ease), color .18s var(--ease);
  position:relative;
}
.nav-item .ic{ font-size:15px; width:18px; text-align:center; opacity:.9;}
.nav-item:hover{ background:var(--glass); color:var(--text); }
.nav-item.active{
  background:linear-gradient(90deg, rgba(255,45,70,0.16), rgba(255,45,70,0.04));
  color:#fff; font-weight:700;
}
.nav-item.active::before{
  content:''; position:absolute; right:-18px; top:8px; bottom:8px; width:3px;
  background:var(--red); border-radius:4px; box-shadow:0 0 12px var(--red-glow);
}
.sidebar-foot{
  margin-top:auto; padding:16px 14px; border-radius:16px;
  background:var(--glass); border:1px solid var(--glass-border-soft);
  font-size:12px; color:var(--text-dim); line-height:1.9;
}
.sidebar-foot b{ color:var(--text); display:block; font-size:12.5px; margin-bottom:2px;}
.sidebar-foot .num{ color:var(--red); font-weight:700; direction:ltr; display:inline-block;}

/* ---------- Main column ---------- */
.main{ flex:1; min-width:0; display:flex; flex-direction:column; }

/* Header */
.topbar{
  display:flex; align-items:center; gap:18px;
  padding:16px 28px;
  border-bottom:1px solid var(--glass-border-soft);
  position:sticky; top:0; z-index:30;
  background:rgba(10,10,13,0.78); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px);
}
.search-wrap{ flex:1; max-width:460px; position:relative; }
.search-wrap input{
  width:100%; padding:11px 42px 11px 16px; border-radius:13px;
  background:var(--glass); border:1px solid var(--glass-border-soft);
  font-size:13.5px; color:var(--text); transition:border-color .2s;
}
.search-wrap input::placeholder{ color:var(--text-faint); }
.search-wrap input:focus{ outline:none; border-color:rgba(255,45,70,0.5); }
.search-wrap .ic{ position:absolute; right:15px; top:50%; transform:translateY(-50%); opacity:.55; font-size:14px;}
.topbar-right{ margin-right:auto; display:flex; align-items:center; gap:14px; }
.icon-btn{
  width:38px; height:38px; border-radius:11px; display:flex; align-items:center; justify-content:center;
  background:var(--glass); border:1px solid var(--glass-border-soft); position:relative; font-size:15px;
  transition:background .18s;
}
.icon-btn:hover{ background:var(--glass-strong); }
.badge{
  position:absolute; top:-5px; left:-5px; background:var(--red); color:#fff; font-size:10px; font-weight:800;
  min-width:17px; height:17px; border-radius:9px; display:flex; align-items:center; justify-content:center;
  padding:0 3px; box-shadow:0 0 0 2px var(--bg);
}
.user-chip{ display:flex; align-items:center; gap:9px; padding:5px 6px 5px 13px; border-radius:30px; background:var(--glass); border:1px solid var(--glass-border-soft);}
.avatar{ width:29px; height:29px; border-radius:50%; background:linear-gradient(135deg,var(--red),#8a0f24); display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:800;}
.user-chip .name{ font-size:12.5px; font-weight:600; }
.user-chip .role{ font-size:10.5px; color:var(--text-faint); }

/* Content */
.content{ padding:26px 28px 90px; display:flex; gap:22px; align-items:flex-start; }
.order-col{ flex:1; min-width:0; display:flex; flex-direction:column; gap:20px; }

.page-head{ display:flex; align-items:center; justify-content:space-between; gap:16px; }
.page-head h1{ font-size:19px; font-weight:800; display:flex; align-items:center; gap:9px;}
.page-head .tag{ font-size:11.5px; color:var(--text-faint); font-weight:500; margin-top:5px; line-height:1.7; max-width:640px;}
.step-pill{ font-size:11px; background:var(--glass); border:1px solid var(--glass-border-soft); padding:6px 12px; border-radius:20px; color:var(--text-dim); white-space:nowrap;}

/* Glass card base */
.glass{
  background:var(--glass);
  border:1px solid var(--glass-border-soft);
  border-radius:var(--radius-lg);
  backdrop-filter:blur(20px); -webkit-backdrop-filter:blur(20px);
}

/* Purchase type selector */
.ptype-block .lbl{ font-size:12.5px; color:var(--text-dim); font-weight:600; margin-bottom:10px; display:block;}
.ptype-row{ display:grid; grid-template-columns:repeat(2, minmax(160px,1fr)); gap:10px; max-width:420px; }
.ptype-card{
  padding:15px 12px; border-radius:16px; text-align:center; cursor:pointer;
  background:var(--glass); border:1px solid var(--glass-border-soft);
  transition:transform .16s var(--ease), border-color .16s, background .16s;
  position:relative; overflow:hidden;
}
.ptype-card:hover{ transform:translateY(-2px); border-color:rgba(255,255,255,0.16); }
.ptype-card .ic{ font-size:18px; display:block; margin-bottom:7px; opacity:.85;}
.ptype-card .t{ font-size:13px; font-weight:700; }
.ptype-card .s{ font-size:10.5px; color:var(--text-faint); margin-top:2px;}
.ptype-card.active{
  background:linear-gradient(160deg, rgba(255,45,70,0.22), rgba(255,45,70,0.06));
  border-color:var(--red);
  box-shadow:0 6px 26px -8px var(--red-glow), inset 0 0 0 1px rgba(255,45,70,0.25);
}
.ptype-card.active .t{ color:#fff; }
.ptype-card.active::after{
  content:'✓'; position:absolute; top:8px; left:9px; font-size:10px; font-weight:900;
  width:16px; height:16px; border-radius:50%; background:var(--red); color:#fff; display:flex; align-items:center; justify-content:center;
}

/* Notice */
.notice{
  display:flex; align-items:center; gap:9px; font-size:12px; color:var(--text-dim);
  background:rgba(255,255,255,0.03); border:1px dashed var(--glass-border);
  padding:11px 15px; border-radius:13px;
}

/* Check purchase panel */
.check-panel{ padding:20px; display:none; flex-direction:column; gap:16px; }
.check-panel.show{ display:flex; }
.check-grid{ display:grid; grid-template-columns:repeat(3,1fr); gap:14px; }
.field{ display:flex; flex-direction:column; gap:7px; }
.field label{ font-size:11.5px; color:var(--text-dim); font-weight:600; }
.field input, .field select{
  padding:11px 13px; border-radius:11px; background:rgba(255,255,255,0.035);
  border:1px solid var(--glass-border-soft); font-size:13px; color:var(--text);
}
.field input:focus, .field select:focus{ outline:none; border-color:rgba(255,45,70,0.5); }
.field .out{
  padding:11px 13px; border-radius:11px; background:rgba(255,45,70,0.07);
  border:1px solid rgba(255,45,70,0.22); font-size:13.5px; font-weight:800; color:var(--red);
}
.check-submit{
  align-self:flex-start; margin-top:2px;
  background:var(--red); color:#fff; font-weight:700; font-size:13.5px;
  padding:12px 26px; border-radius:13px; box-shadow:0 8px 24px -6px var(--red-glow);
  transition:transform .15s, box-shadow .15s;
}
.check-submit:hover{ transform:translateY(-1px); box-shadow:0 10px 30px -6px var(--red-glow); }
.check-submit:active{ transform:translateY(0); }

/* Product table */
.table-card{ padding:6px 0 10px; }
.table-head{ display:flex; align-items:center; justify-content:space-between; padding:14px 20px 8px; }
.table-head h3{ font-size:14.5px; font-weight:700; }
.table-head .count{ font-size:11.5px; color:var(--text-faint);}
.tier-hint{ font-size:10px; color:var(--text-faint); font-weight:500; }
.ptable{ width:100%; border-collapse:collapse; }
.ptable thead th{
  text-align:right; font-size:11px; color:var(--text-faint); font-weight:600;
  padding:10px 20px; border-bottom:1px solid var(--glass-border-soft); letter-spacing:.3px;
}
.ptable thead th.c{ text-align:center; }
.ptable tbody td{ padding:12px 20px; border-bottom:1px solid rgba(255,255,255,0.035); font-size:13px; vertical-align:middle;}
.ptable tbody tr{ transition:background .15s; }
.ptable tbody tr:hover{ background:rgba(255,255,255,0.02); }
.ptable tbody tr:last-child td{ border-bottom:none; }
.prod-cell{ display:flex; align-items:center; gap:11px; }
.prod-ico{
  width:38px; height:38px; border-radius:11px; flex:0 0 38px;
  background:linear-gradient(150deg, rgba(255,45,70,0.28), rgba(255,45,70,0.05));
  border:1px solid rgba(255,45,70,0.25);
  display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:800; color:#ff8a95;
}
.prod-name{ font-weight:700; font-size:13px; }
.prod-flavor{ font-size:11px; color:var(--text-faint); margin-top:1px; cursor:help; }
.mono{ font-family:'Vazirmatn'; direction:ltr; text-align:right; color:var(--text-dim); font-size:12px;}
.stock{ color:var(--text-dim); font-size:12.5px; }
.stock.low{ color:#f59e0b; }
.price-cell{ font-weight:700; font-size:13px; direction:ltr; text-align:right; transition:color .2s;}
.price-cell.flash{ color:var(--red); }
.tier-badge{ display:inline-block; font-size:9.5px; margin-right:6px; padding:2px 6px; border-radius:8px; background:rgba(52,211,153,0.12); color:var(--green); font-weight:700; }
.qty-stepper{ display:flex; align-items:center; justify-content:center; gap:0; width:fit-content; margin:0 auto;
  background:rgba(255,255,255,0.035); border:1px solid var(--glass-border-soft); border-radius:12px; overflow:hidden;}
.qty-stepper button{ width:32px; height:32px; font-size:16px; font-weight:700; color:var(--text-dim); transition:background .15s,color .15s;}
.qty-stepper button:hover{ background:rgba(255,45,70,0.15); color:#fff; }
.qty-stepper .val{ width:34px; text-align:center; font-weight:800; font-size:13.5px;}
.line-total{ font-weight:800; font-size:13px; direction:ltr; text-align:right; color:#fff; transition:transform .18s var(--ease);}
.line-total.pulse{ transform:scale(1.08); color:var(--red);}
.tbl-actions{ display:flex; justify-content:space-between; padding:14px 20px 6px; }
.ghost-btn{
  font-size:12.5px; color:var(--text-dim); padding:9px 16px; border-radius:11px; border:1px solid var(--glass-border-soft);
  display:inline-flex; align-items:center; gap:7px; transition:border-color .15s, color .15s;
}
.ghost-btn:hover{ border-color:rgba(255,255,255,0.22); color:var(--text); }

/* Invoice panel (aside) */
.invoice-col{ width:340px; flex:0 0 340px; position:sticky; top:88px; }
.invoice-card{ padding:22px; display:flex; flex-direction:column; gap:16px; }
.invoice-head{ display:flex; align-items:center; justify-content:space-between; }
.invoice-head h3{ font-size:15px; font-weight:800; display:flex; align-items:center; gap:8px;}
.invoice-items{ display:flex; flex-direction:column; gap:2px; max-height:290px; overflow-y:auto; padding-left:2px;}
.invoice-item{
  display:flex; align-items:center; justify-content:space-between; padding:10px 0;
  border-bottom:1px solid rgba(255,255,255,0.04);
  animation:itemIn .25s var(--ease);
}
@keyframes itemIn{ from{ opacity:0; transform:translateY(-4px);} to{opacity:1; transform:none;} }
.invoice-item .l .n{ font-size:12.5px; font-weight:700; }
.invoice-item .l .q{ font-size:11px; color:var(--text-faint); margin-top:2px;}
.invoice-item .r{ font-size:12.5px; font-weight:700; direction:ltr; }
.invoice-item .x{ color:var(--text-faint); font-size:12px; margin-right:8px; cursor:pointer;}
.invoice-item .x:hover{ color:var(--red); }
.invoice-empty{ padding:30px 0; text-align:center; color:var(--text-faint); font-size:12.5px; }
.invoice-empty .ic{ font-size:26px; display:block; margin-bottom:8px; opacity:.5;}
.summary-rows{ display:flex; flex-direction:column; gap:9px; padding-top:6px; border-top:1px solid var(--glass-border-soft);}
.srow{ display:flex; justify-content:space-between; font-size:12.5px; color:var(--text-dim);}
.srow b{ color:var(--text); font-weight:600; }
.srow.discount b{ color:var(--green); }
.final-row{
  display:flex; justify-content:space-between; align-items:baseline; padding-top:12px; margin-top:4px; border-top:1px solid var(--glass-border-soft);
}
.final-row .lab{ font-size:12.5px; color:var(--text-dim); font-weight:600;}
.final-row .val{ font-size:19px; font-weight:900; color:#fff; direction:ltr;}
.final-row .val span{ font-size:11px; color:var(--text-faint); font-weight:600; margin-right:4px;}
.cta{
  width:100%; padding:15px; border-radius:14px; background:var(--red); color:#fff; font-weight:800; font-size:14px;
  display:flex; align-items:center; justify-content:center; gap:8px;
  box-shadow:0 10px 28px -8px var(--red-glow); transition:transform .15s, box-shadow .15s, opacity .15s;
}
.cta:hover{ transform:translateY(-1px); box-shadow:0 14px 34px -8px var(--red-glow); }
.cta:disabled{ opacity:.4; box-shadow:none; cursor:not-allowed; transform:none; }

/* Mobile bottom bar */
.mobile-bar{ display:none; }
.bottom-sheet-backdrop{ display:none; }

/* Responsive */
@media (max-width: 1100px){
  .invoice-col{ display:none; }
  .content{ padding-bottom:110px; }
  .mobile-bar{
    display:flex; position:fixed; bottom:14px; left:14px; right:14px; z-index:50;
    background:rgba(20,20,24,0.85); backdrop-filter:blur(22px); -webkit-backdrop-filter:blur(22px);
    border:1px solid var(--glass-border); border-radius:18px; padding:13px 18px;
    align-items:center; justify-content:space-between; box-shadow:0 14px 40px -10px rgba(0,0,0,0.6);
  }
  .mobile-bar .info{ font-size:12px; color:var(--text-dim); display:flex; gap:10px;}
  .mobile-bar .info b{ color:#fff; }
  .mobile-bar .amt{ font-size:14.5px; font-weight:900; color:var(--red); direction:ltr;}
  .bottom-sheet-backdrop{
    position:fixed; inset:0; background:rgba(0,0,0,0.55); z-index:60; opacity:0; pointer-events:none; transition:opacity .25s;
  }
  .bottom-sheet-backdrop.open{ opacity:1; pointer-events:auto; }
  .bottom-sheet-backdrop .sheet{
    position:absolute; bottom:0; left:0; right:0; max-height:78vh; overflow-y:auto;
    background:var(--bg-elevated); border-radius:24px 24px 0 0; border:1px solid var(--glass-border);
    padding:20px 20px 26px; transform:translateY(100%); transition:transform .3s var(--ease);
  }
  .bottom-sheet-backdrop.open .sheet{ transform:translateY(0); }
  .sheet-handle{ width:40px; height:4px; background:rgba(255,255,255,0.2); border-radius:4px; margin:0 auto 16px;}
}
@media (max-width: 860px){
  .sidebar{ display:none; }
  .content{ padding:18px 14px 100px; }
  .check-grid{ grid-template-columns:1fr 1fr; }
  .topbar{ padding:13px 16px; gap:10px;}
  .user-chip .name, .user-chip .role{ display:none; }
  .ptable thead{ display:none; }
  .ptable, .ptable tbody, .ptable tr, .ptable td{ display:block; width:100%; }
  .ptable tbody tr{
    border:1px solid var(--glass-border-soft); border-radius:16px; margin:0 0 12px; padding:12px;
    background:rgba(255,255,255,0.02);
  }
  .ptable tbody td{ border:none; padding:6px 4px; }
  .mobile-row1{ display:flex; justify-content:space-between; align-items:center; }
  .mobile-row2{ display:flex; justify-content:space-between; align-items:center; margin-top:10px; }
}
@media (min-width:861px){ .mobile-only{ display:none !important; } }
@media (max-width:860px){ .desktop-only{ display:none !important; } }
