/* RXOPD production interface.
   Normalizes the role header, OPD dashboard empty states and QR desk
   across desktop, tablet and mobile without changing business logic. */

html:has(body.rx-role-shell),
body.rx-role-shell{
  max-width:100%!important;
  overflow-x:hidden!important;
}

body.rx-role-shell{
  --rx-opd-opd-header-h:60px;
  --rx-opd-opd-line:#d2dfe9;
  --rx-opd-opd-ink:#15344b;
  --rx-opd-opd-muted:#607488;
  --rx-opd-opd-green:#008f70;
  --rx-opd-opd-navy:#07386f;
}

/* ---------- Header: Dashboard + compact OPD/Billing switch + actions ---------- */
body.rx-role-shell .rx-role-topbar.rxopd-rounded-header{
  grid-template-columns:minmax(180px,1fr) auto minmax(260px,1fr)!important;
  grid-template-rows:1fr!important;
  align-items:center!important;
  overflow:visible!important;
}
body.rx-role-shell .rx-role-topbar.rxopd-rounded-header .rx-role-top-actions{
  position:static!important;
  grid-column:3!important;
  grid-row:1!important;
  justify-self:end!important;
  display:flex!important;
  flex-flow:row nowrap!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:7px!important;
  width:auto!important;
  min-width:0!important;
  max-width:100%!important;
  margin:0!important;
}
body.rx-role-shell .rx-role-top-actions .rxopd-module-switch{
  position:static!important;
  order:0!important;
  display:grid!important;
  grid-template-columns:repeat(2,minmax(52px,auto))!important;
  grid-column:auto!important;
  grid-row:auto!important;
  flex:0 0 auto!important;
  width:auto!important;
  max-width:none!important;
  min-width:0!important;
  min-height:38px!important;
  margin:0!important;
  padding:3px!important;
  gap:3px!important;
  border:1px solid #c9d9e5!important;
  border-radius:11px!important;
  background:#f4f8fb!important;
  box-shadow:none!important;
}
body.rx-role-shell .rx-role-top-actions .rxopd-module-switch a{
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  width:auto!important;
  min-width:52px!important;
  min-height:32px!important;
  height:32px!important;
  padding:0 8px!important;
  border-radius:8px!important;
  color:#245370!important;
  font-size:9px!important;
  font-weight:900!important;
  line-height:1!important;
  letter-spacing:.025em!important;
  text-decoration:none!important;
  white-space:nowrap!important;
}
body.rx-role-shell .rx-role-top-actions .rxopd-module-switch a.active,
body.rx-role-shell .rx-role-top-actions .rxopd-module-switch a[aria-current="page"]{
  background:linear-gradient(135deg,#087f73,#075b83)!important;
  color:#fff!important;
  box-shadow:0 3px 8px rgba(7,91,131,.18)!important;
}
body.rx-role-shell .rx-role-top-actions .rxopd-bell-button,
body.rx-role-shell .rx-role-top-actions .rxopd-header-logout button{
  flex:0 0 40px!important;
  width:40px!important;
  min-width:40px!important;
  max-width:40px!important;
  height:40px!important;
  min-height:40px!important;
  max-height:40px!important;
  margin:0!important;
  padding:8px!important;
  border-radius:12px!important;
}
body.rx-role-shell .rx-role-top-actions .rxopd-header-logout{
  flex:0 0 40px!important;
  width:40px!important;
  min-width:40px!important;
  margin:0!important;
}
body.rx-role-shell .rx-role-top-actions .rxopd-header-logout button span{
  display:none!important;
}

/* ---------- OPD operations dashboard ---------- */
body.rx-role-shell .rxopd-owner-home{
  width:100%!important;
  min-width:0!important;
  max-width:1500px!important;
  margin-inline:auto!important;
  overflow:visible!important;
}
body.rx-role-shell .rxopd-owner-home :is(section,nav,header,article,form,div){
  min-width:0;
}
body.rx-role-shell .rxopd-owner-primary-actions{
  align-items:stretch!important;
}
body.rx-role-shell .rxopd-owner-primary-actions>a,
body.rx-role-shell .rxopd-owner-primary-actions>button{
  width:100%!important;
  min-width:0!important;
  overflow:hidden!important;
}
body.rx-role-shell .rxopd-owner-primary-actions>*>div{
  min-width:0!important;
  overflow:hidden!important;
}
body.rx-role-shell .rxopd-owner-primary-actions strong,
body.rx-role-shell .rxopd-owner-primary-actions small{
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
body.rx-role-shell .rxopd-doctor-picker-card,
body.rx-role-shell .rxopd-token-board{
  width:100%!important;
  min-width:0!important;
  overflow:hidden!important;
}
body.rx-role-shell .rxopd-doctor-picker-head,
body.rx-role-shell .rxopd-section-heading{
  min-width:0!important;
}
body.rx-role-shell .rxopd-doctor-picker-actions{
  min-width:0!important;
}
body.rx-role-shell .rxopd-numbered-token-grid{
  width:100%!important;
  min-width:0!important;
  grid-template-columns:repeat(auto-fit,minmax(58px,1fr))!important;
}
body.rx-role-shell .rxopd-token-empty-state{
  grid-column:1/-1!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:center!important;
  justify-content:center!important;
  width:100%!important;
  min-width:0!important;
  min-height:104px!important;
  padding:20px!important;
  border:1px dashed #bfd0dc!important;
  border-radius:14px!important;
  background:linear-gradient(135deg,#f8fbfd,#eef7f5)!important;
  color:var(--rx-opd-opd-ink)!important;
  text-align:center!important;
}
body.rx-role-shell .rxopd-token-empty-state strong{
  display:block!important;
  margin:0!important;
  font-size:16px!important;
  font-weight:900!important;
  line-height:1.2!important;
}
body.rx-role-shell .rxopd-token-empty-state span{
  display:block!important;
  max-width:520px!important;
  margin-top:5px!important;
  color:var(--rx-opd-opd-muted)!important;
  font-size:11px!important;
  line-height:1.4!important;
}

/* ---------- QR / arrival desk containment ---------- */
body.rx-role-shell .rxqr-page{
  box-sizing:border-box!important;
  width:100%!important;
  min-width:0!important;
  max-width:1500px!important;
  margin:0 auto!important;
  overflow:visible!important;
}
body.rx-role-shell .rxqr-page *,
body.rx-role-shell .rxqr-page *::before,
body.rx-role-shell .rxqr-page *::after{
  box-sizing:border-box!important;
}
body.rx-role-shell .rxqr-hero,
body.rx-role-shell .rxqr-grid,
body.rx-role-shell .rxqr-card,
body.rx-role-shell .rxqr-form,
body.rx-role-shell .rxqr-detail-grid,
body.rx-role-shell .rxqr-recent-list{
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
}
body.rx-role-shell .rxqr-grid{
  display:grid!important;
  grid-template-columns:minmax(0,1.35fr) minmax(280px,.65fr)!important;
  align-items:start!important;
  gap:14px!important;
}
body.rx-role-shell .rxqr-camera-frame{
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  overflow:hidden!important;
}
body.rx-role-shell .rxqr-camera-frame video,
body.rx-role-shell .rxqr-camera-frame canvas{
  display:block!important;
  width:100%!important;
  max-width:100%!important;
}
body.rx-role-shell .rxqr-form :is(input,textarea,select,button),
body.rx-role-shell .rxqr-actions button,
body.rx-role-shell .rxqr-confirm-form button{
  max-width:100%!important;
}
body.rx-role-shell .rxqr-actions{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:8px!important;
}
body.rx-role-shell .rxqr-actions>button{
  width:100%!important;
  min-width:0!important;
}

/* ---------- Tablet ---------- */
@media(max-width:1000px){
  body.rx-role-shell .rx-role-topbar.rxopd-rounded-header{
    grid-template-columns:minmax(150px,1fr) auto minmax(235px,1fr)!important;
  }
  body.rx-role-shell .rx-role-topbar.rxopd-rounded-header .rx-role-top-brand{
    max-width:88px!important;
  }
  body.rx-role-shell .rx-role-top-actions .rxopd-module-switch a{
    min-width:48px!important;
    padding-inline:6px!important;
  }
  body.rx-role-shell .rxqr-grid{
    grid-template-columns:minmax(0,1fr)!important;
  }
}

/* ---------- Mobile ---------- */
@media(max-width:680px){
  body.rx-role-shell{
    --rx-opd-opd-header-h:56px;
  }
  body.rx-role-shell .rx-role-topbar.rxopd-rounded-header,
  body.rx-role-shell.rx-role-sidebar-collapsed .rx-role-topbar.rxopd-rounded-header{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    grid-template-rows:1fr!important;
    align-items:center!important;
    height:56px!important;
    min-height:56px!important;
    padding:6px 7px!important;
    gap:5px!important;
    overflow:visible!important;
  }
  body.rx-role-shell .rx-role-header-left{
    grid-column:1!important;
    grid-row:1!important;
    min-width:0!important;
    gap:6px!important;
  }
  body.rx-role-shell .rx-role-header-left .rx-role-menu-button{
    flex:0 0 40px!important;
    width:40px!important;
    min-width:40px!important;
    height:40px!important;
    min-height:40px!important;
  }
  body.rx-role-shell .rx-role-header-left .rx-role-page-title{
    display:block!important;
    width:auto!important;
    min-width:0!important;
    max-width:none!important;
  }
  body.rx-role-shell .rx-role-header-left .rx-role-page-title small{
    display:none!important;
  }
  body.rx-role-shell .rx-role-header-left .rx-role-page-title strong{
    display:block!important;
    max-width:82px!important;
    overflow:hidden!important;
    font-size:11px!important;
    line-height:1.1!important;
    text-overflow:ellipsis!important;
    white-space:nowrap!important;
  }
  body.rx-role-shell .rx-role-topbar.rxopd-rounded-header .rx-role-top-brand{
    display:none!important;
  }
  body.rx-role-shell .rx-role-topbar.rxopd-rounded-header .rx-role-top-actions{
    position:static!important;
    grid-column:2!important;
    grid-row:1!important;
    justify-self:end!important;
    display:flex!important;
    flex-flow:row nowrap!important;
    align-items:center!important;
    gap:4px!important;
    width:auto!important;
    min-width:0!important;
    margin:0!important;
  }
  body.rx-role-shell .rx-role-top-actions .rxopd-module-switch{
    position:static!important;
    order:0!important;
    grid-column:auto!important;
    grid-row:auto!important;
    display:grid!important;
    grid-template-columns:repeat(2,minmax(38px,1fr))!important;
    width:84px!important;
    min-width:84px!important;
    max-width:84px!important;
    min-height:36px!important;
    margin:0!important;
    padding:2px!important;
    gap:2px!important;
    border-radius:10px!important;
  }
  body.rx-role-shell .rx-role-top-actions .rxopd-module-switch a{
    width:100%!important;
    min-width:0!important;
    height:30px!important;
    min-height:30px!important;
    padding:0 3px!important;
    border-radius:7px!important;
    font-size:7.5px!important;
    letter-spacing:0!important;
  }
  body.rx-role-shell .rx-role-top-actions .rxopd-bell-button,
  body.rx-role-shell .rx-role-top-actions .rxopd-header-logout,
  body.rx-role-shell .rx-role-top-actions .rxopd-header-logout button{
    flex-basis:36px!important;
    width:36px!important;
    min-width:36px!important;
    max-width:36px!important;
    height:36px!important;
    min-height:36px!important;
    max-height:36px!important;
    border-radius:10px!important;
  }
  body.rx-role-shell .rx-role-top-actions .rxopd-bell-button,
  body.rx-role-shell .rx-role-top-actions .rxopd-header-logout button{
    padding:7px!important;
  }
  body.rx-role-shell .rx-role-top-actions .rx-notification-badge{
    right:-3px!important;
    top:-4px!important;
    min-width:17px!important;
    height:17px!important;
    font-size:8px!important;
  }

  body.rx-role-shell .rx-role-main,
  body.rx-role-shell.rx-role-sidebar-collapsed .rx-role-main{
    padding-top:70px!important;
  }

  body.rx-role-shell .rxopd-owner-home{
    gap:9px!important;
  }
  body.rx-role-shell .rxopd-owner-header-compact{
    padding:11px 12px!important;
    border-radius:16px!important;
  }
  body.rx-role-shell .rxopd-owner-header-main{
    gap:7px!important;
  }
  body.rx-role-shell .rxopd-owner-location-name{
    max-width:42%!important;
    font-size:9px!important;
  }
  body.rx-role-shell .rxopd-owner-header-main h1{
    font-size:16px!important;
  }
  body.rx-role-shell .rxopd-owner-header-main p{
    font-size:8.5px!important;
  }
  body.rx-role-shell .rxopd-live-pill{
    flex:0 0 auto!important;
    padding:6px 8px!important;
    font-size:8px!important;
  }

  body.rx-role-shell .rxopd-owner-primary-actions{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:7px!important;
  }
  body.rx-role-shell .rxopd-owner-primary-actions>a,
  body.rx-role-shell .rxopd-owner-primary-actions>button{
    min-height:68px!important;
    padding:9px!important;
    gap:7px!important;
    border-radius:15px!important;
  }
  body.rx-role-shell .rxopd-owner-primary-actions>*>span{
    flex:0 0 31px!important;
    width:31px!important;
    height:31px!important;
    font-size:17px!important;
  }
  body.rx-role-shell .rxopd-owner-primary-actions strong{
    font-size:10.5px!important;
    line-height:1.15!important;
    white-space:normal!important;
  }
  body.rx-role-shell .rxopd-owner-primary-actions small{
    display:-webkit-box!important;
    margin-top:3px!important;
    overflow:hidden!important;
    font-size:7.5px!important;
    line-height:1.2!important;
    -webkit-line-clamp:2!important;
    -webkit-box-orient:vertical!important;
    white-space:normal!important;
  }

  body.rx-role-shell .rxopd-doctor-picker-card,
  body.rx-role-shell .rxopd-token-board{
    padding:11px!important;
    border-radius:17px!important;
  }
  body.rx-role-shell .rxopd-doctor-picker-head,
  body.rx-role-shell .rxopd-section-heading{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    align-items:center!important;
    gap:8px!important;
  }
  body.rx-role-shell .rxopd-doctor-picker-actions{
    display:flex!important;
    align-items:center!important;
    gap:5px!important;
  }
  body.rx-role-shell .rxopd-doctor-picker-actions form{
    min-width:0!important;
  }
  body.rx-role-shell .rxopd-doctor-picker-actions input{
    width:132px!important;
    max-width:35vw!important;
    min-height:34px!important;
    padding:5px 7px!important;
    font-size:9px!important;
  }
  body.rx-role-shell .rxopd-doctor-picker-actions a{
    min-height:34px!important;
    padding:7px 8px!important;
    font-size:9px!important;
  }

  body.rx-role-shell .rxopd-book-next-glow{
    grid-template-columns:38px minmax(0,1fr) auto!important;
    min-height:78px!important;
    padding:9px!important;
    gap:7px!important;
  }
  body.rx-role-shell .rxopd-book-next-token{
    min-width:72px!important;
  }
  body.rx-role-shell .rxopd-token-legend{
    display:flex!important;
    flex-wrap:wrap!important;
    align-items:center!important;
    gap:5px!important;
  }
  body.rx-role-shell .rxopd-token-legend span{
    font-size:8px!important;
  }
  body.rx-role-shell .rxopd-numbered-token-grid{
    display:grid!important;
    grid-template-columns:repeat(auto-fit,minmax(48px,1fr))!important;
    gap:5px!important;
  }
  body.rx-role-shell .rxopd-token-empty-state{
    min-height:92px!important;
    padding:15px 12px!important;
  }
  body.rx-role-shell .rxopd-token-empty-state strong{
    font-size:14px!important;
  }
  body.rx-role-shell .rxopd-token-empty-state span{
    font-size:9.5px!important;
  }

  /* QR desk: one continuous mobile column, no clipped form or camera controls. */
  body.rx-role-shell .rxqr-page{
    padding:0!important;
  }
  body.rx-role-shell .rxqr-hero{
    display:grid!important;
    grid-template-columns:1fr!important;
    gap:9px!important;
    padding:13px!important;
    border-radius:16px!important;
  }
  body.rx-role-shell .rxqr-hero h1{
    margin:4px 0!important;
    font-size:17px!important;
    line-height:1.2!important;
  }
  body.rx-role-shell .rxqr-hero p{
    font-size:9.5px!important;
    line-height:1.4!important;
  }
  body.rx-role-shell .rxqr-flow{
    display:grid!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    gap:4px!important;
    width:100%!important;
  }
  body.rx-role-shell .rxqr-flow>span{
    display:none!important;
  }
  body.rx-role-shell .rxqr-flow>b{
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    min-width:0!important;
    min-height:32px!important;
    padding:4px!important;
    border-radius:8px!important;
    font-size:8px!important;
    text-align:center!important;
  }
  body.rx-role-shell .rxqr-grid{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    gap:9px!important;
  }
  body.rx-role-shell .rxqr-card{
    padding:12px!important;
    border-radius:16px!important;
    overflow:hidden!important;
  }
  body.rx-role-shell .rxqr-card-head{
    display:flex!important;
    align-items:flex-start!important;
    justify-content:space-between!important;
    gap:7px!important;
  }
  body.rx-role-shell .rxqr-card-head h2{
    font-size:14px!important;
    line-height:1.2!important;
  }
  body.rx-role-shell .rxqr-badge{
    flex:0 0 auto!important;
    padding:5px 7px!important;
    font-size:7.5px!important;
  }
  body.rx-role-shell .rxqr-camera-frame{
    min-height:220px!important;
    max-height:56dvh!important;
    border-radius:12px!important;
  }
  body.rx-role-shell .rxqr-actions{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:6px!important;
  }
  body.rx-role-shell .rxqr-actions button,
  body.rx-role-shell .rxqr-form button,
  body.rx-role-shell .rxqr-confirm-form button{
    min-height:40px!important;
    padding:7px!important;
    font-size:10px!important;
  }
  body.rx-role-shell .rxqr-form label{
    min-width:0!important;
  }
  body.rx-role-shell .rxqr-form :is(input,textarea,select){
    width:100%!important;
    min-width:0!important;
    min-height:42px!important;
    padding:8px!important;
    font-size:12px!important;
  }
  body.rx-role-shell .rxqr-form textarea{
    min-height:94px!important;
    resize:vertical!important;
  }
  body.rx-role-shell .rxqr-detail-grid{
    grid-template-columns:1fr!important;
    gap:6px!important;
  }
}

@media(max-width:390px){
  body.rx-role-shell .rx-role-header-left .rx-role-page-title strong{
    max-width:62px!important;
    font-size:9.5px!important;
  }
  body.rx-role-shell .rx-role-top-actions .rxopd-module-switch{
    width:76px!important;
    min-width:76px!important;
    max-width:76px!important;
    grid-template-columns:repeat(2,minmax(35px,1fr))!important;
  }
  body.rx-role-shell .rx-role-top-actions .rxopd-module-switch a{
    font-size:7px!important;
  }
  body.rx-role-shell .rx-role-top-actions .rxopd-bell-button,
  body.rx-role-shell .rx-role-top-actions .rxopd-header-logout,
  body.rx-role-shell .rx-role-top-actions .rxopd-header-logout button{
    flex-basis:34px!important;
    width:34px!important;
    min-width:34px!important;
    max-width:34px!important;
    height:34px!important;
    min-height:34px!important;
    max-height:34px!important;
  }
  body.rx-role-shell .rxopd-owner-primary-actions strong{
    font-size:9.5px!important;
  }
}
