/* Constrain layout boxes themselves: transform:scale alone retains the old width. */
.key-billing-panel{min-width:0;}
.key-billing-panel label{font-size:12px;color:var(--rk-muted);}
.key-billing-input{width:100%;min-width:0;border:1px solid var(--rk-line);border-radius:10px;padding:10px 12px;background:var(--rk-surface-2);color:var(--rk-ink);font:inherit;margin-top:6px;}
.key-name-form{display:flex;align-items:end;gap:8px;margin:12px 0;}
.key-name-form[hidden]{display:none;}
.key-billing-button{flex-shrink:0;border:1px solid var(--rk-line);border-radius:10px;padding:11px 14px;background:var(--rk-surface-2);color:var(--rk-ink);font-size:13px;font-weight:600;cursor:pointer;}
.key-billing-primary{background:var(--rk-accent);color:var(--rk-accent-ink);border-color:transparent;min-height:44px;}
.key-billing-button:disabled{opacity:.45;cursor:default;}
.key-billing-warning{color:var(--rk-accent-text);line-height:1.5;}
#keyBillingSummary{font-size:13px;line-height:1.7;}
@media(min-width:1024px){#keyBillingCard{grid-column:2;grid-row:1;}#mgTrafficBuyCard{grid-column:1;grid-row:2;}#mgBsCard{grid-row:3;}}
@media(max-width:420px){.key-name-form{flex-direction:column;align-items:stretch;}}
@media (min-width:1024px){
  .desktop-header>.header-inner{width:100%;max-width:1160px!important;padding-inline:24px;box-sizing:border-box;}
  .desktop-header .liquid-glass-nav{display:grid;grid-template-columns:auto minmax(0,1fr) auto;width:100%;max-width:100%;box-sizing:border-box;gap:12px;padding:10px 14px!important;border-radius:24px!important;}
  .desktop-header .liquid-glass-nav>nav{min-width:0;flex-shrink:1;flex-wrap:wrap;justify-content:center;gap:2px;}
  .desktop-header .liquid-glass-nav>nav>a,.desktop-header .liquid-glass-nav>nav>button{white-space:nowrap;font-size:12px!important;padding:8px 10px!important;min-height:36px;}
  .desktop-header .liquid-glass-nav>div:last-child{min-width:0;gap:6px;padding-left:10px;}
  #balancePillDesktop{max-width:108px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
  #logoutBtnDesktop{width:36px;height:36px;flex:0 0 36px;padding:0;justify-content:center;}
  #logoutBtnDesktop>span{display:none;}
  .desktop-header .toggle--daynight{position:relative;transform:none!important;width:36px;height:36px;flex:0 0 36px;margin:0;}
  .desktop-header .toggle--daynight .toggle--btn{width:36px;height:36px;margin:0;border:1px solid var(--rk-line);border-radius:50%;background:var(--rk-surface-2);display:grid;place-items:center;box-sizing:border-box;}
  .desktop-header .toggle--daynight .toggle--btn:before{content:'☾';position:static;width:auto;height:auto;border:0;background:none;color:var(--rk-ink);font-size:24px;line-height:1;}
  .desktop-header .toggle--daynight .toggle--btn:after,.desktop-header .toggle--feature{display:none;}
  .desktop-header .toggle--daynight .toggle--checkbox:checked+.toggle--btn{border:1px solid var(--rk-line);background:var(--rk-surface-2);}
  .desktop-header .toggle--daynight .toggle--checkbox:checked+.toggle--btn:before{content:'☀';position:static;background:none;border:0;}
  .desktop-header .toggle--checkbox:focus-visible+.toggle--btn{outline:2px solid var(--rk-accent);outline-offset:3px;}
}
@media (min-width:1024px) and (max-width:1199px){
  .desktop-header #brandHeaderName{display:none;}
  .desktop-header .liquid-glass-nav{gap:8px;}
}
/* Named areas override legacy full-width card placement, at every breakpoint. */
#mgTraffic.hidden,#mgDevices.hidden,#mgOrgs.hidden{display:none!important;}
#mgTraffic{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);grid-template-areas:'subscription key' 'billing billing' 'purchase history' 'whitelist history' 'whitelistbuy history';gap:18px;align-items:start;}
#consolidatedBillingCard{grid-area:billing!important;display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:24px;scroll-margin-top:150px;}
#consolidatedBillingCard>.mg-kicker,#consolidatedBillingCard>h2,#consolidatedBillingCard>.mg-card-copy{grid-column:1;}
.consolidated-controls{grid-column:2;grid-row:1/4;display:flex;align-items:center;gap:10px;}
.consolidated-controls>label{width:150px;}
#consolidatedQuoteResult,#consolidatedPending{grid-column:1/-1;}
#mgSubCard{grid-area:subscription!important;min-width:0;align-self:stretch;}
#keyBillingCard{grid-area:key!important;}
#mgTrafficBuyCard{grid-area:purchase!important;}
#mgBsCard{grid-area:whitelist!important;}
#mgBuyWrap{grid-area:whitelistbuy!important;}
#mgOpsCard{grid-area:history!important;min-width:0;max-height:380px;overflow:auto;}
#mgTraffic>.mg-panel{padding:22px;}
#mgTraffic .mg-panel h2{font-size:20px!important;}
#mgTraffic .mg-main-metric strong{font-size:44px;}
#mgTraffic .mg-percent-metric strong{font-size:38px;}
#mgTraffic .mg-sub-card{min-height:0;}
#mgTraffic .mg-card-copy{font-size:13px;line-height:1.6;}
.consolidated-lines{margin:14px 0;border-top:1px solid var(--rk-line);}
.consolidated-line{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 0;border-bottom:1px solid var(--rk-line);font-size:13px;}
.consolidated-line small{display:block;color:var(--rk-muted);font-size:12px;margin-top:4px;}
.consolidated-line>strong{white-space:nowrap;}
.consolidated-total{display:flex;justify-content:space-between;font-size:17px;margin:16px 0;}
.consolidated-pending{padding-top:14px;font-size:13px;color:var(--rk-muted);}
.consolidated-pending .key-billing-button{display:inline-block;margin:4px 6px 0 0;}
#consolidatedQuoteResult:empty,#consolidatedPending:empty{display:none;}
#mgTraffic:has(>.mg-column){grid-template-areas:none;grid-template-rows:none;}
#mgTraffic>.mg-column{display:flex;flex-direction:column;gap:18px;min-width:0;background:none!important;border:0!important;border-radius:0!important;padding:0!important;box-shadow:none!important;}
.mg-column>.mg-panel{padding:22px;}
.mg-column>#consolidatedBillingCard{display:block;}
.mg-column .consolidated-controls{justify-content:flex-start;align-items:end;flex-wrap:wrap;}
@media(max-width:767px){
  #mgTraffic{grid-template-columns:minmax(0,1fr);grid-template-areas:'billing' 'key' 'subscription' 'purchase' 'whitelist' 'whitelistbuy' 'history';gap:12px;}
  #mgTraffic>.mg-panel{padding:18px;}
  #mgOpsCard{max-height:420px;}
  #consolidatedBillingCard{grid-template-columns:minmax(0,1fr);}
  .consolidated-controls{grid-column:1;grid-row:auto;flex-wrap:wrap;align-items:end;}
  #mgTraffic:has(>.mg-column){grid-template-areas:'key' 'subscription' 'purchase' 'billing' 'whitelist' 'whitelistbuy' 'history';}
  #mgTraffic>.mg-column{display:contents;}
  .mg-column>.mg-panel{padding:18px;}
}
