/* STO-CABINET-r48 — polish for STO cabinet/dashboard.
   Scope: STO dashboard/dispatch only. No API/route/business logic changes. */
:root{
  --sto-r48-orange:#ff6a00;
  --sto-r48-orange-soft:rgba(255,106,0,.10);
  --sto-r48-line:rgba(15,23,42,.10);
  --sto-r48-text:#101821;
  --sto-r48-muted:#667085;
  --sto-r48-card:#fff;
}

body[data-role="sto"] .sto-dispatch-page,
.sto-dispatch-page{
  width:100%;
  max-width:1180px!important;
  margin:0 auto;
  padding:clamp(18px,3vw,34px) clamp(14px,3vw,32px) calc(var(--bnav-h,0px) + 34px)!important;
  box-sizing:border-box;
}

.sto-dispatch-page *{
  box-sizing:border-box;
  min-width:0;
}

.sto-dispatch-head{
  position:relative;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:18px;
  padding:24px;
  margin:0 0 18px;
  border:1px solid rgba(255,106,0,.14);
  border-radius:28px;
  background:
    radial-gradient(circle at 18% 0%, rgba(255,106,0,.14), transparent 34%),
    linear-gradient(135deg, #fff 0%, #fff8f2 100%);
  box-shadow:0 16px 42px rgba(15,23,42,.08);
  overflow:hidden;
}
.sto-dispatch-head::after{
  content:'';
  position:absolute;
  right:-70px;
  top:-70px;
  width:220px;
  height:220px;
  border-radius:50%;
  border:36px solid rgba(255,106,0,.055);
  pointer-events:none;
}
.sto-dispatch-head > *{position:relative;z-index:1;}
.sto-dispatch-head .t-lbl{
  display:inline-flex;
  align-items:center;
  min-height:26px;
  padding:0 12px;
  border-radius:999px;
  background:rgba(255,106,0,.10);
  border:1px solid rgba(255,106,0,.16);
  color:var(--sto-r48-orange);
  font-size:11px;
  font-weight:950;
  letter-spacing:.04em;
  text-transform:uppercase;
}
.sto-dispatch-title{
  margin:12px 0 0!important;
  color:var(--sto-r48-text);
  font-size:clamp(28px,3.2vw,44px)!important;
  line-height:1.02!important;
  font-weight:950!important;
  letter-spacing:-.055em;
  overflow-wrap:anywhere;
}
.sto-dispatch-sub{
  margin-top:10px!important;
  max-width:680px;
  color:var(--sto-r48-muted)!important;
  font-size:16px!important;
  line-height:1.45!important;
  font-weight:650;
}
.sto-dispatch-head-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}
.sto-dispatch-head-actions .btn,
.sto-section-head .btn,
.sto-row-btn,
.sto-btn{
  min-height:44px!important;
  border-radius:16px!important;
  font-size:14px!important;
  font-weight:900!important;
  line-height:1.15!important;
  white-space:normal!important;
  overflow-wrap:anywhere;
}
.sto-dispatch-head-actions .btn-primary,
.sto-section-head .btn-primary,
.sto-row-btn.btn-primary,
.sto-btn.btn-primary{
  background:linear-gradient(180deg,#ff7a1a 0%,#ff5a00 100%)!important;
  border-color:rgba(255,90,0,.82)!important;
  color:#fff!important;
  box-shadow:0 12px 24px rgba(255,90,0,.18)!important;
}
.sto-dispatch-head-actions .btn-outline,
.sto-section-head .btn-outline,
.sto-row-btn.btn-outline,
.sto-btn.btn-outline{
  background:rgba(255,255,255,.88)!important;
  border-color:rgba(15,23,42,.12)!important;
  color:#1f2937!important;
}

.sto-dispatch-sync{
  margin:0 0 18px!important;
  padding:12px 14px!important;
  border-radius:18px!important;
  background:rgba(255,255,255,.80)!important;
  border:1px solid rgba(15,23,42,.08)!important;
  box-shadow:0 10px 26px rgba(15,23,42,.045);
  color:#64748b!important;
  font-size:12px!important;
  line-height:1.35!important;
}
.sto-dispatch-sync span,
.sto-dispatch-sync-error{
  max-width:100%;
  overflow:visible!important;
  text-overflow:clip!important;
  white-space:normal!important;
  overflow-wrap:anywhere;
}

.sto-stat-grid{
  display:grid!important;
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:14px!important;
  margin:0 0 18px!important;
}
.sto-stat-card{
  position:relative;
  min-height:122px;
  display:grid;
  align-content:center;
  justify-items:start;
  gap:7px;
  padding:18px!important;
  text-align:left!important;
  border-radius:24px!important;
  border:1px solid rgba(15,23,42,.08)!important;
  background:linear-gradient(180deg,#fff 0%,#fffaf6 100%)!important;
  box-shadow:0 12px 30px rgba(15,23,42,.06);
  overflow:hidden;
}
.sto-stat-card::after{
  content:'';
  position:absolute;
  right:-24px;
  top:-24px;
  width:82px;
  height:82px;
  border-radius:50%;
  background:rgba(255,106,0,.08);
}
.sto-stat-ico,
.sto-order-ico,
.sto-dash-ico{
  width:42px;
  height:42px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:14px;
  background:rgba(255,106,0,.10);
  border:1px solid rgba(255,106,0,.16);
  color:var(--sto-r48-orange)!important;
  font-size:0!important;
  flex:0 0 auto;
}
.sto-stat-ico::before,
.sto-order-ico::before,
.sto-dash-ico::before{
  content:'';
  width:22px;
  height:22px;
  background:currentColor;
  -webkit-mask:var(--kr-icon-shop, none) center / contain no-repeat;
  mask:var(--kr-icon-shop, none) center / contain no-repeat;
}
.sto-stat-val{
  position:relative;
  z-index:1;
  color:#111827!important;
  font-size:34px!important;
  line-height:.95!important;
  font-weight:950!important;
  letter-spacing:-.04em;
}
.sto-stat-lbl{
  position:relative;
  z-index:1;
  color:#667085!important;
  font-size:13px!important;
  line-height:1.25!important;
  font-weight:800;
  overflow-wrap:anywhere;
}

.sto-section{
  margin:0 0 16px!important;
  border-radius:26px!important;
  border:1px solid rgba(15,23,42,.08)!important;
  background:rgba(255,255,255,.90)!important;
  box-shadow:0 12px 34px rgba(15,23,42,.055);
  overflow:hidden;
}
.sto-section-head{
  min-height:68px;
  padding:18px 20px!important;
  border-bottom:1px solid rgba(15,23,42,.07)!important;
  background:linear-gradient(180deg,rgba(255,255,255,.96),rgba(255,250,246,.92));
  gap:12px;
  flex-wrap:wrap;
}
.sto-section-title{
  color:#111827!important;
  font-size:18px!important;
  line-height:1.15!important;
  font-weight:950!important;
  letter-spacing:-.03em;
  overflow-wrap:anywhere;
}
.sto-section-count{
  background:rgba(255,106,0,.12)!important;
  border:1px solid rgba(255,106,0,.20);
  color:var(--sto-r48-orange)!important;
}
.sto-order-row,
.sto-master-row{
  display:grid!important;
  grid-template-columns:48px minmax(0,1fr) auto;
  align-items:center!important;
  gap:14px!important;
  min-height:76px;
  padding:14px 18px!important;
  border-bottom:1px solid rgba(15,23,42,.065)!important;
  background:rgba(255,255,255,.70);
}
.sto-order-row:last-child,
.sto-master-row:last-child{border-bottom:0!important;}
.sto-order-body,
.sto-master-body{
  min-width:0;
  display:grid;
  gap:5px;
}
.sto-order-name,
.sto-master-name{
  color:#111827!important;
  font-size:15px!important;
  line-height:1.25!important;
  font-weight:900!important;
  overflow-wrap:anywhere;
}
.sto-order-meta,
.sto-master-spec{
  color:#667085!important;
  font-size:12.5px!important;
  line-height:1.35!important;
  font-weight:650;
  overflow-wrap:anywhere;
}
.sto-lead-chips,
.sto-master-stats{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  min-width:0;
}
.sto-lead-chip,
.sto-badge{
  max-width:100%;
  min-height:24px;
  display:inline-flex!important;
  align-items:center;
  padding:4px 9px!important;
  border-radius:999px!important;
  font-size:11px!important;
  line-height:1.15!important;
  font-weight:850!important;
  white-space:normal!important;
  overflow-wrap:anywhere;
}
.sto-badge--busy{
  background:rgba(255,106,0,.10)!important;
  color:var(--sto-r48-orange)!important;
  border-color:rgba(255,106,0,.18)!important;
}
.sto-badge--done{
  background:rgba(16,185,129,.10)!important;
  color:#059669!important;
  border-color:rgba(16,185,129,.18)!important;
}
.sto-master-av{
  width:48px!important;
  height:48px!important;
  border-radius:16px!important;
  background:rgba(255,106,0,.10)!important;
  border:1px solid rgba(255,106,0,.16);
  color:var(--sto-r48-orange)!important;
  font-size:16px!important;
  font-weight:950!important;
}
.sto-master-open{
  width:42px;
  height:42px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:14px!important;
  border:1px solid rgba(15,23,42,.10)!important;
  background:#fff!important;
  color:var(--sto-r48-orange)!important;
  font-size:0!important;
}
.sto-master-open::before{
  content:'›';
  font-size:30px;
  line-height:1;
  font-weight:300;
}
.sto-order-actions{
  min-width:0!important;
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:8px!important;
  flex-wrap:wrap!important;
}
.sto-row-btn{
  min-width:104px;
  padding:9px 12px!important;
}
.sto-empty-line{
  padding:22px!important;
  color:#667085!important;
  font-size:14px!important;
  line-height:1.5!important;
  overflow-wrap:anywhere;
}

#sto-accept-assign-modal .cmodal,
#sto-assign-order-modal .cmodal,
#sto-unassign-order-modal .cmodal,
#sto-invite-modal .cmodal{
  border-radius:26px!important;
  overflow:hidden;
}
#sto-accept-assign-modal .cmodal-head,
#sto-assign-order-modal .cmodal-head,
#sto-unassign-order-modal .cmodal-head,
#sto-invite-modal .cmodal-head{
  background:linear-gradient(180deg,#fff,#fff8f2)!important;
  border-bottom:1px solid rgba(15,23,42,.08)!important;
}
#sto-accept-assign-modal .cmodal-head h3,
#sto-assign-order-modal .cmodal-head h3,
#sto-unassign-order-modal .cmodal-head h3,
#sto-invite-modal .cmodal-head h3{
  color:#111827;
  font-size:18px!important;
  line-height:1.2!important;
  font-weight:950!important;
  overflow-wrap:anywhere;
}

@media (max-width:767px){
  .sto-dispatch-page{
    padding:16px 12px calc(var(--bnav-h,0px) + 22px)!important;
  }
  .sto-dispatch-head{
    grid-template-columns:1fr;
    padding:18px;
    border-radius:24px;
  }
  .sto-dispatch-title{font-size:26px!important;}
  .sto-dispatch-sub{font-size:14px!important;}
  .sto-dispatch-head-actions{
    width:100%;
    display:grid!important;
    grid-template-columns:1fr 1fr;
  }
  .sto-dispatch-head-actions .btn{width:100%;justify-content:center;}
  .sto-stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important;}
  .sto-stat-card{min-height:106px;padding:14px!important;border-radius:20px!important;}
  .sto-stat-val{font-size:27px!important;}
  .sto-stat-lbl{font-size:11.5px!important;}
  .sto-order-row,
  .sto-master-row{
    grid-template-columns:42px minmax(0,1fr);
    gap:10px!important;
    padding:13px 14px!important;
  }
  .sto-order-actions,
  .sto-master-stats{
    grid-column:1 / -1;
    width:100%;
    justify-content:stretch!important;
  }
  .sto-order-actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;}
  .sto-row-btn{width:100%;min-width:0;font-size:12px!important;padding:9px 7px!important;}
  .sto-master-open{grid-column:1 / -1;width:100%;height:40px;}
  .sto-section-head{padding:15px!important;}
  .sto-section-title{font-size:16px!important;}
}

@media (min-width:768px){
  .sto-dispatch-page{max-width:1080px!important;}
  .sto-section-grid-r48{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:16px;
  }
}
@media (min-width:1024px){
  .sto-dispatch-page{max-width:1240px!important;}
  .sto-stat-grid{gap:18px!important;}
  .sto-section{margin-bottom:18px!important;}
  .sto-order-row.sto-dispatch-row{
    grid-template-columns:52px minmax(0,1fr) minmax(220px,auto)!important;
  }
}
@media (min-width:1200px){
  .sto-dispatch-page{max-width:1320px!important;}
  .sto-dispatch-head{padding:30px 32px;}
  .sto-section-title{font-size:19px!important;}
}
@media (orientation:landscape) and (max-height:760px) and (min-width:768px){
  .sto-dispatch-page{padding-top:16px!important;}
  .sto-dispatch-head{padding:18px 22px;margin-bottom:12px;}
  .sto-dispatch-title{font-size:30px!important;margin-top:8px!important;}
  .sto-dispatch-sub{font-size:14px!important;margin-top:6px!important;}
  .sto-stat-card{min-height:96px;padding:14px!important;}
  .sto-section-head{min-height:58px;padding:14px 16px!important;}
  .sto-order-row,.sto-master-row{min-height:64px;padding:11px 14px!important;}
}
