*,*::before,*::after{margin:0;padding:0;box-sizing:border-box;}
:root{
  --teal:#6ee7c9;--teal-dark:#3dc9a8;--teal-dim:rgba(110,231,201,0.1);--teal-border:rgba(110,231,201,0.25);
  --bg:#f5f6fa;--bg2:#ffffff;--bg3:#f0f1f5;
  --sidebar-bg:#0f1117;--sidebar-text:rgba(255,255,255,0.65);
  --text:#111827;--text-muted:#6b7280;--border:#e5e7eb;
  --shadow:0 1px 3px rgba(0,0,0,0.08),0 1px 2px rgba(0,0,0,0.04);--shadow-md:0 4px 12px rgba(0,0,0,0.08);
  --bronze:#cd7f32;--silver:#9ca3af;--gold:#f59e0b;--platinum:#8b5cf6;
  --success:#10b981;--warning:#f59e0b;--danger:#ef4444;--info:#3b82f6;--purple:#8b5cf6;
}
[data-theme="dark"]{--bg:#0f1117;--bg2:#1a1d27;--bg3:#151822;--text:#f2f4fb;--text-muted:#9096a8;--border:rgba(255,255,255,0.08);}
/* Nothing on the page should ever force the whole viewport to scroll
   sideways — only .table-scroll's own inner div is allowed to. Without
   this, one too-wide element anywhere quietly drags the entire page into
   horizontal scroll on mobile, which is what made the table look broken:
   the stat cards above it were being scrolled off-screen along with it. */
html,body{overflow-x:hidden;max-width:100%;}
body{font-family:'Vazirmatn','Inter',sans-serif;background:var(--bg);color:var(--text);display:flex;min-height:100vh;transition:background .3s,color .3s;}
a{color:inherit;text-decoration:none;}

/* shell banner */
.shell-badge{position:fixed;top:0;left:0;right:0;z-index:600;background:var(--teal);color:#03201a;text-align:center;font-size:11px;font-weight:700;padding:5px;}
body{padding-top:26px;}

/* SIDEBAR */
.sidebar{width:64px;min-height:calc(100vh - 32px);background:var(--sidebar-bg);position:fixed;top:42px;right:16px;z-index:100;border-radius:20px;border:1px solid rgba(255,255,255,0.07);box-shadow:0 8px 32px rgba(0,0,0,0.3);overflow:hidden;transition:width .3s cubic-bezier(.4,0,.2,1);display:flex;flex-direction:column;}
@media(hover:hover) and (min-width:769px){
  .sidebar:hover{width:240px;}
  .sidebar:hover .sb-logo-text,.sidebar:hover .sb-label,.sidebar:hover .sb-item span,.sidebar:hover .sb-badge,.sidebar:hover .sb-user-info{opacity:1;}
  .sidebar:hover .sb-item{width:216px;padding:0 12px;}
}
.sb-logo{height:60px;width:240px;display:flex;align-items:center;padding:0 14px;gap:10px;border-bottom:1px solid rgba(255,255,255,0.06);}
.sb-logo-text{font-family:'Inter',sans-serif;font-size:16px;font-weight:700;background:linear-gradient(90deg,#fff,var(--teal));-webkit-background-clip:text;-webkit-text-fill-color:transparent;background-clip:text;white-space:nowrap;opacity:0;transition:opacity .2s;}
.sb-section{padding:10px 10px 4px;width:240px;}
.sb-label{font-size:10px;font-weight:600;color:rgba(255,255,255,0.3);letter-spacing:1.5px;text-transform:uppercase;padding:0 4px;margin-bottom:4px;height:0;opacity:0;overflow:hidden;transition:height .3s,opacity .2s,margin .3s;}
.sidebar:hover .sb-label{height:20px;}
.sb-item{display:flex;align-items:center;gap:10px;padding:0 11px;width:40px;height:40px;border-radius:10px;color:rgba(255,255,255,0.55);font-size:13px;font-weight:500;cursor:pointer;transition:background .2s,color .2s,width .3s;margin-bottom:2px;overflow:hidden;white-space:nowrap;}
.sb-item:hover{background:rgba(255,255,255,0.06);color:#fff;}
.sb-item.active{background:var(--teal-dim);color:var(--teal);border:1px solid var(--teal-border);}
.sb-item svg{width:18px;height:18px;flex-shrink:0;min-width:18px;}
.sb-item span{opacity:0;transition:opacity .2s;}
.sb-badge{background:var(--teal);color:#03201a;font-size:10px;font-weight:700;padding:2px 6px;border-radius:999px;margin-right:auto;opacity:0;transition:opacity .2s;}
.sb-footer{margin-top:auto;padding:10px;border-top:1px solid rgba(255,255,255,0.06);width:240px;display:flex;flex-direction:column;gap:4px;}
.sb-theme{width:40px;height:40px;border-radius:10px;border:1px solid rgba(255,255,255,0.1);background:rgba(255,255,255,0.05);display:flex;align-items:center;justify-content:center;cursor:pointer;color:rgba(255,255,255,0.5);}
.sb-theme:hover{color:var(--teal);}
.sb-user{display:flex;align-items:center;gap:10px;padding:6px 4px;border-radius:10px;overflow:hidden;}
.sb-avatar{width:32px;height:32px;min-width:32px;border-radius:8px;background:linear-gradient(135deg,var(--teal),#3dc9a8);display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;color:#03201a;}
.sb-user-info{opacity:0;overflow:hidden;transition:opacity .2s;white-space:nowrap;}
.sb-user-name{font-size:12.5px;font-weight:600;color:#fff;}
.sb-user-role{font-size:10.5px;color:rgba(255,255,255,0.45);}
.sb-back{display:block;padding:10px 12px;font-size:11px;color:rgba(255,255,255,0.4);border-top:1px solid rgba(255,255,255,0.06);white-space:nowrap;overflow:hidden;}
.sb-back:hover{color:var(--teal);}

/* MAIN */
/* min-width:0 overrides the flex-item default of min-width:auto — without
   it, an unshrinkable descendant (a wide table row, a long badge) sets this
   item's minimum size to its content's, which can force it — and the whole
   page — wider than the viewport. That's what was actually cutting off the
   table and stat cards on mobile; overflow-x:hidden on body only hid the
   symptom (silently clipping the excess instead of scrolling to it). */
.main{margin-right:96px;flex:1;min-width:0;display:flex;flex-direction:column;min-height:100vh;}
.topbar{background:var(--bg2);border-bottom:1px solid var(--border);padding:0 24px;height:60px;display:flex;align-items:center;gap:12px;position:sticky;top:26px;z-index:50;box-shadow:var(--shadow);}
.topbar-title{font-size:15px;font-weight:700;}
.topbar-sub{font-size:11px;color:var(--text-muted);margin-top:1px;}
.tb-spacer{flex:1;}
.tb-btn{width:36px;height:36px;border-radius:10px;border:1px solid var(--border);background:var(--bg);display:flex;align-items:center;justify-content:center;cursor:pointer;color:var(--text-muted);transition:all .2s;position:relative;}
.tb-btn:hover{border-color:var(--teal);color:var(--teal);}
.role-chip{display:flex;align-items:center;gap:6px;padding:5px 12px;border-radius:999px;font-size:12px;font-weight:600;border:1px solid var(--teal-border);background:var(--teal-dim);color:var(--teal);white-space:nowrap;}

.content{padding:24px;flex:1;min-width:0;}
.page{display:none;}
.page.active{display:block;}

.stats-row{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:20px;}
.stat-card{background:var(--bg2);border:1px solid var(--border);border-radius:16px;padding:18px;box-shadow:var(--shadow);transition:transform .2s,box-shadow .2s;}
.stat-card:hover{transform:translateY(-2px);box-shadow:var(--shadow-md);}
.stat-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px;}
.stat-lbl{font-size:11px;color:var(--text-muted);font-weight:500;}
.stat-icon{width:34px;height:34px;border-radius:10px;display:flex;align-items:center;justify-content:center;}
.stat-val{font-size:26px;font-weight:800;font-family:'Vazirmatn','Inter',sans-serif;}
.stat-chg{font-size:11px;margin-top:3px;}
.up{color:var(--success);}.down{color:var(--danger);}

.card{background:var(--bg2);border:1px solid var(--border);border-radius:16px;box-shadow:var(--shadow);overflow:hidden;margin-bottom:16px;}
.card-hdr{padding:16px 20px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:12px;flex-wrap:wrap;}
.card-title{font-size:14px;font-weight:700;}
.card-sub{font-size:11px;color:var(--text-muted);margin-top:2px;}
.card-actions{margin-right:auto;display:flex;gap:8px;flex-wrap:wrap;}
.card-body{padding:18px 20px;}
.card-empty{padding:32px 20px;text-align:center;color:var(--text-muted);font-size:13px;}

table{width:100%;border-collapse:collapse;}
.table-scroll{overflow-x:auto;-webkit-overflow-scrolling:touch;}
th{padding:10px 16px;text-align:right;font-size:11px;font-weight:600;color:var(--text-muted);background:var(--bg);border-bottom:1px solid var(--border);white-space:nowrap;}
td{padding:13px 16px;font-size:13px;border-bottom:1px solid var(--border);vertical-align:middle;}
tr:last-child td{border-bottom:none;}
tr:hover td{background:var(--bg);}

.badge{display:inline-flex;align-items:center;gap:4px;padding:3px 9px;border-radius:999px;font-size:11px;font-weight:600;white-space:nowrap;}
.b-green{background:rgba(16,185,129,0.1);color:var(--success);}
.b-red{background:rgba(239,68,68,0.1);color:var(--danger);}
.b-yellow{background:rgba(245,158,11,0.1);color:var(--warning);}
.b-blue{background:rgba(59,130,246,0.1);color:var(--info);}
.b-purple{background:rgba(139,92,246,0.1);color:var(--purple);}
.b-teal{background:var(--teal-dim);color:var(--teal);}
.b-gray{background:rgba(107,114,128,0.12);color:var(--text-muted);}

.level{display:inline-flex;align-items:center;gap:5px;padding:4px 10px;border-radius:999px;font-size:11px;font-weight:700;white-space:nowrap;}
.level-bronze{background:rgba(205,127,50,0.1);color:var(--bronze);border:1px solid rgba(205,127,50,0.2);}
.level-silver{background:rgba(156,163,175,0.1);color:var(--silver);border:1px solid rgba(156,163,175,0.2);}
.level-gold{background:rgba(245,158,11,0.1);color:var(--gold);border:1px solid rgba(245,158,11,0.2);}
.level-platinum{background:rgba(139,92,246,0.1);color:var(--platinum);border:1px solid rgba(139,92,246,0.2);}

.amt-in{font-weight:700;color:var(--success);font-family:'Vazirmatn','Inter',sans-serif;}
.amt-out{font-weight:700;color:var(--danger);font-family:'Vazirmatn','Inter',sans-serif;}
.amt-neutral{font-weight:700;font-family:'Vazirmatn','Inter',sans-serif;}

.btn{display:inline-flex;align-items:center;gap:7px;padding:9px 16px;border-radius:10px;font-family:inherit;font-size:13px;font-weight:600;cursor:pointer;border:none;transition:all .2s;}
.btn-primary{background:var(--teal);color:#03201a;}
.btn-primary:hover{background:var(--teal-dark);transform:translateY(-1px);}
.btn-ghost{background:var(--bg);border:1px solid var(--border);color:var(--text);}
.btn-ghost:hover{border-color:var(--teal);color:var(--teal);}
.btn-danger{background:rgba(239,68,68,0.1);border:1px solid rgba(239,68,68,0.2);color:var(--danger);}
.btn-danger:hover{background:var(--danger);color:#fff;}
.btn-sm{padding:5px 11px;font-size:11px;border-radius:8px;}
.btn:disabled{opacity:.5;cursor:not-allowed;transform:none;}

.act-btn{width:28px;height:28px;border-radius:7px;border:1px solid var(--border);background:transparent;display:inline-flex;align-items:center;justify-content:center;cursor:pointer;color:var(--text-muted);transition:all .2s;}
.act-btn:hover{border-color:var(--teal);color:var(--teal);}

.avatar{width:32px;height:32px;border-radius:9px;display:flex;align-items:center;justify-content:center;font-size:12px;font-weight:700;color:#03201a;flex-shrink:0;background:var(--teal-dim);color:var(--teal);}
.customer-info{display:flex;align-items:center;gap:10px;}
.customer-name{font-size:13px;font-weight:600;}
.customer-biz{font-size:11px;color:var(--text-muted);margin-top:1px;}

.priority-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0;}
.p-high{background:var(--danger);}
.p-med{background:var(--warning);}
.p-low{background:var(--success);}

.form-group{display:flex;flex-direction:column;gap:6px;margin-bottom:14px;}
.form-lbl{font-size:12px;font-weight:600;color:var(--text-muted);}
.form-input,.form-select,.form-textarea{width:100%;padding:10px 12px;border:1px solid var(--border);border-radius:10px;background:var(--bg);color:var(--text);font-family:inherit;font-size:13px;outline:none;transition:border-color .2s;}
.form-input:focus,.form-select:focus,.form-textarea:focus{border-color:var(--teal);}
.form-textarea{resize:none;min-height:70px;}
.form-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;}
.chip-row{display:flex;gap:8px;flex-wrap:wrap;}
.chip{display:inline-flex;align-items:center;gap:6px;padding:7px 14px;border-radius:999px;font-size:12px;font-weight:600;cursor:pointer;border:1px solid var(--border);color:var(--text-muted);transition:all .2s;}
.chip.active{background:var(--teal-dim);border-color:var(--teal-border);color:var(--teal);}

/* Inline icon used in place of emoji throughout the shell panels. */
.ic{width:15px;height:15px;stroke:currentColor;fill:none;stroke-width:2;flex-shrink:0;vertical-align:-3px;}
.hub-title .ic,.hub-group-title .ic,.card-title .ic,.panel-link-title .ic{margin-inline-end:6px;}

.two-col{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:16px;}
.side-card{background:var(--bg2);border:1px solid var(--border);border-radius:16px;box-shadow:var(--shadow);overflow:hidden;margin-bottom:14px;}
.side-hdr{padding:14px 16px;border-bottom:1px solid var(--border);}
.side-body{padding:14px 16px;}

.progress-bar{height:6px;background:var(--border);border-radius:999px;overflow:hidden;}
.progress-fill{height:100%;border-radius:999px;background:linear-gradient(90deg,var(--teal-dark),var(--teal));transition:width .5s;}

.tabs{display:flex;gap:3px;background:var(--bg);border:1px solid var(--border);border-radius:10px;padding:3px;}
.tab{padding:6px 12px;border-radius:7px;font-size:12px;font-weight:600;cursor:pointer;color:var(--text-muted);transition:all .2s;}
.tab.active{background:var(--bg2);color:var(--teal);box-shadow:var(--shadow);}

.modal-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,0,0.5);z-index:200;align-items:center;justify-content:center;}
.modal-overlay.open{display:flex;}
.modal-box{background:var(--bg2);border-radius:20px;padding:26px;width:460px;max-width:92vw;max-height:86vh;overflow-y:auto;box-shadow:0 20px 40px rgba(0,0,0,0.2);}
.modal-hdr{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px;}
.modal-title{font-size:16px;font-weight:700;}
.modal-close{width:32px;height:32px;border-radius:8px;border:1px solid var(--border);background:transparent;cursor:pointer;color:var(--text-muted);font-size:15px;}

/* shell-limit notice inside a modal */
.shell-notice{display:flex;gap:10px;align-items:flex-start;background:rgba(245,158,11,0.08);border:1px solid rgba(245,158,11,0.25);color:var(--warning);border-radius:12px;padding:12px 14px;font-size:12px;line-height:1.7;margin-bottom:14px;}
.shell-notice b{color:var(--warning);}

#toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:#1a1d27;border:1px solid var(--teal-border);color:#fff;padding:11px 22px;border-radius:12px;font-size:13px;font-weight:500;opacity:0;transition:opacity .3s;z-index:999;white-space:nowrap;box-shadow:0 8px 24px rgba(0,0,0,0.3);max-width:90vw;overflow:hidden;text-overflow:ellipsis;}

.empty-state{color:var(--text-muted);padding:24px;text-align:center;font-size:13px;}

@media(max-width:768px){
  /* transition:none — the desktop hover-expand animation on .sidebar has no
     business running here; leaving it on made any width recalculation
     (even a same-result one) visibly slide the centered pill sideways. */
  .sidebar{bottom:20px;top:unset;right:50%;transform:translateX(50%);min-height:unset;height:auto;width:auto!important;flex-direction:row;border-radius:999px;background:rgba(15,17,23,0.92);backdrop-filter:blur(20px);transition:none;}
  .sb-logo,.sb-section,.sb-footer{display:none;}
  .sidebar-nav-mobile{display:flex!important;padding:6px 8px;gap:2px;align-items:center;}
  .sb-mob-item{width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:rgba(255,255,255,0.5);cursor:pointer;}
  .sb-mob-item svg{width:18px;height:18px;}
  .sb-mob-item.active{color:var(--teal);background:var(--teal-dim);}
  .main{margin-right:0;margin-bottom:96px;}
  /* position:static — sticky here clashed with the html/body overflow-x:hidden
     fix (needed to stop the horizontal-scroll bug) on mobile browsers, leaving
     the bar visually stuck mid-scroll instead of releasing. Not sticky is a
     safe tradeoff since the floating bottom nav already covers navigation. */
  .topbar{position:static;padding:0 14px;height:auto;min-height:52px;flex-wrap:wrap;gap:8px;padding-top:8px;padding-bottom:8px;}
  .content{padding:14px;}
  .stats-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;}
  .two-col{grid-template-columns:minmax(0,1fr)!important;}
  th,td{padding:9px 8px;font-size:12px;}
  .card-hdr{flex-direction:column;align-items:stretch;gap:8px;}
  .card-actions{margin-right:0;width:100%;flex-wrap:wrap;}
  .card-actions .btn{flex:1;justify-content:center;}
  .modal-box{width:94vw;padding:18px;}
  .form-grid{grid-template-columns:minmax(0,1fr);}

  /* standalone panels (callcenter/cashier/employee) and the hub page use
     their own top row instead of .topbar — same wrap safety needed so the
     back-to-hub button doesn't get squeezed off narrow phone screens. */
  .cc-shell,.cs-shell,.em-shell{padding:16px;padding-top:44px;}
  .cc-top,.cs-top,.em-top{flex-wrap:wrap;row-gap:8px;}
  .hub{padding:44px 16px;}
  .hub > div[style*="justify-content:space-between"]{flex-wrap:wrap;}
}

.bubble-menu{position:fixed;bottom:90px;display:flex;flex-direction:column-reverse;gap:8px;align-items:flex-start;z-index:300;pointer-events:none;}
.bubble-menu .bubble-item{opacity:0;transform:translateY(14px) scale(.9);transition:opacity .25s,transform .25s;pointer-events:none;}
.bubble-menu.open .bubble-item{opacity:1;transform:translateY(0) scale(1);pointer-events:all;}
.bubble-item{display:flex;align-items:center;gap:10px;background:rgba(15,17,23,0.95);border:1px solid rgba(110,231,201,0.2);border-radius:999px;padding:10px 18px 10px 14px;color:#fff;font-size:13px;font-weight:600;cursor:pointer;backdrop-filter:blur(20px);box-shadow:0 8px 24px rgba(0,0,0,0.3);white-space:nowrap;font-family:'Vazirmatn',sans-serif;}
.bubble-item svg{color:var(--teal);flex-shrink:0;}
.bubble-overlay{position:fixed;inset:0;z-index:250;display:none;}
.bubble-overlay.show{display:block;}
