/* Staff details: one true horizontal row on desktop and wide tablets.
   Keep all controls in the existing employee card/grid to avoid touching bookings.
   On narrower screens we intentionally retain the stacked responsive layout. */
@media (min-width:1180px) {
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field) {
    display:grid!important;
    grid-template-columns:74px minmax(0,1fr) minmax(350px,384px)!important;
    grid-template-rows:auto auto auto!important;
    column-gap:12px!important;
    row-gap:10px!important;
    align-items:start!important;
    min-width:0!important;
  }
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  > .calendar-staff-avatar-wrap {
    grid-column:1!important;
    grid-row:1!important;
    justify-self:start!important;
    align-self:start!important;
    min-width:0!important;
  }
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  > .calendar-staff-main {
    grid-column:2!important;
    grid-row:1!important;
    display:grid!important;
    min-width:0!important;
    width:100%!important;
    max-width:none!important;
    padding:0!important;
    margin:0!important;
  }
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .calendar-staff-identity {
    display:grid!important;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
    gap:9px!important;
    max-width:620px!important;
    width:100%!important;
    min-width:0!important;
  }
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .calendar-staff-identity > label,
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .calendar-staff-identity input {
    display:block;
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    box-sizing:border-box!important;
  }
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  > .calendar-staff-actions {
    grid-column:3!important;
    grid-row:1!important;
    display:flex!important;
    flex-direction:row!important;
    flex-wrap:nowrap!important;
    align-items:center!important;
    justify-content:flex-end!important;
    justify-self:stretch!important;
    align-self:center!important;
    gap:9px!important;
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    margin:0!important;
    padding:13px 0 0!important;
  }
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .staff-active-color-row {
    display:flex!important;
    flex:0 0 auto!important;
    width:auto!important;
    min-width:0!important;
    max-width:none!important;
    flex-direction:row!important;
    align-items:center!important;
    justify-content:flex-end!important;
    flex-wrap:nowrap!important;
    gap:8px!important;
    margin:0!important;
    padding:0!important;
  }
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .staff-active-color-row .therapist-color-field {
    display:flex!important;
    flex-direction:row!important;
    flex-wrap:nowrap!important;
    align-items:center!important;
    justify-content:flex-end!important;
    flex:0 0 auto!important;
    gap:5px!important;
    width:auto!important;
    min-width:0!important;
    margin:0!important;
    padding:0!important;
    white-space:nowrap!important;
  }
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .staff-active-color-row .therapist-color-field span {
    font-size:10px!important;
    line-height:1.25!important;
  }
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .staff-active-color-row .calendar-staff-active {
    display:flex!important;
    flex:0 0 auto!important;
    align-items:center!important;
    justify-content:flex-start!important;
    align-self:center!important;
    gap:5px!important;
    min-height:34px!important;
    width:auto!important;
    margin:0!important;
    padding:0!important;
    white-space:nowrap!important;
    font-size:11px!important;
  }
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .calendar-staff-button-row {
    display:flex!important;
    flex:0 0 auto!important;
    flex-wrap:nowrap!important;
    align-items:center!important;
    justify-content:flex-end!important;
    gap:6px!important;
    width:auto!important;
    max-width:none!important;
    min-width:0!important;
    margin:0!important;
  }
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .calendar-staff-button-row .btn {
    display:inline-flex!important;
    justify-content:center!important;
    align-items:center!important;
    flex:0 0 auto!important;
    min-width:0!important;
    width:auto!important;
    height:38px!important;
    min-height:38px!important;
    padding:0 10px!important;
    margin:0!important;
    white-space:nowrap!important;
    font-size:11px!important;
    line-height:1.2!important;
  }
  /* Other content stays in rows below the one-line employee header. */
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  > .therapist-global-parallel-card {
    grid-column:2 / 4!important;
    grid-row:2!important;
    min-width:0!important;
  }
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  > .calendar-staff-services {
    grid-column:2 / 4!important;
    grid-row:3!important;
    min-width:0!important;
  }
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field):not(:has(> .therapist-global-parallel-card))
  > .calendar-staff-services {
    grid-row:2!important;
  }
}
@media (min-width:1180px) and (max-width:1310px) {
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field) {
    grid-template-columns:64px minmax(0,1fr) 350px!important;
    column-gap:8px!important;
  }
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  > .calendar-staff-actions {
    gap:5px!important;
  }
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .staff-active-color-row {gap:5px!important;}
  #settings #organizationUsersCard .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .calendar-staff-button-row .btn {padding:0 8px!important;font-size:10px!important;}
}

/* Tablet width correction: the 74px avatar grid track was smaller than
   the existing 82px avatar and visually covered the name input. Preserve a
   real column for the full avatar, then share the remaining width explicitly. */
@media (min-width:1180px) {
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field) {
    grid-template-columns:100px minmax(0,1fr) minmax(0,350px)!important;
    grid-template-rows:auto auto auto!important;
    column-gap:12px!important;
    row-gap:10px!important;
    min-width:0!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  > .calendar-staff-avatar-wrap {
    display:block!important;
    width:82px!important;
    height:82px!important;
    max-width:82px!important;
    min-width:0!important;
    margin:0!important;
    justify-self:center!important;
    align-self:start!important;
    grid-column:1!important;
    grid-row:1!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  > .calendar-staff-avatar-wrap .calendar-staff-avatar {
    width:82px!important;
    height:82px!important;
    max-width:100%!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  > .calendar-staff-main {
    grid-column:2!important;
    grid-row:1!important;
    min-width:0!important;
    max-width:100%!important;
    width:100%!important;
    align-self:start!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .calendar-staff-identity {
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:10px!important;
    max-width:100%!important;
    width:100%!important;
    min-width:0!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .calendar-staff-identity > label,
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .calendar-staff-identity input {
    min-width:0!important;
    max-width:100%!important;
    width:100%!important;
    box-sizing:border-box!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  > .calendar-staff-actions {
    display:grid!important;
    grid-template-columns:minmax(0,1fr) max-content!important;
    grid-template-rows:38px!important;
    column-gap:7px!important;
    row-gap:0!important;
    align-items:center!important;
    justify-items:stretch!important;
    grid-column:3!important;
    grid-row:1!important;
    align-self:center!important;
    justify-self:stretch!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    padding:13px 0 0!important;
    box-sizing:border-box!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .staff-active-color-row {
    grid-column:1!important;
    grid-row:1!important;
    min-width:0!important;
    max-width:100%!important;
    width:100%!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    flex-wrap:nowrap!important;
    gap:6px!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .calendar-staff-button-row {
    grid-column:2!important;
    grid-row:1!important;
    min-width:0!important;
    width:auto!important;
    max-width:none!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    flex-wrap:nowrap!important;
    gap:5px!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .staff-active-color-row .therapist-color-field {
    flex:0 0 auto!important;
    min-width:0!important;
    gap:4px!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .staff-active-color-row .calendar-staff-active {
    flex:0 0 auto!important;
    min-width:0!important;
    gap:4px!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .calendar-staff-button-row .btn {
    padding:0 9px!important;
    min-width:0!important;
    max-width:none!important;
    height:38px!important;
    white-space:nowrap!important;
    font-size:10.5px!important;
  }
}
@media (min-width:1180px) and (max-width:1400px) {
  /* Still one row, but the action area stays narrow enough for the inputs. */
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field) {
    grid-template-columns:94px minmax(0,1fr) minmax(0,328px)!important;
    column-gap:10px!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  > .calendar-staff-avatar-wrap {
    justify-self:start!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  > .calendar-staff-actions {
    column-gap:5px!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .calendar-staff-button-row .btn {
    padding:0 7px!important;
    font-size:10px!important;
  }
}
/* On the borderline wide tablettes, do not force three tracks if the browser
   viewport leaves too little width after its fixed sidebar. */
@media (min-width:901px) and (max-width:1179px) {
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field) {
    display:grid!important;
    grid-template-columns:94px minmax(0,1fr)!important;
    grid-template-rows:auto auto auto auto!important;
    gap:10px!important;
    min-width:0!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  > .calendar-staff-avatar-wrap {
    grid-column:1!important;
    grid-row:1!important;
    width:82px!important;
    height:82px!important;
    min-width:0!important;
    justify-self:start!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  > .calendar-staff-main {
    grid-column:2!important;
    grid-row:1!important;
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  > .calendar-staff-actions {
    grid-column:2!important;
    grid-row:2!important;
    display:flex!important;
    flex-wrap:wrap!important;
    width:100%!important;
    min-width:0!important;
    justify-content:flex-start!important;
    padding:0!important;
    gap:9px!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .staff-active-color-row {
    width:auto!important;
    flex:0 1 auto!important;
    justify-content:flex-start!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  .calendar-staff-button-row {
    display:flex!important;
    width:auto!important;
    flex-wrap:nowrap!important;
    gap:8px!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  > .therapist-global-parallel-card {
    grid-column:2!important;
    grid-row:3!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field)
  > .calendar-staff-services {
    grid-column:2!important;
    grid-row:4!important;
  }
  #settings #organizationUsersCard
  .calendar-staff-card:has(.staff-active-color-row .therapist-color-field):not(:has(> .therapist-global-parallel-card))
  > .calendar-staff-services {
    grid-row:3!important;
  }
}
